Merge remote-tracking branch 'origin/master' into drizzle
Conflicts: libraries/export/htmlword.php libraries/export/latex.php libraries/export/odt.php libraries/export/sql.php libraries/export/texytext.php libraries/export/xml.php
@ -40,10 +40,12 @@ phpMyAdmin - ChangeLog
|
||||
+ [interface] Improved support for triggers
|
||||
+ [interface] Improved server monitoring
|
||||
+ AJAX for table Structure column Add
|
||||
+ AJAX for table Operations copy table
|
||||
|
||||
3.4.5.0 (not yet released)
|
||||
- bug #3375325 [interface] Page list in navigation frame looks odd
|
||||
- bug #3313235 [interface] Error div misplaced
|
||||
- bug #3374802 [interface] Comment on a column breaks inline editing
|
||||
|
||||
3.4.4.0 (not yet released)
|
||||
- bug #3323060 [parser] SQL parser breaks AJAX requests if query has unclosed quotes
|
||||
|
||||
106
js/functions.js
@ -211,9 +211,10 @@ function confirmLink(theLink, theSqlQuery)
|
||||
var is_confirmed = confirm(PMA_messages['strDoYouReally'] + ' :\n' + theSqlQuery);
|
||||
if (is_confirmed) {
|
||||
if ( $(theLink).hasClass('formLinkSubmit') ) {
|
||||
var name = 'is_js_confirmed';
|
||||
if($(theLink).attr('href').indexOf('usesubform') != -1)
|
||||
name = 'subform[' + $(theLink).attr('href').substr('#').match(/usesubform\[(\d+)\]/i)[1] + '][is_js_confirmed]';
|
||||
var name = 'is_js_confirmed';
|
||||
if ($(theLink).attr('href').indexOf('usesubform') != -1) {
|
||||
name = 'subform[' + $(theLink).attr('href').substr('#').match(/usesubform\[(\d+)\]/i)[1] + '][is_js_confirmed]';
|
||||
}
|
||||
|
||||
$(theLink).parents('form').append('<input type="hidden" name="' + name + '" value="1" />');
|
||||
} else if ( typeof(theLink.href) != 'undefined' ) {
|
||||
@ -596,7 +597,7 @@ $(document).ready(function() {
|
||||
* next pages reached via AJAX); a tr may have the class noclick to remove
|
||||
* this behavior.
|
||||
*/
|
||||
$('tr.odd:not(.noclick), tr.even:not(.noclick)').live('click',function(e) {
|
||||
$('table:not(.noclick) tr.odd:not(.noclick), table:not(.noclick) tr.even:not(.noclick)').live('click',function(e) {
|
||||
// do not trigger when clicked on anchor
|
||||
if ($(e.target).is('a, img, a *')) {
|
||||
return;
|
||||
@ -848,10 +849,11 @@ function insertValueQuery() {
|
||||
var chaineAj = "";
|
||||
var NbSelect = 0;
|
||||
for(var i=0; i<myListBox.options.length; i++) {
|
||||
if (myListBox.options[i].selected){
|
||||
if (myListBox.options[i].selected) {
|
||||
NbSelect++;
|
||||
if (NbSelect > 1)
|
||||
if (NbSelect > 1) {
|
||||
chaineAj += ", ";
|
||||
}
|
||||
chaineAj += myListBox.options[i].value;
|
||||
}
|
||||
}
|
||||
@ -1139,12 +1141,14 @@ function pdfPaperSize(format, axis) {
|
||||
function popupBSMedia(url_params, bs_ref, m_type, is_cust_type, w_width, w_height)
|
||||
{
|
||||
// if width not specified, use default
|
||||
if (w_width == undefined)
|
||||
if (w_width == undefined) {
|
||||
w_width = 640;
|
||||
}
|
||||
|
||||
// if height not specified, use default
|
||||
if (w_height == undefined)
|
||||
if (w_height == undefined) {
|
||||
w_height = 480;
|
||||
}
|
||||
|
||||
// open popup window (for displaying video/playing audio)
|
||||
var mediaWin = window.open('bs_play_media.php?' + url_params + '&bs_reference=' + bs_ref + '&media_type=' + m_type + '&custom_type=' + is_cust_type, 'viewBSMedia', 'width=' + w_width + ', height=' + w_height + ', resizable=1, scrollbars=1, status=0');
|
||||
@ -1161,15 +1165,17 @@ function popupBSMedia(url_params, bs_ref, m_type, is_cust_type, w_width, w_heigh
|
||||
function requestMIMETypeChange(db, table, reference, current_mime_type)
|
||||
{
|
||||
// no mime type specified, set to default (nothing)
|
||||
if (undefined == current_mime_type)
|
||||
if (undefined == current_mime_type) {
|
||||
current_mime_type = "";
|
||||
}
|
||||
|
||||
// prompt user for new mime type
|
||||
var new_mime_type = prompt("Enter custom MIME type", current_mime_type);
|
||||
|
||||
// if new mime_type is specified and is not the same as the previous type, request for mime type change
|
||||
if (new_mime_type && new_mime_type != current_mime_type)
|
||||
if (new_mime_type && new_mime_type != current_mime_type) {
|
||||
changeMIMEType(db, table, reference, new_mime_type);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1470,8 +1476,11 @@ function PMA_createChart(passedSettings) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(lastValue==null) diff = curValue.x - thisChart.xAxis[0].getExtremes().max;
|
||||
else diff = parseInt(curValue.x - lastValue.x);
|
||||
if (lastValue==null) {
|
||||
diff = curValue.x - thisChart.xAxis[0].getExtremes().max;
|
||||
} else {
|
||||
diff = parseInt(curValue.x - lastValue.x);
|
||||
}
|
||||
|
||||
thisChart.xAxis[0].setExtremes(
|
||||
thisChart.xAxis[0].getExtremes().min+diff,
|
||||
@ -1485,7 +1494,9 @@ function PMA_createChart(passedSettings) {
|
||||
numLoadedPoints++;
|
||||
|
||||
// Timeout has been cleared => don't start a new timeout
|
||||
if(chart_activeTimeouts[container] == null) return;
|
||||
if (chart_activeTimeouts[container] == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
chart_activeTimeouts[container] = setTimeout(
|
||||
thisChart.options.realtime.timeoutCallBack,
|
||||
@ -1537,11 +1548,13 @@ function PMA_createChart(passedSettings) {
|
||||
|
||||
/* Set/Get realtime chart default values */
|
||||
if(passedSettings.realtime) {
|
||||
if(!passedSettings.realtime.refreshRate)
|
||||
if(!passedSettings.realtime.refreshRate) {
|
||||
passedSettings.realtime.refreshRate = 5000;
|
||||
}
|
||||
|
||||
if(!passedSettings.realtime.numMaxPoints)
|
||||
if(!passedSettings.realtime.numMaxPoints) {
|
||||
passedSettings.realtime.numMaxPoints = 30;
|
||||
}
|
||||
|
||||
// Allow custom POST vars to be added
|
||||
passedSettings.realtime.postData = $.extend(false,{ ajax_request: true, chart_data: 1, type: passedSettings.realtime.type },passedSettings.realtime.postData);
|
||||
@ -1597,10 +1610,15 @@ function PMA_createProfilingChart(data, options) {
|
||||
|
||||
// Formats a profiling duration nicely. Used in PMA_createProfilingChart() and server_status.js
|
||||
function PMA_prettyProfilingNum(num, acc) {
|
||||
if(!acc) acc = 1;
|
||||
if (!acc) {
|
||||
acc = 1;
|
||||
}
|
||||
acc = Math.pow(10,acc);
|
||||
if(num*1000 < 0.1) num = Math.round(acc*(num*1000*1000))/acc + 'µ'
|
||||
else if(num < 0.1) num = Math.round(acc*(num*1000))/acc + 'm'
|
||||
if (num*1000 < 0.1) {
|
||||
num = Math.round(acc*(num*1000*1000))/acc + 'µ'
|
||||
} else if (num < 0.1) {
|
||||
num = Math.round(acc*(num*1000))/acc + 'm'
|
||||
}
|
||||
|
||||
return num + 's';
|
||||
}
|
||||
@ -1954,6 +1972,9 @@ $(document).ready(function() {
|
||||
if ($("#sqlqueryresults").length != 0) {
|
||||
$("#sqlqueryresults").remove();
|
||||
}
|
||||
if ($("#result_query").length != 0) {
|
||||
$("#result_query").remove();
|
||||
}
|
||||
if (data.success == true) {
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
$("<div id='sqlqueryresults'></div>").insertAfter("#topmenucontainer");
|
||||
@ -1961,10 +1982,57 @@ $(document).ready(function() {
|
||||
$("#result_query .notice").remove();
|
||||
$("#result_query").prepend((data.message));
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error);
|
||||
$temp_div = $("<div id='temp_div'></div>")
|
||||
$temp_div.html(data.error);
|
||||
$error = $temp_div.find("code").addClass("error");
|
||||
PMA_ajaxShowMessage($error);
|
||||
}
|
||||
}) // end $.post()
|
||||
});//end of alterTableOrderby ajax submit
|
||||
|
||||
/**
|
||||
*Ajax action for submitting the "Copy table"
|
||||
**/
|
||||
$("#copyTable.ajax input[name='submit_copy']").live('click', function(event) {
|
||||
event.preventDefault();
|
||||
$form = $("#copyTable");
|
||||
if($form.find("input[name='switch_to_new']").attr('checked')) {
|
||||
$form.append('<input type="hidden" name="submit_copy" value="Go" />');
|
||||
$form.removeClass('ajax');
|
||||
$form.find("#ajax_request_hidden").remove();
|
||||
$form.submit();
|
||||
} else {
|
||||
PMA_prepareForAjaxRequest($form);
|
||||
/*variables which stores the common attributes*/
|
||||
$.post($form.attr('action'), $form.serialize()+"&submit_copy=Go", function(data) {
|
||||
if ($("#sqlqueryresults").length != 0) {
|
||||
$("#sqlqueryresults").remove();
|
||||
}
|
||||
if ($("#result_query").length != 0) {
|
||||
$("#result_query").remove();
|
||||
}
|
||||
if (data.success == true) {
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
$("<div id='sqlqueryresults'></div>").insertAfter("#topmenucontainer");
|
||||
$("#sqlqueryresults").html(data.sql_query);
|
||||
$("#result_query .notice").remove();
|
||||
$("#result_query").prepend((data.message));
|
||||
$("#copyTable").find("select[name='target_db'] option[value="+data.db+"]").attr('selected', 'selected');
|
||||
|
||||
//Refresh navigation frame when the table is coppied
|
||||
if (window.parent && window.parent.frame_navigation) {
|
||||
window.parent.frame_navigation.location.reload();
|
||||
}
|
||||
} else {
|
||||
$temp_div = $("<div id='temp_div'></div>")
|
||||
$temp_div.html(data.error);
|
||||
$error = $temp_div.find("code").addClass("error");
|
||||
PMA_ajaxShowMessage($error);
|
||||
}
|
||||
}) // end $.post()
|
||||
}
|
||||
});//end of copyTable ajax submit
|
||||
|
||||
}, 'top.frame_content'); //end $(document).ready for 'Table operations'
|
||||
|
||||
|
||||
|
||||
@ -33,17 +33,17 @@ function showDetails(i, update_size, insert_size, remove_size, insert_index, rem
|
||||
// The image source is changed when the showDetails function is called.
|
||||
if ($img.hasClass('selected')) {
|
||||
if ($img.hasClass('struct_img')) {
|
||||
$img.attr('src', pmaThemeImage + 'new_struct_selected.jpg');
|
||||
$img.attr('src', pmaThemeImage + 'new_struct_selected.png');
|
||||
}
|
||||
if ($img.hasClass('data_img')) {
|
||||
$img.attr('src', pmaThemeImage + 'new_data_selected.jpg');
|
||||
$img.attr('src', pmaThemeImage + 'new_data_selected.png');
|
||||
}
|
||||
} else {
|
||||
if ($img.hasClass('struct_img')) {
|
||||
$img.attr('src', pmaThemeImage + 'new_struct.jpg');
|
||||
$img.attr('src', pmaThemeImage + 'new_struct.png');
|
||||
}
|
||||
if ($img.hasClass('data_img')) {
|
||||
$img.attr('src', pmaThemeImage + 'new_data.jpg');
|
||||
$img.attr('src', pmaThemeImage + 'new_data.png');
|
||||
}
|
||||
}
|
||||
|
||||
@ -347,9 +347,9 @@ $(document).ready(function() {
|
||||
var $img = $(this);
|
||||
$img.addClass('hover');
|
||||
if ($img.hasClass('selected')) {
|
||||
$img.attr('src', pmaThemeImage + 'new_struct_selected_hovered.jpg');
|
||||
$img.attr('src', pmaThemeImage + 'new_struct_selected_hovered.png');
|
||||
} else {
|
||||
$img.attr('src', pmaThemeImage + 'new_struct_hovered.jpg');
|
||||
$img.attr('src', pmaThemeImage + 'new_struct_hovered.png');
|
||||
}
|
||||
},
|
||||
function() {
|
||||
@ -357,9 +357,9 @@ $(document).ready(function() {
|
||||
var $img = $(this);
|
||||
$img.removeClass('hover');
|
||||
if ($img.hasClass('selected')) {
|
||||
$img.attr('src', pmaThemeImage + 'new_struct_selected.jpg');
|
||||
$img.attr('src', pmaThemeImage + 'new_struct_selected.png');
|
||||
} else {
|
||||
$img.attr('src', pmaThemeImage + 'new_struct.jpg');
|
||||
$img.attr('src', pmaThemeImage + 'new_struct.png');
|
||||
}
|
||||
}
|
||||
);
|
||||
@ -370,9 +370,9 @@ $(document).ready(function() {
|
||||
var $img = $(this);
|
||||
$img.addClass('hover');
|
||||
if ($img.hasClass('selected')) {
|
||||
$img.attr('src', pmaThemeImage + 'new_data_selected_hovered.jpg');
|
||||
$img.attr('src', pmaThemeImage + 'new_data_selected_hovered.png');
|
||||
} else {
|
||||
$img.attr('src', pmaThemeImage + 'new_data_hovered.jpg');
|
||||
$img.attr('src', pmaThemeImage + 'new_data_hovered.png');
|
||||
}
|
||||
},
|
||||
function() {
|
||||
@ -380,9 +380,9 @@ $(document).ready(function() {
|
||||
var $img = $(this);
|
||||
$img.removeClass('hover');
|
||||
if ($img.hasClass('selected')) {
|
||||
$img.attr('src', pmaThemeImage + 'new_data_selected.jpg');
|
||||
$img.attr('src', pmaThemeImage + 'new_data_selected.png');
|
||||
} else {
|
||||
$img.attr('src', pmaThemeImage + 'new_data.jpg');
|
||||
$img.attr('src', pmaThemeImage + 'new_data.png');
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@ -1183,7 +1183,7 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view
|
||||
// in the tools div, only display the Inline link when not in ajax
|
||||
// mode because 1) it currently does not work and 2) we would
|
||||
// have two similar mechanisms on the page for the same goal
|
||||
if ($is_select || $GLOBALS['is_ajax_request'] === false) {
|
||||
if ($is_select || $GLOBALS['is_ajax_request'] === false && ! $query_too_big) {
|
||||
// see in js/functions.js the jQuery code attached to id inline_edit
|
||||
// document.write conflicts with jQuery, hence used $().append()
|
||||
echo "<script type=\"text/javascript\">\n" .
|
||||
|
||||
@ -27,14 +27,14 @@ $chg_evt_handler = (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER >= 5)
|
||||
}?>
|
||||
<fieldset id="fieldset_change_password">
|
||||
<legend><?php echo __('Change password'); ?></legend>
|
||||
<table class="data">
|
||||
<tr class="odd noclick">
|
||||
<table class="data noclick">
|
||||
<tr class="odd">
|
||||
<td colspan="2">
|
||||
<input type="radio" name="nopass" value="1" id="nopass_1" onclick="pma_pw.value = ''; pma_pw2.value = ''; this.checked = true" />
|
||||
<label for="nopass_1"><?php echo __('No Password') . "\n"; ?></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="even noclick">
|
||||
<tr class="even">
|
||||
<td>
|
||||
<input type="radio" name="nopass" value="0" id="nopass_0" onclick="document.getElementById('text_pma_pw').focus();" checked="checked " />
|
||||
<label for="nopass_0"><?php echo __('Password'); ?>: </label>
|
||||
|
||||
@ -42,188 +42,188 @@ if (isset($plugin_list)) {
|
||||
);
|
||||
} else {
|
||||
|
||||
/**
|
||||
* Set of functions used to build exports of tables
|
||||
*/
|
||||
/**
|
||||
* Set of functions used to build exports of tables
|
||||
*/
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export header
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Outputs export header
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in NHibernate format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
{
|
||||
global $CG_FORMATS, $CG_HANDLERS, $what;
|
||||
$format = $GLOBALS[$what . '_format'];
|
||||
if (isset($CG_FORMATS[$format])) {
|
||||
return PMA_exportOutputHandler($CG_HANDLERS[$format]($db, $table, $crlf));
|
||||
/**
|
||||
* Outputs the content of a table in NHibernate format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
{
|
||||
global $CG_FORMATS, $CG_HANDLERS, $what;
|
||||
$format = $GLOBALS[$what . '_format'];
|
||||
if (isset($CG_FORMATS[$format])) {
|
||||
return PMA_exportOutputHandler($CG_HANDLERS[$format]($db, $table, $crlf));
|
||||
}
|
||||
return PMA_exportOutputHandler(sprintf("%s is not supported.", $format));
|
||||
}
|
||||
return PMA_exportOutputHandler(sprintf("%s is not supported.", $format));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @package phpMyAdmin-Export
|
||||
* @subpackage Codegen
|
||||
*/
|
||||
class TableProperty
|
||||
{
|
||||
public $name;
|
||||
public $type;
|
||||
public $nullable;
|
||||
public $key;
|
||||
public $defaultValue;
|
||||
public $ext;
|
||||
function __construct($row)
|
||||
/**
|
||||
*
|
||||
* @package phpMyAdmin-Export
|
||||
* @subpackage Codegen
|
||||
*/
|
||||
class TableProperty
|
||||
{
|
||||
$this->name = trim($row[0]);
|
||||
$this->type = trim($row[1]);
|
||||
$this->nullable = trim($row[2]);
|
||||
$this->key = trim($row[3]);
|
||||
$this->defaultValue = trim($row[4]);
|
||||
$this->ext = trim($row[5]);
|
||||
public $name;
|
||||
public $type;
|
||||
public $nullable;
|
||||
public $key;
|
||||
public $defaultValue;
|
||||
public $ext;
|
||||
function __construct($row)
|
||||
{
|
||||
$this->name = trim($row[0]);
|
||||
$this->type = trim($row[1]);
|
||||
$this->nullable = trim($row[2]);
|
||||
$this->key = trim($row[3]);
|
||||
$this->defaultValue = trim($row[4]);
|
||||
$this->ext = trim($row[5]);
|
||||
}
|
||||
function getPureType()
|
||||
{
|
||||
$pos=strpos($this->type, "(");
|
||||
if ($pos > 0)
|
||||
return substr($this->type, 0, $pos);
|
||||
return $this->type;
|
||||
}
|
||||
function isNotNull()
|
||||
{
|
||||
return $this->nullable == "NO" ? "true" : "false";
|
||||
}
|
||||
function isUnique()
|
||||
{
|
||||
return $this->key == "PRI" || $this->key == "UNI" ? "true" : "false";
|
||||
}
|
||||
function getDotNetPrimitiveType()
|
||||
{
|
||||
if (strpos($this->type, "int") === 0) return "int";
|
||||
if (strpos($this->type, "long") === 0) return "long";
|
||||
if (strpos($this->type, "char") === 0) return "string";
|
||||
if (strpos($this->type, "varchar") === 0) return "string";
|
||||
if (strpos($this->type, "text") === 0) return "string";
|
||||
if (strpos($this->type, "longtext") === 0) return "string";
|
||||
if (strpos($this->type, "tinyint") === 0) return "bool";
|
||||
if (strpos($this->type, "datetime") === 0) return "DateTime";
|
||||
return "unknown";
|
||||
}
|
||||
function getDotNetObjectType()
|
||||
{
|
||||
if (strpos($this->type, "int") === 0) return "Int32";
|
||||
if (strpos($this->type, "long") === 0) return "Long";
|
||||
if (strpos($this->type, "char") === 0) return "String";
|
||||
if (strpos($this->type, "varchar") === 0) return "String";
|
||||
if (strpos($this->type, "text") === 0) return "String";
|
||||
if (strpos($this->type, "longtext") === 0) return "String";
|
||||
if (strpos($this->type, "tinyint") === 0) return "Boolean";
|
||||
if (strpos($this->type, "datetime") === 0) return "DateTime";
|
||||
return "Unknown";
|
||||
}
|
||||
function getIndexName()
|
||||
{
|
||||
if (strlen($this->key)>0)
|
||||
return "index=\"" . htmlspecialchars($this->name, ENT_COMPAT, 'UTF-8') . "\"";
|
||||
return "";
|
||||
}
|
||||
function isPK()
|
||||
{
|
||||
return $this->key=="PRI";
|
||||
}
|
||||
function formatCs($text)
|
||||
{
|
||||
$text=str_replace("#name#", cgMakeIdentifier($this->name, false), $text);
|
||||
return $this->format($text);
|
||||
}
|
||||
function formatXml($text)
|
||||
{
|
||||
$text=str_replace("#name#", htmlspecialchars($this->name, ENT_COMPAT, 'UTF-8'), $text);
|
||||
$text=str_replace("#indexName#", $this->getIndexName(), $text);
|
||||
return $this->format($text);
|
||||
}
|
||||
function format($text)
|
||||
{
|
||||
$text=str_replace("#ucfirstName#", cgMakeIdentifier($this->name), $text);
|
||||
$text=str_replace("#dotNetPrimitiveType#", $this->getDotNetPrimitiveType(), $text);
|
||||
$text=str_replace("#dotNetObjectType#", $this->getDotNetObjectType(), $text);
|
||||
$text=str_replace("#type#", $this->getPureType(), $text);
|
||||
$text=str_replace("#notNull#", $this->isNotNull(), $text);
|
||||
$text=str_replace("#unique#", $this->isUnique(), $text);
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
function getPureType()
|
||||
{
|
||||
$pos=strpos($this->type, "(");
|
||||
if ($pos > 0)
|
||||
return substr($this->type, 0, $pos);
|
||||
return $this->type;
|
||||
}
|
||||
function isNotNull()
|
||||
{
|
||||
return $this->nullable == "NO" ? "true" : "false";
|
||||
}
|
||||
function isUnique()
|
||||
{
|
||||
return $this->key == "PRI" || $this->key == "UNI" ? "true" : "false";
|
||||
}
|
||||
function getDotNetPrimitiveType()
|
||||
{
|
||||
if (strpos($this->type, "int") === 0) return "int";
|
||||
if (strpos($this->type, "long") === 0) return "long";
|
||||
if (strpos($this->type, "char") === 0) return "string";
|
||||
if (strpos($this->type, "varchar") === 0) return "string";
|
||||
if (strpos($this->type, "text") === 0) return "string";
|
||||
if (strpos($this->type, "longtext") === 0) return "string";
|
||||
if (strpos($this->type, "tinyint") === 0) return "bool";
|
||||
if (strpos($this->type, "datetime") === 0) return "DateTime";
|
||||
return "unknown";
|
||||
}
|
||||
function getDotNetObjectType()
|
||||
{
|
||||
if (strpos($this->type, "int") === 0) return "Int32";
|
||||
if (strpos($this->type, "long") === 0) return "Long";
|
||||
if (strpos($this->type, "char") === 0) return "String";
|
||||
if (strpos($this->type, "varchar") === 0) return "String";
|
||||
if (strpos($this->type, "text") === 0) return "String";
|
||||
if (strpos($this->type, "longtext") === 0) return "String";
|
||||
if (strpos($this->type, "tinyint") === 0) return "Boolean";
|
||||
if (strpos($this->type, "datetime") === 0) return "DateTime";
|
||||
return "Unknown";
|
||||
}
|
||||
function getIndexName()
|
||||
{
|
||||
if (strlen($this->key)>0)
|
||||
return "index=\"" . htmlspecialchars($this->name, ENT_COMPAT, 'UTF-8') . "\"";
|
||||
return "";
|
||||
}
|
||||
function isPK()
|
||||
{
|
||||
return $this->key=="PRI";
|
||||
}
|
||||
function formatCs($text)
|
||||
{
|
||||
$text=str_replace("#name#", cgMakeIdentifier($this->name, false), $text);
|
||||
return $this->format($text);
|
||||
}
|
||||
function formatXml($text)
|
||||
{
|
||||
$text=str_replace("#name#", htmlspecialchars($this->name, ENT_COMPAT, 'UTF-8'), $text);
|
||||
$text=str_replace("#indexName#", $this->getIndexName(), $text);
|
||||
return $this->format($text);
|
||||
}
|
||||
function format($text)
|
||||
{
|
||||
$text=str_replace("#ucfirstName#", cgMakeIdentifier($this->name), $text);
|
||||
$text=str_replace("#dotNetPrimitiveType#", $this->getDotNetPrimitiveType(), $text);
|
||||
$text=str_replace("#dotNetObjectType#", $this->getDotNetObjectType(), $text);
|
||||
$text=str_replace("#type#", $this->getPureType(), $text);
|
||||
$text=str_replace("#notNull#", $this->isNotNull(), $text);
|
||||
$text=str_replace("#unique#", $this->isUnique(), $text);
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
|
||||
function cgMakeIdentifier($str, $ucfirst = true)
|
||||
{
|
||||
|
||||
@ -35,189 +35,189 @@ if (isset($plugin_list)) {
|
||||
);
|
||||
} else {
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export header
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader() {
|
||||
global $what;
|
||||
global $csv_terminated;
|
||||
global $csv_separator;
|
||||
global $csv_enclosed;
|
||||
global $csv_escaped;
|
||||
|
||||
// Here we just prepare some values for export
|
||||
if ($what == 'excel') {
|
||||
$csv_terminated = "\015\012";
|
||||
switch($GLOBALS['excel_edition']) {
|
||||
case 'win':
|
||||
// as tested on Windows with Excel 2002 and Excel 2007
|
||||
$csv_separator = ';';
|
||||
break;
|
||||
case 'mac_excel2003':
|
||||
$csv_separator = ';';
|
||||
break;
|
||||
case 'mac_excel2008':
|
||||
$csv_separator = ',';
|
||||
break;
|
||||
}
|
||||
$csv_enclosed = '"';
|
||||
$csv_escaped = '"';
|
||||
if (isset($GLOBALS['excel_columns'])) {
|
||||
$GLOBALS['csv_columns'] = 'yes';
|
||||
}
|
||||
} else {
|
||||
if (empty($csv_terminated) || strtolower($csv_terminated) == 'auto') {
|
||||
$csv_terminated = $GLOBALS['crlf'];
|
||||
} else {
|
||||
$csv_terminated = str_replace('\\r', "\015", $csv_terminated);
|
||||
$csv_terminated = str_replace('\\n', "\012", $csv_terminated);
|
||||
$csv_terminated = str_replace('\\t', "\011", $csv_terminated);
|
||||
} // end if
|
||||
$csv_separator = str_replace('\\t', "\011", $csv_separator);
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter() {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db) {
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Outputs export header
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader() {
|
||||
global $what;
|
||||
global $csv_terminated;
|
||||
global $csv_separator;
|
||||
global $csv_enclosed;
|
||||
global $csv_escaped;
|
||||
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in CSV format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
global $what;
|
||||
global $csv_terminated;
|
||||
global $csv_separator;
|
||||
global $csv_enclosed;
|
||||
global $csv_escaped;
|
||||
|
||||
// Gets the data from the database
|
||||
$result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
|
||||
$fields_cnt = PMA_DBI_num_fields($result);
|
||||
|
||||
// If required, get fields name at the first line
|
||||
if (isset($GLOBALS['csv_columns'])) {
|
||||
$schema_insert = '';
|
||||
for ($i = 0; $i < $fields_cnt; $i++) {
|
||||
if ($csv_enclosed == '') {
|
||||
$schema_insert .= stripslashes(PMA_DBI_field_name($result, $i));
|
||||
} else {
|
||||
$schema_insert .= $csv_enclosed
|
||||
. str_replace($csv_enclosed, $csv_escaped . $csv_enclosed, stripslashes(PMA_DBI_field_name($result, $i)))
|
||||
. $csv_enclosed;
|
||||
// Here we just prepare some values for export
|
||||
if ($what == 'excel') {
|
||||
$csv_terminated = "\015\012";
|
||||
switch($GLOBALS['excel_edition']) {
|
||||
case 'win':
|
||||
// as tested on Windows with Excel 2002 and Excel 2007
|
||||
$csv_separator = ';';
|
||||
break;
|
||||
case 'mac_excel2003':
|
||||
$csv_separator = ';';
|
||||
break;
|
||||
case 'mac_excel2008':
|
||||
$csv_separator = ',';
|
||||
break;
|
||||
}
|
||||
$schema_insert .= $csv_separator;
|
||||
} // end for
|
||||
$schema_insert =trim(substr($schema_insert, 0, -1));
|
||||
if (!PMA_exportOutputHandler($schema_insert . $csv_terminated)) {
|
||||
return false;
|
||||
$csv_enclosed = '"';
|
||||
$csv_escaped = '"';
|
||||
if (isset($GLOBALS['excel_columns'])) {
|
||||
$GLOBALS['csv_columns'] = 'yes';
|
||||
}
|
||||
} else {
|
||||
if (empty($csv_terminated) || strtolower($csv_terminated) == 'auto') {
|
||||
$csv_terminated = $GLOBALS['crlf'];
|
||||
} else {
|
||||
$csv_terminated = str_replace('\\r', "\015", $csv_terminated);
|
||||
$csv_terminated = str_replace('\\n', "\012", $csv_terminated);
|
||||
$csv_terminated = str_replace('\\t', "\011", $csv_terminated);
|
||||
} // end if
|
||||
$csv_separator = str_replace('\\t', "\011", $csv_separator);
|
||||
}
|
||||
} // end if
|
||||
return true;
|
||||
}
|
||||
|
||||
// Format the data
|
||||
while ($row = PMA_DBI_fetch_row($result)) {
|
||||
$schema_insert = '';
|
||||
for ($j = 0; $j < $fields_cnt; $j++) {
|
||||
if (!isset($row[$j]) || is_null($row[$j])) {
|
||||
$schema_insert .= $GLOBALS[$what . '_null'];
|
||||
} elseif ($row[$j] == '0' || $row[$j] != '') {
|
||||
// always enclose fields
|
||||
if ($what == 'excel') {
|
||||
$row[$j] = preg_replace("/\015(\012)?/", "\012", $row[$j]);
|
||||
}
|
||||
// remove CRLF characters within field
|
||||
if (isset($GLOBALS[$what . '_removeCRLF']) && $GLOBALS[$what . '_removeCRLF']) {
|
||||
$row[$j] = str_replace("\n", "", str_replace("\r", "", $row[$j]));
|
||||
}
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in CSV format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
global $what;
|
||||
global $csv_terminated;
|
||||
global $csv_separator;
|
||||
global $csv_enclosed;
|
||||
global $csv_escaped;
|
||||
|
||||
// Gets the data from the database
|
||||
$result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
|
||||
$fields_cnt = PMA_DBI_num_fields($result);
|
||||
|
||||
// If required, get fields name at the first line
|
||||
if (isset($GLOBALS['csv_columns'])) {
|
||||
$schema_insert = '';
|
||||
for ($i = 0; $i < $fields_cnt; $i++) {
|
||||
if ($csv_enclosed == '') {
|
||||
$schema_insert .= $row[$j];
|
||||
$schema_insert .= stripslashes(PMA_DBI_field_name($result, $i));
|
||||
} else {
|
||||
// also double the escape string if found in the data
|
||||
if ('csv' == $what) {
|
||||
$schema_insert .= $csv_enclosed
|
||||
. str_replace($csv_enclosed, $csv_escaped . $csv_enclosed, str_replace($csv_escaped, $csv_escaped . $csv_escaped, $row[$j]))
|
||||
$schema_insert .= $csv_enclosed
|
||||
. str_replace($csv_enclosed, $csv_escaped . $csv_enclosed, stripslashes(PMA_DBI_field_name($result, $i)))
|
||||
. $csv_enclosed;
|
||||
} else {
|
||||
// for excel, avoid a problem when a field contains
|
||||
// double quotes
|
||||
$schema_insert .= $csv_enclosed
|
||||
. str_replace($csv_enclosed, $csv_escaped . $csv_enclosed, $row[$j])
|
||||
. $csv_enclosed;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$schema_insert .= '';
|
||||
$schema_insert .= $csv_separator;
|
||||
} // end for
|
||||
$schema_insert =trim(substr($schema_insert, 0, -1));
|
||||
if (!PMA_exportOutputHandler($schema_insert . $csv_terminated)) {
|
||||
return false;
|
||||
}
|
||||
if ($j < $fields_cnt-1) {
|
||||
$schema_insert .= $csv_separator;
|
||||
} // end if
|
||||
|
||||
// Format the data
|
||||
while ($row = PMA_DBI_fetch_row($result)) {
|
||||
$schema_insert = '';
|
||||
for ($j = 0; $j < $fields_cnt; $j++) {
|
||||
if (!isset($row[$j]) || is_null($row[$j])) {
|
||||
$schema_insert .= $GLOBALS[$what . '_null'];
|
||||
} elseif ($row[$j] == '0' || $row[$j] != '') {
|
||||
// always enclose fields
|
||||
if ($what == 'excel') {
|
||||
$row[$j] = preg_replace("/\015(\012)?/", "\012", $row[$j]);
|
||||
}
|
||||
// remove CRLF characters within field
|
||||
if (isset($GLOBALS[$what . '_removeCRLF']) && $GLOBALS[$what . '_removeCRLF']) {
|
||||
$row[$j] = str_replace("\n", "", str_replace("\r", "", $row[$j]));
|
||||
}
|
||||
if ($csv_enclosed == '') {
|
||||
$schema_insert .= $row[$j];
|
||||
} else {
|
||||
// also double the escape string if found in the data
|
||||
if ('csv' == $what) {
|
||||
$schema_insert .= $csv_enclosed
|
||||
. str_replace($csv_enclosed, $csv_escaped . $csv_enclosed, str_replace($csv_escaped, $csv_escaped . $csv_escaped, $row[$j]))
|
||||
. $csv_enclosed;
|
||||
} else {
|
||||
// for excel, avoid a problem when a field contains
|
||||
// double quotes
|
||||
$schema_insert .= $csv_enclosed
|
||||
. str_replace($csv_enclosed, $csv_escaped . $csv_enclosed, $row[$j])
|
||||
. $csv_enclosed;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$schema_insert .= '';
|
||||
}
|
||||
if ($j < $fields_cnt-1) {
|
||||
$schema_insert .= $csv_separator;
|
||||
}
|
||||
} // end for
|
||||
|
||||
if (!PMA_exportOutputHandler($schema_insert . $csv_terminated)) {
|
||||
return false;
|
||||
}
|
||||
} // end for
|
||||
} // end while
|
||||
PMA_DBI_free_result($result);
|
||||
|
||||
if (!PMA_exportOutputHandler($schema_insert . $csv_terminated)) {
|
||||
return false;
|
||||
}
|
||||
} // end while
|
||||
PMA_DBI_free_result($result);
|
||||
|
||||
return true;
|
||||
} // end of the 'PMA_getTableCsv()' function
|
||||
return true;
|
||||
} // end of the 'PMA_getTableCsv()' function
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@ -34,321 +34,321 @@ if (isset($plugin_list)) {
|
||||
);
|
||||
} else {
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter() {
|
||||
return PMA_exportOutputHandler('</body></html>');
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export header
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader() {
|
||||
global $charset_of_file;
|
||||
return PMA_exportOutputHandler('<html xmlns:o="urn:schemas-microsoft-com:office:office"
|
||||
xmlns:x="urn:schemas-microsoft-com:office:word"
|
||||
xmlns="http://www.w3.org/TR/REC-html40">
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=' . (isset($charset_of_file) ? $charset_of_file : 'utf-8') . '" />
|
||||
</head>
|
||||
<body>');
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db) {
|
||||
return PMA_exportOutputHandler('<h1>' . __('Database') . ' ' . htmlspecialchars($db) . '</h1>');
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in HTML (Microsoft Word) format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
{
|
||||
global $what;
|
||||
|
||||
if (! PMA_exportOutputHandler('<h2>' . __('Dumping data for table') . ' ' . htmlspecialchars($table) . '</h2>')) {
|
||||
return false;
|
||||
}
|
||||
if (! PMA_exportOutputHandler('<table class="width100" cellspacing="1">')) {
|
||||
return false;
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter() {
|
||||
return PMA_exportOutputHandler('</body></html>');
|
||||
}
|
||||
|
||||
// Gets the data from the database
|
||||
$result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
|
||||
$fields_cnt = PMA_DBI_num_fields($result);
|
||||
/**
|
||||
* Outputs export header
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader() {
|
||||
global $charset_of_file;
|
||||
return PMA_exportOutputHandler('<html xmlns:o="urn:schemas-microsoft-com:office:office"
|
||||
xmlns:x="urn:schemas-microsoft-com:office:word"
|
||||
xmlns="http://www.w3.org/TR/REC-html40">
|
||||
|
||||
// If required, get fields name at the first line
|
||||
if (isset($GLOBALS['htmlword_columns'])) {
|
||||
$schema_insert = '<tr class="print-category">';
|
||||
for ($i = 0; $i < $fields_cnt; $i++) {
|
||||
$schema_insert .= '<td class="print"><b>' . htmlspecialchars(stripslashes(PMA_DBI_field_name($result, $i))) . '</b></td>';
|
||||
} // end for
|
||||
$schema_insert .= '</tr>';
|
||||
if (! PMA_exportOutputHandler($schema_insert)) {
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=' . (isset($charset_of_file) ? $charset_of_file : 'utf-8') . '" />
|
||||
</head>
|
||||
<body>');
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db) {
|
||||
return PMA_exportOutputHandler('<h1>' . __('Database') . ' ' . htmlspecialchars($db) . '</h1>');
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in HTML (Microsoft Word) format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
{
|
||||
global $what;
|
||||
|
||||
if (! PMA_exportOutputHandler('<h2>' . __('Dumping data for table') . ' ' . htmlspecialchars($table) . '</h2>')) {
|
||||
return false;
|
||||
}
|
||||
if (! PMA_exportOutputHandler('<table class="width100" cellspacing="1">')) {
|
||||
return false;
|
||||
}
|
||||
} // end if
|
||||
|
||||
// Format the data
|
||||
while ($row = PMA_DBI_fetch_row($result)) {
|
||||
$schema_insert = '<tr class="print-category">';
|
||||
for ($j = 0; $j < $fields_cnt; $j++) {
|
||||
if (! isset($row[$j]) || is_null($row[$j])) {
|
||||
$value = $GLOBALS[$what . '_null'];
|
||||
} elseif ($row[$j] == '0' || $row[$j] != '') {
|
||||
$value = $row[$j];
|
||||
// Gets the data from the database
|
||||
$result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
|
||||
$fields_cnt = PMA_DBI_num_fields($result);
|
||||
|
||||
// If required, get fields name at the first line
|
||||
if (isset($GLOBALS['htmlword_columns'])) {
|
||||
$schema_insert = '<tr class="print-category">';
|
||||
for ($i = 0; $i < $fields_cnt; $i++) {
|
||||
$schema_insert .= '<td class="print"><b>' . htmlspecialchars(stripslashes(PMA_DBI_field_name($result, $i))) . '</b></td>';
|
||||
} // end for
|
||||
$schema_insert .= '</tr>';
|
||||
if (! PMA_exportOutputHandler($schema_insert)) {
|
||||
return false;
|
||||
}
|
||||
} // end if
|
||||
|
||||
// Format the data
|
||||
while ($row = PMA_DBI_fetch_row($result)) {
|
||||
$schema_insert = '<tr class="print-category">';
|
||||
for ($j = 0; $j < $fields_cnt; $j++) {
|
||||
if (! isset($row[$j]) || is_null($row[$j])) {
|
||||
$value = $GLOBALS[$what . '_null'];
|
||||
} elseif ($row[$j] == '0' || $row[$j] != '') {
|
||||
$value = $row[$j];
|
||||
} else {
|
||||
$value = '';
|
||||
}
|
||||
$schema_insert .= '<td class="print">' . htmlspecialchars($value) . '</td>';
|
||||
} // end for
|
||||
$schema_insert .= '</tr>';
|
||||
if (! PMA_exportOutputHandler($schema_insert)) {
|
||||
return false;
|
||||
}
|
||||
} // end while
|
||||
PMA_DBI_free_result($result);
|
||||
if (! PMA_exportOutputHandler('</table>')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs table's structure
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param bool $do_relation whether to include relation comments
|
||||
* @param bool $do_comments whether to include the pmadb-style column comments
|
||||
* as comments in the structure; this is deprecated
|
||||
* but the parameter is left here because export.php
|
||||
* calls PMA_exportStructure() also for other export
|
||||
* types which use this parameter
|
||||
* @param bool $do_mime whether to include mime comments
|
||||
* @param bool $dates whether to include creation/update/check dates
|
||||
* @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
|
||||
* @param string $export_type 'server', 'database', 'table'
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $export_mode, $export_type)
|
||||
{
|
||||
global $cfgRelation;
|
||||
|
||||
if (! PMA_exportOutputHandler('<h2>' . __('Table structure for table') . ' ' . htmlspecialchars($table) . '</h2>')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the unique keys in the table
|
||||
*/
|
||||
$keys_query = PMA_DBI_get_table_indexes_sql($db, $table);
|
||||
$keys_result = PMA_DBI_query($keys_query);
|
||||
$unique_keys = array();
|
||||
while ($key = PMA_DBI_fetch_assoc($keys_result)) {
|
||||
if ($key['Non_unique'] == 0) {
|
||||
$unique_keys[] = $key['Column_name'];
|
||||
}
|
||||
}
|
||||
PMA_DBI_free_result($keys_result);
|
||||
|
||||
/**
|
||||
* Gets fields properties
|
||||
*/
|
||||
PMA_DBI_select_db($db);
|
||||
|
||||
// Check if we can use Relations
|
||||
if ($do_relation && ! empty($cfgRelation['relation'])) {
|
||||
// Find which tables are related with the current one and write it in
|
||||
// an array
|
||||
$res_rel = PMA_getForeigners($db, $table);
|
||||
|
||||
if ($res_rel && count($res_rel) > 0) {
|
||||
$have_rel = true;
|
||||
} else {
|
||||
$value = '';
|
||||
$have_rel = false;
|
||||
}
|
||||
$schema_insert .= '<td class="print">' . htmlspecialchars($value) . '</td>';
|
||||
} // end for
|
||||
$schema_insert .= '</tr>';
|
||||
if (! PMA_exportOutputHandler($schema_insert)) {
|
||||
} else {
|
||||
$have_rel = false;
|
||||
} // end if
|
||||
|
||||
/**
|
||||
* Displays the table structure
|
||||
*/
|
||||
if (! PMA_exportOutputHandler('<table class="width100" cellspacing="1">')) {
|
||||
return false;
|
||||
}
|
||||
} // end while
|
||||
PMA_DBI_free_result($result);
|
||||
if (! PMA_exportOutputHandler('</table>')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs table's structure
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param bool $do_relation whether to include relation comments
|
||||
* @param bool $do_comments whether to include the pmadb-style column comments
|
||||
* as comments in the structure; this is deprecated
|
||||
* but the parameter is left here because export.php
|
||||
* calls PMA_exportStructure() also for other export
|
||||
* types which use this parameter
|
||||
* @param bool $do_mime whether to include mime comments
|
||||
* @param bool $dates whether to include creation/update/check dates
|
||||
* @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
|
||||
* @param string $export_type 'server', 'database', 'table'
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $export_mode, $export_type)
|
||||
{
|
||||
global $cfgRelation;
|
||||
|
||||
if (! PMA_exportOutputHandler('<h2>' . __('Table structure for table') . ' ' . htmlspecialchars($table) . '</h2>')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the unique keys in the table
|
||||
*/
|
||||
$keys_query = PMA_DBI_get_table_indexes_sql($db, $table);
|
||||
$keys_result = PMA_DBI_query($keys_query);
|
||||
$unique_keys = array();
|
||||
while ($key = PMA_DBI_fetch_assoc($keys_result)) {
|
||||
if ($key['Non_unique'] == 0) {
|
||||
$unique_keys[] = $key['Column_name'];
|
||||
}
|
||||
}
|
||||
PMA_DBI_free_result($keys_result);
|
||||
|
||||
/**
|
||||
* Gets fields properties
|
||||
*/
|
||||
PMA_DBI_select_db($db);
|
||||
|
||||
// Check if we can use Relations
|
||||
if ($do_relation && ! empty($cfgRelation['relation'])) {
|
||||
// Find which tables are related with the current one and write it in
|
||||
// an array
|
||||
$res_rel = PMA_getForeigners($db, $table);
|
||||
|
||||
if ($res_rel && count($res_rel) > 0) {
|
||||
$have_rel = true;
|
||||
} else {
|
||||
$have_rel = false;
|
||||
}
|
||||
} else {
|
||||
$have_rel = false;
|
||||
} // end if
|
||||
|
||||
/**
|
||||
* Displays the table structure
|
||||
*/
|
||||
if (! PMA_exportOutputHandler('<table class="width100" cellspacing="1">')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$columns_cnt = 4;
|
||||
if ($do_relation && $have_rel) {
|
||||
$columns_cnt++;
|
||||
}
|
||||
if ($do_comments && $cfgRelation['commwork']) {
|
||||
$columns_cnt++;
|
||||
}
|
||||
if ($do_mime && $cfgRelation['mimework']) {
|
||||
$columns_cnt++;
|
||||
}
|
||||
|
||||
$schema_insert = '<tr class="print-category">';
|
||||
$schema_insert .= '<th class="print">' . htmlspecialchars(__('Column')) . '</th>';
|
||||
$schema_insert .= '<td class="print"><b>' . htmlspecialchars(__('Type')) . '</b></td>';
|
||||
$schema_insert .= '<td class="print"><b>' . htmlspecialchars(__('Null')) . '</b></td>';
|
||||
$schema_insert .= '<td class="print"><b>' . htmlspecialchars(__('Default')) . '</b></td>';
|
||||
if ($do_relation && $have_rel) {
|
||||
$schema_insert .= '<td class="print"><b>' . htmlspecialchars(__('Links to')) . '</b></td>';
|
||||
}
|
||||
if ($do_comments) {
|
||||
$schema_insert .= '<td class="print"><b>' . htmlspecialchars(__('Comments')) . '</b></td>';
|
||||
$comments = PMA_getComments($db, $table);
|
||||
}
|
||||
if ($do_mime && $cfgRelation['mimework']) {
|
||||
$schema_insert .= '<td class="print"><b>' . htmlspecialchars('MIME') . '</b></td>';
|
||||
$mime_map = PMA_getMIME($db, $table, true);
|
||||
}
|
||||
$schema_insert .= '</tr>';
|
||||
|
||||
if (! PMA_exportOutputHandler($schema_insert)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$columns = PMA_DBI_get_columns($db, $table);
|
||||
foreach ($columns as $column) {
|
||||
|
||||
$schema_insert = '<tr class="print-category">';
|
||||
$type = $column['Type'];
|
||||
// reformat mysql query output
|
||||
// set or enum types: slashes single quotes inside options
|
||||
if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) {
|
||||
$tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1);
|
||||
$type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
|
||||
$type_nowrap = '';
|
||||
|
||||
$binary = 0;
|
||||
$unsigned = 0;
|
||||
$zerofill = 0;
|
||||
} else {
|
||||
$type_nowrap = ' nowrap="nowrap"';
|
||||
$type = preg_replace('/BINARY/i', '', $type);
|
||||
$type = preg_replace('/ZEROFILL/i', '', $type);
|
||||
$type = preg_replace('/UNSIGNED/i', '', $type);
|
||||
if (empty($type)) {
|
||||
$type = ' ';
|
||||
}
|
||||
|
||||
$binary = preg_match('/BINARY/i', $column['Type']);
|
||||
$unsigned = preg_match('/UNSIGNED/i', $column['Type']);
|
||||
$zerofill = preg_match('/ZEROFILL/i', $column['Type']);
|
||||
}
|
||||
$attribute = ' ';
|
||||
if ($binary) {
|
||||
$attribute = 'BINARY';
|
||||
}
|
||||
if ($unsigned) {
|
||||
$attribute = 'UNSIGNED';
|
||||
}
|
||||
if ($zerofill) {
|
||||
$attribute = 'UNSIGNED ZEROFILL';
|
||||
}
|
||||
if (! isset($column['Default'])) {
|
||||
if ($column['Null'] != 'NO') {
|
||||
$column['Default'] = 'NULL';
|
||||
}
|
||||
}
|
||||
|
||||
$fmt_pre = '';
|
||||
$fmt_post = '';
|
||||
if (in_array($column['Field'], $unique_keys)) {
|
||||
$fmt_pre = '<b>' . $fmt_pre;
|
||||
$fmt_post = $fmt_post . '</b>';
|
||||
}
|
||||
if ($column['Key'] == 'PRI') {
|
||||
$fmt_pre = '<i>' . $fmt_pre;
|
||||
$fmt_post = $fmt_post . '</i>';
|
||||
}
|
||||
$schema_insert .= '<td class="print">' . $fmt_pre . htmlspecialchars($column['Field']) . $fmt_post . '</td>';
|
||||
$schema_insert .= '<td class="print">' . htmlspecialchars($type) . '</td>';
|
||||
$schema_insert .= '<td class="print">' . htmlspecialchars(($column['Null'] == '' || $column['Null'] == 'NO') ? __('No') : __('Yes')) . '</td>';
|
||||
$schema_insert .= '<td class="print">' . htmlspecialchars(isset($column['Default']) ? $column['Default'] : '') . '</td>';
|
||||
|
||||
$field_name = $column['Field'];
|
||||
|
||||
$columns_cnt = 4;
|
||||
if ($do_relation && $have_rel) {
|
||||
$schema_insert .= '<td class="print">' . (isset($res_rel[$field_name]) ? htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')') : '') . '</td>';
|
||||
$columns_cnt++;
|
||||
}
|
||||
if ($do_comments && $cfgRelation['commwork']) {
|
||||
$schema_insert .= '<td class="print">' . (isset($comments[$field_name]) ? htmlspecialchars($comments[$field_name]) : '') . '</td>';
|
||||
$columns_cnt++;
|
||||
}
|
||||
if ($do_mime && $cfgRelation['mimework']) {
|
||||
$schema_insert .= '<td class="print">' . (isset($mime_map[$field_name]) ? htmlspecialchars(str_replace('_', '/', $mime_map[$field_name]['mimetype'])) : '') . '</td>';
|
||||
$columns_cnt++;
|
||||
}
|
||||
|
||||
$schema_insert = '<tr class="print-category">';
|
||||
$schema_insert .= '<th class="print">' . htmlspecialchars(__('Column')) . '</th>';
|
||||
$schema_insert .= '<td class="print"><b>' . htmlspecialchars(__('Type')) . '</b></td>';
|
||||
$schema_insert .= '<td class="print"><b>' . htmlspecialchars(__('Null')) . '</b></td>';
|
||||
$schema_insert .= '<td class="print"><b>' . htmlspecialchars(__('Default')) . '</b></td>';
|
||||
if ($do_relation && $have_rel) {
|
||||
$schema_insert .= '<td class="print"><b>' . htmlspecialchars(__('Links to')) . '</b></td>';
|
||||
}
|
||||
if ($do_comments) {
|
||||
$schema_insert .= '<td class="print"><b>' . htmlspecialchars(__('Comments')) . '</b></td>';
|
||||
$comments = PMA_getComments($db, $table);
|
||||
}
|
||||
if ($do_mime && $cfgRelation['mimework']) {
|
||||
$schema_insert .= '<td class="print"><b>' . htmlspecialchars('MIME') . '</b></td>';
|
||||
$mime_map = PMA_getMIME($db, $table, true);
|
||||
}
|
||||
$schema_insert .= '</tr>';
|
||||
|
||||
if (! PMA_exportOutputHandler($schema_insert)) {
|
||||
return false;
|
||||
}
|
||||
} // end while
|
||||
|
||||
return PMA_exportOutputHandler('</table>');
|
||||
}
|
||||
$columns = PMA_DBI_get_columns($db, $table);
|
||||
foreach ($columns as $column) {
|
||||
|
||||
$schema_insert = '<tr class="print-category">';
|
||||
$type = $column['Type'];
|
||||
// reformat mysql query output
|
||||
// set or enum types: slashes single quotes inside options
|
||||
if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) {
|
||||
$tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1);
|
||||
$type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
|
||||
$type_nowrap = '';
|
||||
|
||||
$binary = 0;
|
||||
$unsigned = 0;
|
||||
$zerofill = 0;
|
||||
} else {
|
||||
$type_nowrap = ' nowrap="nowrap"';
|
||||
$type = preg_replace('/BINARY/i', '', $type);
|
||||
$type = preg_replace('/ZEROFILL/i', '', $type);
|
||||
$type = preg_replace('/UNSIGNED/i', '', $type);
|
||||
if (empty($type)) {
|
||||
$type = ' ';
|
||||
}
|
||||
|
||||
$binary = preg_match('/BINARY/i', $column['Type']);
|
||||
$unsigned = preg_match('/UNSIGNED/i', $column['Type']);
|
||||
$zerofill = preg_match('/ZEROFILL/i', $column['Type']);
|
||||
}
|
||||
$attribute = ' ';
|
||||
if ($binary) {
|
||||
$attribute = 'BINARY';
|
||||
}
|
||||
if ($unsigned) {
|
||||
$attribute = 'UNSIGNED';
|
||||
}
|
||||
if ($zerofill) {
|
||||
$attribute = 'UNSIGNED ZEROFILL';
|
||||
}
|
||||
if (! isset($column['Default'])) {
|
||||
if ($column['Null'] != 'NO') {
|
||||
$column['Default'] = 'NULL';
|
||||
}
|
||||
}
|
||||
|
||||
$fmt_pre = '';
|
||||
$fmt_post = '';
|
||||
if (in_array($column['Field'], $unique_keys)) {
|
||||
$fmt_pre = '<b>' . $fmt_pre;
|
||||
$fmt_post = $fmt_post . '</b>';
|
||||
}
|
||||
if ($column['Key'] == 'PRI') {
|
||||
$fmt_pre = '<i>' . $fmt_pre;
|
||||
$fmt_post = $fmt_post . '</i>';
|
||||
}
|
||||
$schema_insert .= '<td class="print">' . $fmt_pre . htmlspecialchars($column['Field']) . $fmt_post . '</td>';
|
||||
$schema_insert .= '<td class="print">' . htmlspecialchars($type) . '</td>';
|
||||
$schema_insert .= '<td class="print">' . htmlspecialchars(($column['Null'] == '' || $column['Null'] == 'NO') ? __('No') : __('Yes')) . '</td>';
|
||||
$schema_insert .= '<td class="print">' . htmlspecialchars(isset($column['Default']) ? $column['Default'] : '') . '</td>';
|
||||
|
||||
$field_name = $column['Field'];
|
||||
|
||||
if ($do_relation && $have_rel) {
|
||||
$schema_insert .= '<td class="print">' . (isset($res_rel[$field_name]) ? htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')') : '') . '</td>';
|
||||
}
|
||||
if ($do_comments && $cfgRelation['commwork']) {
|
||||
$schema_insert .= '<td class="print">' . (isset($comments[$field_name]) ? htmlspecialchars($comments[$field_name]) : '') . '</td>';
|
||||
}
|
||||
if ($do_mime && $cfgRelation['mimework']) {
|
||||
$schema_insert .= '<td class="print">' . (isset($mime_map[$field_name]) ? htmlspecialchars(str_replace('_', '/', $mime_map[$field_name]['mimetype'])) : '') . '</td>';
|
||||
}
|
||||
|
||||
$schema_insert .= '</tr>';
|
||||
|
||||
if (! PMA_exportOutputHandler($schema_insert)) {
|
||||
return false;
|
||||
}
|
||||
} // end while
|
||||
|
||||
return PMA_exportOutputHandler('</table>');
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@ -30,144 +30,144 @@ if (isset($plugin_list)) {
|
||||
);
|
||||
} else {
|
||||
|
||||
/**
|
||||
* Set of functions used to build exports of tables
|
||||
*/
|
||||
/**
|
||||
* Set of functions used to build exports of tables
|
||||
*/
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export header
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader()
|
||||
{
|
||||
PMA_exportOutputHandler(
|
||||
'/**' . $GLOBALS['crlf']
|
||||
. ' Export to JSON plugin for PHPMyAdmin' . $GLOBALS['crlf']
|
||||
. ' @version 0.1' . $GLOBALS['crlf']
|
||||
. ' */' . $GLOBALS['crlf'] . $GLOBALS['crlf']
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db)
|
||||
{
|
||||
PMA_exportOutputHandler('// Database \'' . $db . '\'' . $GLOBALS['crlf'] );
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in JSON format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
{
|
||||
$result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
|
||||
|
||||
$columns_cnt = PMA_DBI_num_fields($result);
|
||||
for ($i = 0; $i < $columns_cnt; $i++) {
|
||||
$columns[$i] = stripslashes(PMA_DBI_field_name($result, $i));
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
unset($i);
|
||||
|
||||
$buffer = '';
|
||||
$record_cnt = 0;
|
||||
while ($record = PMA_DBI_fetch_row($result)) {
|
||||
/**
|
||||
* Outputs export header
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader()
|
||||
{
|
||||
PMA_exportOutputHandler(
|
||||
'/**' . $GLOBALS['crlf']
|
||||
. ' Export to JSON plugin for PHPMyAdmin' . $GLOBALS['crlf']
|
||||
. ' @version 0.1' . $GLOBALS['crlf']
|
||||
. ' */' . $GLOBALS['crlf'] . $GLOBALS['crlf']
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
$record_cnt++;
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db)
|
||||
{
|
||||
PMA_exportOutputHandler('// Database \'' . $db . '\'' . $GLOBALS['crlf'] );
|
||||
return true;
|
||||
}
|
||||
|
||||
// Output table name as comment if this is the first record of the table
|
||||
if ($record_cnt == 1) {
|
||||
$buffer .= '// ' . $db . '.' . $table . $crlf . $crlf;
|
||||
$buffer .= '[{';
|
||||
} else {
|
||||
$buffer .= ', {';
|
||||
}
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in JSON format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
{
|
||||
$result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
|
||||
|
||||
$columns_cnt = PMA_DBI_num_fields($result);
|
||||
for ($i = 0; $i < $columns_cnt; $i++) {
|
||||
$columns[$i] = stripslashes(PMA_DBI_field_name($result, $i));
|
||||
}
|
||||
unset($i);
|
||||
|
||||
$isLastLine = ($i + 1 >= $columns_cnt);
|
||||
$buffer = '';
|
||||
$record_cnt = 0;
|
||||
while ($record = PMA_DBI_fetch_row($result)) {
|
||||
|
||||
$column = $columns[$i];
|
||||
$record_cnt++;
|
||||
|
||||
if (is_null($record[$i])) {
|
||||
$buffer .= '"' . addslashes($column) . '": null' . (! $isLastLine ? ',' : '');
|
||||
} elseif (is_numeric($record[$i])) {
|
||||
$buffer .= '"' . addslashes($column) . '": ' . $record[$i] . (! $isLastLine ? ',' : '');
|
||||
// Output table name as comment if this is the first record of the table
|
||||
if ($record_cnt == 1) {
|
||||
$buffer .= '// ' . $db . '.' . $table . $crlf . $crlf;
|
||||
$buffer .= '[{';
|
||||
} else {
|
||||
$buffer .= '"' . addslashes($column) . '": "' . addslashes($record[$i]) . '"' . (! $isLastLine ? ',' : '');
|
||||
$buffer .= ', {';
|
||||
}
|
||||
|
||||
for ($i = 0; $i < $columns_cnt; $i++) {
|
||||
|
||||
$isLastLine = ($i + 1 >= $columns_cnt);
|
||||
|
||||
$column = $columns[$i];
|
||||
|
||||
if (is_null($record[$i])) {
|
||||
$buffer .= '"' . addslashes($column) . '": null' . (! $isLastLine ? ',' : '');
|
||||
} elseif (is_numeric($record[$i])) {
|
||||
$buffer .= '"' . addslashes($column) . '": ' . $record[$i] . (! $isLastLine ? ',' : '');
|
||||
} else {
|
||||
$buffer .= '"' . addslashes($column) . '": "' . addslashes($record[$i]) . '"' . (! $isLastLine ? ',' : '');
|
||||
}
|
||||
}
|
||||
|
||||
$buffer .= '}';
|
||||
}
|
||||
|
||||
$buffer .= '}';
|
||||
}
|
||||
if ($record_cnt) {
|
||||
$buffer .= ']';
|
||||
}
|
||||
if (! PMA_exportOutputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($record_cnt) {
|
||||
$buffer .= ']';
|
||||
}
|
||||
if (! PMA_exportOutputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
PMA_DBI_free_result($result);
|
||||
|
||||
PMA_DBI_free_result($result);
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -82,389 +82,389 @@ if (isset($plugin_list)) {
|
||||
array('type' => 'end_group');
|
||||
} else {
|
||||
|
||||
/**
|
||||
* Escapes some special characters for use in TeX/LaTeX
|
||||
*
|
||||
* @param string the string to convert
|
||||
*
|
||||
* @return string the converted string with escape codes
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function PMA_texEscape($string) {
|
||||
$escape = array('$', '%', '{', '}', '&', '#', '_', '^');
|
||||
$cnt_escape = count($escape);
|
||||
for ($k=0; $k < $cnt_escape; $k++) {
|
||||
$string = str_replace($escape[$k], '\\' . $escape[$k], $string);
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export header
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader() {
|
||||
global $crlf;
|
||||
global $cfg;
|
||||
|
||||
$head = '% phpMyAdmin LaTeX Dump' . $crlf
|
||||
. '% version ' . PMA_VERSION . $crlf
|
||||
. '% http://www.phpmyadmin.net' . $crlf
|
||||
. '%' . $crlf
|
||||
. '% ' . __('Host') . ': ' . $cfg['Server']['host'];
|
||||
if (!empty($cfg['Server']['port'])) {
|
||||
$head .= ':' . $cfg['Server']['port'];
|
||||
}
|
||||
$head .= $crlf
|
||||
. '% ' . __('Generation Time') . ': ' . PMA_localisedDate() . $crlf
|
||||
. '% ' . __('Server version') . ': ' . PMA_MYSQL_STR_VERSION . $crlf
|
||||
. '% ' . __('PHP Version') . ': ' . phpversion() . $crlf;
|
||||
return PMA_exportOutputHandler($head);
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db) {
|
||||
global $crlf;
|
||||
$head = '% ' . $crlf
|
||||
. '% ' . __('Database') . ': ' . (isset($GLOBALS['use_backquotes']) ? PMA_backquote($db) : '\'' . $db . '\''). $crlf
|
||||
. '% ' . $crlf;
|
||||
return PMA_exportOutputHandler($head);
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in LaTeX table/sideways table environment
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
$result = PMA_DBI_try_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
|
||||
|
||||
$columns_cnt = PMA_DBI_num_fields($result);
|
||||
for ($i = 0; $i < $columns_cnt; $i++) {
|
||||
$columns[$i] = PMA_DBI_field_name($result, $i);
|
||||
}
|
||||
unset($i);
|
||||
|
||||
$buffer = $crlf . '%' . $crlf . '% ' . __('Data') . ': ' . $table . $crlf . '%' . $crlf
|
||||
. ' \\begin{longtable}{|';
|
||||
|
||||
for ($index=0;$index<$columns_cnt;$index++) {
|
||||
$buffer .= 'l|';
|
||||
}
|
||||
$buffer .= '} ' . $crlf ;
|
||||
|
||||
$buffer .= ' \\hline \\endhead \\hline \\endfoot \\hline ' . $crlf;
|
||||
if (isset($GLOBALS['latex_caption'])) {
|
||||
$buffer .= ' \\caption{' . PMA_expandUserString($GLOBALS['latex_data_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db))
|
||||
. '} \\label{' . PMA_expandUserString($GLOBALS['latex_data_label'], NULL, array('table' => $table, 'database' => $db)) . '} \\\\';
|
||||
}
|
||||
if (!PMA_exportOutputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// show column names
|
||||
if (isset($GLOBALS['latex_columns'])) {
|
||||
$buffer = '\\hline ';
|
||||
for ($i = 0; $i < $columns_cnt; $i++) {
|
||||
$buffer .= '\\multicolumn{1}{|c|}{\\textbf{' . PMA_texEscape(stripslashes($columns[$i])) . '}} & ';
|
||||
}
|
||||
|
||||
$buffer = substr($buffer, 0, -2) . '\\\\ \\hline \hline ';
|
||||
if (!PMA_exportOutputHandler($buffer . ' \\endfirsthead ' . $crlf)) {
|
||||
return false;
|
||||
/**
|
||||
* Escapes some special characters for use in TeX/LaTeX
|
||||
*
|
||||
* @param string the string to convert
|
||||
*
|
||||
* @return string the converted string with escape codes
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function PMA_texEscape($string) {
|
||||
$escape = array('$', '%', '{', '}', '&', '#', '_', '^');
|
||||
$cnt_escape = count($escape);
|
||||
for ($k=0; $k < $cnt_escape; $k++) {
|
||||
$string = str_replace($escape[$k], '\\' . $escape[$k], $string);
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export header
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader() {
|
||||
global $crlf;
|
||||
global $cfg;
|
||||
|
||||
$head = '% phpMyAdmin LaTeX Dump' . $crlf
|
||||
. '% version ' . PMA_VERSION . $crlf
|
||||
. '% http://www.phpmyadmin.net' . $crlf
|
||||
. '%' . $crlf
|
||||
. '% ' . __('Host') . ': ' . $cfg['Server']['host'];
|
||||
if (!empty($cfg['Server']['port'])) {
|
||||
$head .= ':' . $cfg['Server']['port'];
|
||||
}
|
||||
$head .= $crlf
|
||||
. '% ' . __('Generation Time') . ': ' . PMA_localisedDate() . $crlf
|
||||
. '% ' . __('Server version') . ': ' . PMA_MYSQL_STR_VERSION . $crlf
|
||||
. '% ' . __('PHP Version') . ': ' . phpversion() . $crlf;
|
||||
return PMA_exportOutputHandler($head);
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db) {
|
||||
global $crlf;
|
||||
$head = '% ' . $crlf
|
||||
. '% ' . __('Database') . ': ' . (isset($GLOBALS['use_backquotes']) ? PMA_backquote($db) : '\'' . $db . '\''). $crlf
|
||||
. '% ' . $crlf;
|
||||
return PMA_exportOutputHandler($head);
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in LaTeX table/sideways table environment
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
$result = PMA_DBI_try_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
|
||||
|
||||
$columns_cnt = PMA_DBI_num_fields($result);
|
||||
for ($i = 0; $i < $columns_cnt; $i++) {
|
||||
$columns[$i] = PMA_DBI_field_name($result, $i);
|
||||
}
|
||||
unset($i);
|
||||
|
||||
$buffer = $crlf . '%' . $crlf . '% ' . __('Data') . ': ' . $table . $crlf . '%' . $crlf
|
||||
. ' \\begin{longtable}{|';
|
||||
|
||||
for ($index=0;$index<$columns_cnt;$index++) {
|
||||
$buffer .= 'l|';
|
||||
}
|
||||
$buffer .= '} ' . $crlf ;
|
||||
|
||||
$buffer .= ' \\hline \\endhead \\hline \\endfoot \\hline ' . $crlf;
|
||||
if (isset($GLOBALS['latex_caption'])) {
|
||||
if (!PMA_exportOutputHandler('\\caption{' . PMA_expandUserString($GLOBALS['latex_data_continued_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db)) . '} \\\\ ')) return false;
|
||||
$buffer .= ' \\caption{' . PMA_expandUserString($GLOBALS['latex_data_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db))
|
||||
. '} \\label{' . PMA_expandUserString($GLOBALS['latex_data_label'], NULL, array('table' => $table, 'database' => $db)) . '} \\\\';
|
||||
}
|
||||
if (!PMA_exportOutputHandler($buffer . '\\endhead \\endfoot' . $crlf)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!PMA_exportOutputHandler('\\\\ \hline')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// print the whole table
|
||||
while ($record = PMA_DBI_fetch_assoc($result)) {
|
||||
|
||||
$buffer = '';
|
||||
// print each row
|
||||
for ($i = 0; $i < $columns_cnt; $i++) {
|
||||
if (isset($record[$columns[$i]])
|
||||
&& (! function_exists('is_null') || !is_null($record[$columns[$i]]))) {
|
||||
$column_value = PMA_texEscape(stripslashes($record[$columns[$i]]));
|
||||
} else {
|
||||
$column_value = $GLOBALS['latex_null'];
|
||||
}
|
||||
|
||||
// last column ... no need for & character
|
||||
if ($i == ($columns_cnt - 1)) {
|
||||
$buffer .= $column_value;
|
||||
} else {
|
||||
$buffer .= $column_value . " & ";
|
||||
}
|
||||
}
|
||||
$buffer .= ' \\\\ \\hline ' . $crlf;
|
||||
if (!PMA_exportOutputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$buffer = ' \\end{longtable}' . $crlf;
|
||||
if (!PMA_exportOutputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
// show column names
|
||||
if (isset($GLOBALS['latex_columns'])) {
|
||||
$buffer = '\\hline ';
|
||||
for ($i = 0; $i < $columns_cnt; $i++) {
|
||||
$buffer .= '\\multicolumn{1}{|c|}{\\textbf{' . PMA_texEscape(stripslashes($columns[$i])) . '}} & ';
|
||||
}
|
||||
|
||||
PMA_DBI_free_result($result);
|
||||
return true;
|
||||
|
||||
} // end getTableLaTeX
|
||||
|
||||
/**
|
||||
* Outputs table's structure
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param bool $do_relation whether to include relation comments
|
||||
* @param bool $do_comments whether to include the pmadb-style column comments
|
||||
* as comments in the structure; this is deprecated
|
||||
* but the parameter is left here because export.php
|
||||
* calls PMA_exportStructure() also for other export
|
||||
* types which use this parameter
|
||||
* @param bool $do_mime whether to include mime comments
|
||||
* @param bool $dates whether to include creation/update/check dates
|
||||
* @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
|
||||
* @param string $export_type 'server', 'database', 'table'
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $export_mode, $export_type)
|
||||
{
|
||||
global $cfgRelation;
|
||||
|
||||
/**
|
||||
* Get the unique keys in the table
|
||||
*/
|
||||
$keys_query = PMA_DBI_get_table_indexes_sql($db, $table);
|
||||
$keys_result = PMA_DBI_query($keys_query);
|
||||
$unique_keys = array();
|
||||
while ($key = PMA_DBI_fetch_assoc($keys_result)) {
|
||||
if ($key['Non_unique'] == 0) {
|
||||
$unique_keys[] = $key['Column_name'];
|
||||
}
|
||||
}
|
||||
PMA_DBI_free_result($keys_result);
|
||||
|
||||
/**
|
||||
* Gets fields properties
|
||||
*/
|
||||
PMA_DBI_select_db($db);
|
||||
|
||||
// Check if we can use Relations
|
||||
if ($do_relation && !empty($cfgRelation['relation'])) {
|
||||
// Find which tables are related with the current one and write it in
|
||||
// an array
|
||||
$res_rel = PMA_getForeigners($db, $table);
|
||||
|
||||
if ($res_rel && count($res_rel) > 0) {
|
||||
$have_rel = true;
|
||||
} else {
|
||||
$have_rel = false;
|
||||
}
|
||||
} else {
|
||||
$have_rel = false;
|
||||
} // end if
|
||||
|
||||
/**
|
||||
* Displays the table structure
|
||||
*/
|
||||
$buffer = $crlf . '%' . $crlf . '% ' . __('Structure') . ': ' . $table . $crlf . '%' . $crlf
|
||||
. ' \\begin{longtable}{';
|
||||
if (!PMA_exportOutputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$columns_cnt = 4;
|
||||
$alignment = '|l|c|c|c|';
|
||||
if ($do_relation && $have_rel) {
|
||||
$columns_cnt++;
|
||||
$alignment .= 'l|';
|
||||
}
|
||||
if ($do_comments) {
|
||||
$columns_cnt++;
|
||||
$alignment .= 'l|';
|
||||
}
|
||||
if ($do_mime && $cfgRelation['mimework']) {
|
||||
$columns_cnt++;
|
||||
$alignment .='l|';
|
||||
}
|
||||
$buffer = $alignment . '} ' . $crlf ;
|
||||
|
||||
$header = ' \\hline ';
|
||||
$header .= '\\multicolumn{1}{|c|}{\\textbf{' . __('Column') . '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Type') . '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Null') . '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Default') . '}}';
|
||||
if ($do_relation && $have_rel) {
|
||||
$header .= ' & \\multicolumn{1}{|c|}{\\textbf{' . __('Links to') . '}}';
|
||||
}
|
||||
if ($do_comments) {
|
||||
$header .= ' & \\multicolumn{1}{|c|}{\\textbf{' . __('Comments') . '}}';
|
||||
$comments = PMA_getComments($db, $table);
|
||||
}
|
||||
if ($do_mime && $cfgRelation['mimework']) {
|
||||
$header .= ' & \\multicolumn{1}{|c|}{\\textbf{MIME}}';
|
||||
$mime_map = PMA_getMIME($db, $table, true);
|
||||
}
|
||||
|
||||
// Table caption for first page and label
|
||||
if (isset($GLOBALS['latex_caption'])) {
|
||||
$buffer .= ' \\caption{'. PMA_expandUserString($GLOBALS['latex_structure_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db))
|
||||
. '} \\label{' . PMA_expandUserString($GLOBALS['latex_structure_label'], NULL, array('table' => $table, 'database' => $db))
|
||||
. '} \\\\' . $crlf;
|
||||
}
|
||||
$buffer .= $header . ' \\\\ \\hline \\hline' . $crlf . '\\endfirsthead' . $crlf;
|
||||
// Table caption on next pages
|
||||
if (isset($GLOBALS['latex_caption'])) {
|
||||
$buffer .= ' \\caption{'. PMA_expandUserString($GLOBALS['latex_structure_continued_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db))
|
||||
. '} \\\\ ' . $crlf;
|
||||
}
|
||||
$buffer .= $header . ' \\\\ \\hline \\hline \\endhead \\endfoot ' . $crlf;
|
||||
|
||||
if (!PMA_exportOutputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$fields = PMA_DBI_get_columns($db, $table);
|
||||
foreach ($fields as $row) {
|
||||
$type = $row['Type'];
|
||||
// reformat mysql query output
|
||||
// set or enum types: slashes single quotes inside options
|
||||
if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) {
|
||||
$tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1);
|
||||
$type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
|
||||
$type_nowrap = '';
|
||||
|
||||
$binary = 0;
|
||||
$unsigned = 0;
|
||||
$zerofill = 0;
|
||||
} else {
|
||||
$type_nowrap = ' nowrap="nowrap"';
|
||||
$type = preg_replace('/BINARY/i', '', $type);
|
||||
$type = preg_replace('/ZEROFILL/i', '', $type);
|
||||
$type = preg_replace('/UNSIGNED/i', '', $type);
|
||||
if (empty($type)) {
|
||||
$type = ' ';
|
||||
$buffer = substr($buffer, 0, -2) . '\\\\ \\hline \hline ';
|
||||
if (!PMA_exportOutputHandler($buffer . ' \\endfirsthead ' . $crlf)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$binary = preg_match('/BINARY/i', $row['Type']);
|
||||
$unsigned = preg_match('/UNSIGNED/i', $row['Type']);
|
||||
$zerofill = preg_match('/ZEROFILL/i', $row['Type']);
|
||||
}
|
||||
if (!isset($row['Default'])) {
|
||||
if ($row['Null'] != 'NO') {
|
||||
$row['Default'] = 'NULL';
|
||||
if (isset($GLOBALS['latex_caption'])) {
|
||||
if (!PMA_exportOutputHandler('\\caption{' . PMA_expandUserString($GLOBALS['latex_data_continued_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db)) . '} \\\\ ')) return false;
|
||||
}
|
||||
if (!PMA_exportOutputHandler($buffer . '\\endhead \\endfoot' . $crlf)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!PMA_exportOutputHandler('\\\\ \hline')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$field_name = $row['Field'];
|
||||
// print the whole table
|
||||
while ($record = PMA_DBI_fetch_assoc($result)) {
|
||||
|
||||
$local_buffer = $field_name . "\000" . $type . "\000"
|
||||
. (($row['Null'] == '' || $row['Null'] == 'NO') ? __('No') : __('Yes'))
|
||||
. "\000" . (isset($row['Default']) ? $row['Default'] : '');
|
||||
$buffer = '';
|
||||
// print each row
|
||||
for ($i = 0; $i < $columns_cnt; $i++) {
|
||||
if (isset($record[$columns[$i]])
|
||||
&& (! function_exists('is_null') || !is_null($record[$columns[$i]]))) {
|
||||
$column_value = PMA_texEscape(stripslashes($record[$columns[$i]]));
|
||||
} else {
|
||||
$column_value = $GLOBALS['latex_null'];
|
||||
}
|
||||
|
||||
// last column ... no need for & character
|
||||
if ($i == ($columns_cnt - 1)) {
|
||||
$buffer .= $column_value;
|
||||
} else {
|
||||
$buffer .= $column_value . " & ";
|
||||
}
|
||||
}
|
||||
$buffer .= ' \\\\ \\hline ' . $crlf;
|
||||
if (!PMA_exportOutputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$buffer = ' \\end{longtable}' . $crlf;
|
||||
if (!PMA_exportOutputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PMA_DBI_free_result($result);
|
||||
return true;
|
||||
|
||||
} // end getTableLaTeX
|
||||
|
||||
/**
|
||||
* Outputs table's structure
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param bool $do_relation whether to include relation comments
|
||||
* @param bool $do_comments whether to include the pmadb-style column comments
|
||||
* as comments in the structure; this is deprecated
|
||||
* but the parameter is left here because export.php
|
||||
* calls PMA_exportStructure() also for other export
|
||||
* types which use this parameter
|
||||
* @param bool $do_mime whether to include mime comments
|
||||
* @param bool $dates whether to include creation/update/check dates
|
||||
* @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
|
||||
* @param string $export_type 'server', 'database', 'table'
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $export_mode, $export_type)
|
||||
{
|
||||
global $cfgRelation;
|
||||
|
||||
/**
|
||||
* Get the unique keys in the table
|
||||
*/
|
||||
$keys_query = PMA_DBI_get_table_indexes_sql($db, $table);
|
||||
$keys_result = PMA_DBI_query($keys_query);
|
||||
$unique_keys = array();
|
||||
while ($key = PMA_DBI_fetch_assoc($keys_result)) {
|
||||
if ($key['Non_unique'] == 0) {
|
||||
$unique_keys[] = $key['Column_name'];
|
||||
}
|
||||
}
|
||||
PMA_DBI_free_result($keys_result);
|
||||
|
||||
/**
|
||||
* Gets fields properties
|
||||
*/
|
||||
PMA_DBI_select_db($db);
|
||||
|
||||
// Check if we can use Relations
|
||||
if ($do_relation && !empty($cfgRelation['relation'])) {
|
||||
// Find which tables are related with the current one and write it in
|
||||
// an array
|
||||
$res_rel = PMA_getForeigners($db, $table);
|
||||
|
||||
if ($res_rel && count($res_rel) > 0) {
|
||||
$have_rel = true;
|
||||
} else {
|
||||
$have_rel = false;
|
||||
}
|
||||
} else {
|
||||
$have_rel = false;
|
||||
} // end if
|
||||
|
||||
/**
|
||||
* Displays the table structure
|
||||
*/
|
||||
$buffer = $crlf . '%' . $crlf . '% ' . __('Structure') . ': ' . $table . $crlf . '%' . $crlf
|
||||
. ' \\begin{longtable}{';
|
||||
if (!PMA_exportOutputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$columns_cnt = 4;
|
||||
$alignment = '|l|c|c|c|';
|
||||
if ($do_relation && $have_rel) {
|
||||
$local_buffer .= "\000";
|
||||
if (isset($res_rel[$field_name])) {
|
||||
$local_buffer .= $res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')';
|
||||
}
|
||||
$columns_cnt++;
|
||||
$alignment .= 'l|';
|
||||
}
|
||||
if ($do_comments && $cfgRelation['commwork']) {
|
||||
$local_buffer .= "\000";
|
||||
if (isset($comments[$field_name])) {
|
||||
$local_buffer .= $comments[$field_name];
|
||||
}
|
||||
if ($do_comments) {
|
||||
$columns_cnt++;
|
||||
$alignment .= 'l|';
|
||||
}
|
||||
if ($do_mime && $cfgRelation['mimework']) {
|
||||
$local_buffer .= "\000";
|
||||
if (isset($mime_map[$field_name])) {
|
||||
$local_buffer .= str_replace('_', '/', $mime_map[$field_name]['mimetype']);
|
||||
}
|
||||
$columns_cnt++;
|
||||
$alignment .='l|';
|
||||
}
|
||||
$local_buffer = PMA_texEscape($local_buffer);
|
||||
if ($row['Key']=='PRI') {
|
||||
$pos=strpos($local_buffer, "\000");
|
||||
$local_buffer = '\\textit{' . substr($local_buffer, 0, $pos) . '}' . substr($local_buffer, $pos);
|
||||
$buffer = $alignment . '} ' . $crlf ;
|
||||
|
||||
$header = ' \\hline ';
|
||||
$header .= '\\multicolumn{1}{|c|}{\\textbf{' . __('Column') . '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Type') . '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Null') . '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Default') . '}}';
|
||||
if ($do_relation && $have_rel) {
|
||||
$header .= ' & \\multicolumn{1}{|c|}{\\textbf{' . __('Links to') . '}}';
|
||||
}
|
||||
if (in_array($field_name, $unique_keys)) {
|
||||
$pos=strpos($local_buffer, "\000");
|
||||
$local_buffer = '\\textbf{' . substr($local_buffer, 0, $pos) . '}' . substr($local_buffer, $pos);
|
||||
if ($do_comments) {
|
||||
$header .= ' & \\multicolumn{1}{|c|}{\\textbf{' . __('Comments') . '}}';
|
||||
$comments = PMA_getComments($db, $table);
|
||||
}
|
||||
$buffer = str_replace("\000", ' & ', $local_buffer);
|
||||
$buffer .= ' \\\\ \\hline ' . $crlf;
|
||||
if ($do_mime && $cfgRelation['mimework']) {
|
||||
$header .= ' & \\multicolumn{1}{|c|}{\\textbf{MIME}}';
|
||||
$mime_map = PMA_getMIME($db, $table, true);
|
||||
}
|
||||
|
||||
// Table caption for first page and label
|
||||
if (isset($GLOBALS['latex_caption'])) {
|
||||
$buffer .= ' \\caption{'. PMA_expandUserString($GLOBALS['latex_structure_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db))
|
||||
. '} \\label{' . PMA_expandUserString($GLOBALS['latex_structure_label'], NULL, array('table' => $table, 'database' => $db))
|
||||
. '} \\\\' . $crlf;
|
||||
}
|
||||
$buffer .= $header . ' \\\\ \\hline \\hline' . $crlf . '\\endfirsthead' . $crlf;
|
||||
// Table caption on next pages
|
||||
if (isset($GLOBALS['latex_caption'])) {
|
||||
$buffer .= ' \\caption{'. PMA_expandUserString($GLOBALS['latex_structure_continued_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db))
|
||||
. '} \\\\ ' . $crlf;
|
||||
}
|
||||
$buffer .= $header . ' \\\\ \\hline \\hline \\endhead \\endfoot ' . $crlf;
|
||||
|
||||
if (!PMA_exportOutputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
} // end while
|
||||
|
||||
$buffer = ' \\end{longtable}' . $crlf;
|
||||
return PMA_exportOutputHandler($buffer);
|
||||
} // end of the 'PMA_exportStructure' function
|
||||
$fields = PMA_DBI_get_columns($db, $table);
|
||||
foreach ($fields as $row) {
|
||||
$type = $row['Type'];
|
||||
// reformat mysql query output
|
||||
// set or enum types: slashes single quotes inside options
|
||||
if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) {
|
||||
$tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1);
|
||||
$type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
|
||||
$type_nowrap = '';
|
||||
|
||||
$binary = 0;
|
||||
$unsigned = 0;
|
||||
$zerofill = 0;
|
||||
} else {
|
||||
$type_nowrap = ' nowrap="nowrap"';
|
||||
$type = preg_replace('/BINARY/i', '', $type);
|
||||
$type = preg_replace('/ZEROFILL/i', '', $type);
|
||||
$type = preg_replace('/UNSIGNED/i', '', $type);
|
||||
if (empty($type)) {
|
||||
$type = ' ';
|
||||
}
|
||||
|
||||
$binary = preg_match('/BINARY/i', $row['Type']);
|
||||
$unsigned = preg_match('/UNSIGNED/i', $row['Type']);
|
||||
$zerofill = preg_match('/ZEROFILL/i', $row['Type']);
|
||||
}
|
||||
if (!isset($row['Default'])) {
|
||||
if ($row['Null'] != 'NO') {
|
||||
$row['Default'] = 'NULL';
|
||||
}
|
||||
}
|
||||
|
||||
$field_name = $row['Field'];
|
||||
|
||||
$local_buffer = $field_name . "\000" . $type . "\000"
|
||||
. (($row['Null'] == '' || $row['Null'] == 'NO') ? __('No') : __('Yes'))
|
||||
. "\000" . (isset($row['Default']) ? $row['Default'] : '');
|
||||
|
||||
if ($do_relation && $have_rel) {
|
||||
$local_buffer .= "\000";
|
||||
if (isset($res_rel[$field_name])) {
|
||||
$local_buffer .= $res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')';
|
||||
}
|
||||
}
|
||||
if ($do_comments && $cfgRelation['commwork']) {
|
||||
$local_buffer .= "\000";
|
||||
if (isset($comments[$field_name])) {
|
||||
$local_buffer .= $comments[$field_name];
|
||||
}
|
||||
}
|
||||
if ($do_mime && $cfgRelation['mimework']) {
|
||||
$local_buffer .= "\000";
|
||||
if (isset($mime_map[$field_name])) {
|
||||
$local_buffer .= str_replace('_', '/', $mime_map[$field_name]['mimetype']);
|
||||
}
|
||||
}
|
||||
$local_buffer = PMA_texEscape($local_buffer);
|
||||
if ($row['Key']=='PRI') {
|
||||
$pos=strpos($local_buffer, "\000");
|
||||
$local_buffer = '\\textit{' . substr($local_buffer, 0, $pos) . '}' . substr($local_buffer, $pos);
|
||||
}
|
||||
if (in_array($field_name, $unique_keys)) {
|
||||
$pos=strpos($local_buffer, "\000");
|
||||
$local_buffer = '\\textbf{' . substr($local_buffer, 0, $pos) . '}' . substr($local_buffer, $pos);
|
||||
}
|
||||
$buffer = str_replace("\000", ' & ', $local_buffer);
|
||||
$buffer .= ' \\\\ \\hline ' . $crlf;
|
||||
|
||||
if (!PMA_exportOutputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
} // end while
|
||||
|
||||
$buffer = ' \\end{longtable}' . $crlf;
|
||||
return PMA_exportOutputHandler($buffer);
|
||||
} // end of the 'PMA_exportStructure' function
|
||||
|
||||
} // end else
|
||||
?>
|
||||
|
||||
@ -24,136 +24,136 @@ if (isset($plugin_list)) {
|
||||
);
|
||||
} else {
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export header
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in MediaWiki format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
$columns = PMA_DBI_get_columns($db, $table);
|
||||
$columns = array_values($columns);
|
||||
$row_cnt = count($columns);
|
||||
|
||||
$output = "{| cellpadding=\"10\" cellspacing=\"0\" border=\"1\" style=\"text-align:center;\"\n";
|
||||
$output .= "|+'''" . $table . "'''\n";
|
||||
$output .= "|- style=\"background:#ffdead;\"\n";
|
||||
$output .= "! style=\"background:#ffffff\" | \n";
|
||||
for ($i = 0; $i < $row_cnt; ++$i) {
|
||||
$output .= " | " . $columns[$i]['Field'];
|
||||
if (($i + 1) != $row_cnt) {
|
||||
$output .= "\n";
|
||||
}
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter() {
|
||||
return true;
|
||||
}
|
||||
$output .= "\n";
|
||||
|
||||
$output .= "|- style=\"background:#f9f9f9;\"\n";
|
||||
$output .= "! style=\"background:#f2f2f2\" | Type\n";
|
||||
for ($i = 0; $i < $row_cnt; ++$i) {
|
||||
$output .= " | " . $columns[$i]['Type'];
|
||||
if (($i + 1) != $row_cnt) {
|
||||
$output .= "\n";
|
||||
}
|
||||
/**
|
||||
* Outputs export header
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader() {
|
||||
return true;
|
||||
}
|
||||
$output .= "\n";
|
||||
|
||||
$output .= "|- style=\"background:#f9f9f9;\"\n";
|
||||
$output .= "! style=\"background:#f2f2f2\" | Null\n";
|
||||
for ($i = 0; $i < $row_cnt; ++$i) {
|
||||
$output .= " | " . $columns[$i]['Null'];
|
||||
if (($i + 1) != $row_cnt) {
|
||||
$output .= "\n";
|
||||
}
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db) {
|
||||
return true;
|
||||
}
|
||||
$output .= "\n";
|
||||
|
||||
$output .= "|- style=\"background:#f9f9f9;\"\n";
|
||||
$output .= "! style=\"background:#f2f2f2\" | Default\n";
|
||||
for ($i = 0; $i < $row_cnt; ++$i) {
|
||||
$output .= " | " . $columns[$i]['Default'];
|
||||
if (($i + 1) != $row_cnt) {
|
||||
$output .= "\n";
|
||||
}
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db) {
|
||||
return true;
|
||||
}
|
||||
$output .= "\n";
|
||||
|
||||
$output .= "|- style=\"background:#f9f9f9;\"\n";
|
||||
$output .= "! style=\"background:#f2f2f2\" | Extra\n";
|
||||
for ($i = 0; $i < $row_cnt; ++$i) {
|
||||
$output .= " | " . $columns[$i]['Extra'];
|
||||
if (($i + 1) != $row_cnt) {
|
||||
$output .= "\n";
|
||||
}
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db) {
|
||||
return true;
|
||||
}
|
||||
$output .= "\n";
|
||||
|
||||
$output .= "|}\n\n\n\n";
|
||||
return PMA_exportOutputHandler($output);
|
||||
}
|
||||
/**
|
||||
* Outputs the content of a table in MediaWiki format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
$columns = PMA_DBI_get_columns($db, $table);
|
||||
$columns = array_values($columns);
|
||||
$row_cnt = count($columns);
|
||||
|
||||
$output = "{| cellpadding=\"10\" cellspacing=\"0\" border=\"1\" style=\"text-align:center;\"\n";
|
||||
$output .= "|+'''" . $table . "'''\n";
|
||||
$output .= "|- style=\"background:#ffdead;\"\n";
|
||||
$output .= "! style=\"background:#ffffff\" | \n";
|
||||
for ($i = 0; $i < $row_cnt; ++$i) {
|
||||
$output .= " | " . $columns[$i]['Field'];
|
||||
if (($i + 1) != $row_cnt) {
|
||||
$output .= "\n";
|
||||
}
|
||||
}
|
||||
$output .= "\n";
|
||||
|
||||
$output .= "|- style=\"background:#f9f9f9;\"\n";
|
||||
$output .= "! style=\"background:#f2f2f2\" | Type\n";
|
||||
for ($i = 0; $i < $row_cnt; ++$i) {
|
||||
$output .= " | " . $columns[$i]['Type'];
|
||||
if (($i + 1) != $row_cnt) {
|
||||
$output .= "\n";
|
||||
}
|
||||
}
|
||||
$output .= "\n";
|
||||
|
||||
$output .= "|- style=\"background:#f9f9f9;\"\n";
|
||||
$output .= "! style=\"background:#f2f2f2\" | Null\n";
|
||||
for ($i = 0; $i < $row_cnt; ++$i) {
|
||||
$output .= " | " . $columns[$i]['Null'];
|
||||
if (($i + 1) != $row_cnt) {
|
||||
$output .= "\n";
|
||||
}
|
||||
}
|
||||
$output .= "\n";
|
||||
|
||||
$output .= "|- style=\"background:#f9f9f9;\"\n";
|
||||
$output .= "! style=\"background:#f2f2f2\" | Default\n";
|
||||
for ($i = 0; $i < $row_cnt; ++$i) {
|
||||
$output .= " | " . $columns[$i]['Default'];
|
||||
if (($i + 1) != $row_cnt) {
|
||||
$output .= "\n";
|
||||
}
|
||||
}
|
||||
$output .= "\n";
|
||||
|
||||
$output .= "|- style=\"background:#f9f9f9;\"\n";
|
||||
$output .= "! style=\"background:#f2f2f2\" | Extra\n";
|
||||
for ($i = 0; $i < $row_cnt; ++$i) {
|
||||
$output .= " | " . $columns[$i]['Extra'];
|
||||
if (($i + 1) != $row_cnt) {
|
||||
$output .= "\n";
|
||||
}
|
||||
}
|
||||
$output .= "\n";
|
||||
|
||||
$output .= "|}\n\n\n\n";
|
||||
return PMA_exportOutputHandler($output);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@ -30,192 +30,192 @@ if (isset($plugin_list)) {
|
||||
);
|
||||
} else {
|
||||
|
||||
$GLOBALS['ods_buffer'] = '';
|
||||
require_once './libraries/opendocument.lib.php';
|
||||
$GLOBALS['ods_buffer'] = '';
|
||||
require_once './libraries/opendocument.lib.php';
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter() {
|
||||
$GLOBALS['ods_buffer'] .= '</office:spreadsheet>'
|
||||
. '</office:body>'
|
||||
. '</office:document-content>';
|
||||
if (!PMA_exportOutputHandler(PMA_createOpenDocument('application/vnd.oasis.opendocument.spreadsheet', $GLOBALS['ods_buffer']))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export header
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader() {
|
||||
$GLOBALS['ods_buffer'] .= '<?xml version="1.0" encoding="utf-8"?' . '>'
|
||||
. '<office:document-content '. $GLOBALS['OpenDocumentNS'] . 'office:version="1.0">'
|
||||
. '<office:automatic-styles>'
|
||||
. '<number:date-style style:name="N37" number:automatic-order="true">'
|
||||
. '<number:month number:style="long"/>'
|
||||
. '<number:text>/</number:text>'
|
||||
. '<number:day number:style="long"/>'
|
||||
. '<number:text>/</number:text>'
|
||||
. '<number:year/>'
|
||||
. '</number:date-style>'
|
||||
. '<number:time-style style:name="N43">'
|
||||
. '<number:hours number:style="long"/>'
|
||||
. '<number:text>:</number:text>'
|
||||
. '<number:minutes number:style="long"/>'
|
||||
. '<number:text>:</number:text>'
|
||||
. '<number:seconds number:style="long"/>'
|
||||
. '<number:text> </number:text>'
|
||||
. '<number:am-pm/>'
|
||||
. '</number:time-style>'
|
||||
. '<number:date-style style:name="N50" number:automatic-order="true" number:format-source="language">'
|
||||
. '<number:month/>'
|
||||
. '<number:text>/</number:text>'
|
||||
. '<number:day/>'
|
||||
. '<number:text>/</number:text>'
|
||||
. '<number:year/>'
|
||||
. '<number:text> </number:text>'
|
||||
. '<number:hours number:style="long"/>'
|
||||
. '<number:text>:</number:text>'
|
||||
. '<number:minutes number:style="long"/>'
|
||||
. '<number:text> </number:text>'
|
||||
. '<number:am-pm/>'
|
||||
. '</number:date-style>'
|
||||
. '<style:style style:name="DateCell" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N37"/>'
|
||||
. '<style:style style:name="TimeCell" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N43"/>'
|
||||
. '<style:style style:name="DateTimeCell" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N50"/>'
|
||||
. '</office:automatic-styles>'
|
||||
. '<office:body>'
|
||||
. '<office:spreadsheet>';
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in ODS format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
global $what;
|
||||
|
||||
// Gets the data from the database
|
||||
$result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
|
||||
$fields_cnt = PMA_DBI_num_fields($result);
|
||||
$fields_meta = PMA_DBI_get_fields_meta($result);
|
||||
$field_flags = array();
|
||||
for ($j = 0; $j < $fields_cnt; $j++) {
|
||||
$field_flags[$j] = PMA_DBI_field_flags($result, $j);
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter() {
|
||||
$GLOBALS['ods_buffer'] .= '</office:spreadsheet>'
|
||||
. '</office:body>'
|
||||
. '</office:document-content>';
|
||||
if (!PMA_exportOutputHandler(PMA_createOpenDocument('application/vnd.oasis.opendocument.spreadsheet', $GLOBALS['ods_buffer']))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
$GLOBALS['ods_buffer'] .= '<table:table table:name="' . htmlspecialchars($table) . '">';
|
||||
/**
|
||||
* Outputs export header
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader() {
|
||||
$GLOBALS['ods_buffer'] .= '<?xml version="1.0" encoding="utf-8"?' . '>'
|
||||
. '<office:document-content '. $GLOBALS['OpenDocumentNS'] . 'office:version="1.0">'
|
||||
. '<office:automatic-styles>'
|
||||
. '<number:date-style style:name="N37" number:automatic-order="true">'
|
||||
. '<number:month number:style="long"/>'
|
||||
. '<number:text>/</number:text>'
|
||||
. '<number:day number:style="long"/>'
|
||||
. '<number:text>/</number:text>'
|
||||
. '<number:year/>'
|
||||
. '</number:date-style>'
|
||||
. '<number:time-style style:name="N43">'
|
||||
. '<number:hours number:style="long"/>'
|
||||
. '<number:text>:</number:text>'
|
||||
. '<number:minutes number:style="long"/>'
|
||||
. '<number:text>:</number:text>'
|
||||
. '<number:seconds number:style="long"/>'
|
||||
. '<number:text> </number:text>'
|
||||
. '<number:am-pm/>'
|
||||
. '</number:time-style>'
|
||||
. '<number:date-style style:name="N50" number:automatic-order="true" number:format-source="language">'
|
||||
. '<number:month/>'
|
||||
. '<number:text>/</number:text>'
|
||||
. '<number:day/>'
|
||||
. '<number:text>/</number:text>'
|
||||
. '<number:year/>'
|
||||
. '<number:text> </number:text>'
|
||||
. '<number:hours number:style="long"/>'
|
||||
. '<number:text>:</number:text>'
|
||||
. '<number:minutes number:style="long"/>'
|
||||
. '<number:text> </number:text>'
|
||||
. '<number:am-pm/>'
|
||||
. '</number:date-style>'
|
||||
. '<style:style style:name="DateCell" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N37"/>'
|
||||
. '<style:style style:name="TimeCell" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N43"/>'
|
||||
. '<style:style style:name="DateTimeCell" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N50"/>'
|
||||
. '</office:automatic-styles>'
|
||||
. '<office:body>'
|
||||
. '<office:spreadsheet>';
|
||||
return true;
|
||||
}
|
||||
|
||||
// If required, get fields name at the first line
|
||||
if (isset($GLOBALS[$what . '_columns'])) {
|
||||
$GLOBALS['ods_buffer'] .= '<table:table-row>';
|
||||
for ($i = 0; $i < $fields_cnt; $i++) {
|
||||
$GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars(stripslashes(PMA_DBI_field_name($result, $i))) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
} // end for
|
||||
$GLOBALS['ods_buffer'] .= '</table:table-row>';
|
||||
} // end if
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Format the data
|
||||
while ($row = PMA_DBI_fetch_row($result)) {
|
||||
$GLOBALS['ods_buffer'] .= '<table:table-row>';
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in ODS format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
global $what;
|
||||
|
||||
// Gets the data from the database
|
||||
$result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
|
||||
$fields_cnt = PMA_DBI_num_fields($result);
|
||||
$fields_meta = PMA_DBI_get_fields_meta($result);
|
||||
$field_flags = array();
|
||||
for ($j = 0; $j < $fields_cnt; $j++) {
|
||||
if (!isset($row[$j]) || is_null($row[$j])) {
|
||||
$GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars($GLOBALS[$what . '_null']) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
// ignore BLOB
|
||||
} elseif (stristr($field_flags[$j], 'BINARY')
|
||||
&& $fields_meta[$j]->blob) {
|
||||
$GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p></text:p>'
|
||||
. '</table:table-cell>';
|
||||
} elseif ($fields_meta[$j]->type == "date") {
|
||||
$GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="date" office:date-value="' . date("Y-m-d", strtotime($row[$j])) . '" table:style-name="DateCell">'
|
||||
. '<text:p>' . htmlspecialchars($row[$j]) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
} elseif ($fields_meta[$j]->type == "time") {
|
||||
$GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="time" office:time-value="' . date("\P\TH\Hi\Ms\S", strtotime($row[$j])) . '" table:style-name="TimeCell">'
|
||||
. '<text:p>' . htmlspecialchars($row[$j]) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
} elseif ($fields_meta[$j]->type == "datetime") {
|
||||
$GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="date" office:date-value="' . date("Y-m-d\TH:i:s", strtotime($row[$j])) . '" table:style-name="DateTimeCell">'
|
||||
. '<text:p>' . htmlspecialchars($row[$j]) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
} elseif ($fields_meta[$j]->numeric && $fields_meta[$j]->type != 'timestamp' && ! $fields_meta[$j]->blob) {
|
||||
$GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="float" office:value="' . $row[$j] . '" >'
|
||||
. '<text:p>' . htmlspecialchars($row[$j]) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
} else {
|
||||
$GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars($row[$j]) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
}
|
||||
} // end for
|
||||
$GLOBALS['ods_buffer'] .= '</table:table-row>';
|
||||
} // end while
|
||||
PMA_DBI_free_result($result);
|
||||
$field_flags[$j] = PMA_DBI_field_flags($result, $j);
|
||||
}
|
||||
|
||||
$GLOBALS['ods_buffer'] .= '</table:table>';
|
||||
$GLOBALS['ods_buffer'] .= '<table:table table:name="' . htmlspecialchars($table) . '">';
|
||||
|
||||
return true;
|
||||
}
|
||||
// If required, get fields name at the first line
|
||||
if (isset($GLOBALS[$what . '_columns'])) {
|
||||
$GLOBALS['ods_buffer'] .= '<table:table-row>';
|
||||
for ($i = 0; $i < $fields_cnt; $i++) {
|
||||
$GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars(stripslashes(PMA_DBI_field_name($result, $i))) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
} // end for
|
||||
$GLOBALS['ods_buffer'] .= '</table:table-row>';
|
||||
} // end if
|
||||
|
||||
// Format the data
|
||||
while ($row = PMA_DBI_fetch_row($result)) {
|
||||
$GLOBALS['ods_buffer'] .= '<table:table-row>';
|
||||
for ($j = 0; $j < $fields_cnt; $j++) {
|
||||
if (!isset($row[$j]) || is_null($row[$j])) {
|
||||
$GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars($GLOBALS[$what . '_null']) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
// ignore BLOB
|
||||
} elseif (stristr($field_flags[$j], 'BINARY')
|
||||
&& $fields_meta[$j]->blob) {
|
||||
$GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p></text:p>'
|
||||
. '</table:table-cell>';
|
||||
} elseif ($fields_meta[$j]->type == "date") {
|
||||
$GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="date" office:date-value="' . date("Y-m-d", strtotime($row[$j])) . '" table:style-name="DateCell">'
|
||||
. '<text:p>' . htmlspecialchars($row[$j]) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
} elseif ($fields_meta[$j]->type == "time") {
|
||||
$GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="time" office:time-value="' . date("\P\TH\Hi\Ms\S", strtotime($row[$j])) . '" table:style-name="TimeCell">'
|
||||
. '<text:p>' . htmlspecialchars($row[$j]) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
} elseif ($fields_meta[$j]->type == "datetime") {
|
||||
$GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="date" office:date-value="' . date("Y-m-d\TH:i:s", strtotime($row[$j])) . '" table:style-name="DateTimeCell">'
|
||||
. '<text:p>' . htmlspecialchars($row[$j]) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
} elseif ($fields_meta[$j]->numeric && $fields_meta[$j]->type != 'timestamp' && ! $fields_meta[$j]->blob) {
|
||||
$GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="float" office:value="' . $row[$j] . '" >'
|
||||
. '<text:p>' . htmlspecialchars($row[$j]) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
} else {
|
||||
$GLOBALS['ods_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars($row[$j]) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
}
|
||||
} // end for
|
||||
$GLOBALS['ods_buffer'] .= '</table:table-row>';
|
||||
} // end while
|
||||
PMA_DBI_free_result($result);
|
||||
|
||||
$GLOBALS['ods_buffer'] .= '</table:table>';
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@ -62,345 +62,345 @@ if (isset($plugin_list)) {
|
||||
array('type' => 'end_group');
|
||||
} else {
|
||||
|
||||
$GLOBALS['odt_buffer'] = '';
|
||||
require_once './libraries/opendocument.lib.php';
|
||||
$GLOBALS['odt_buffer'] = '';
|
||||
require_once './libraries/opendocument.lib.php';
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter() {
|
||||
$GLOBALS['odt_buffer'] .= '</office:text>'
|
||||
. '</office:body>'
|
||||
. '</office:document-content>';
|
||||
if (!PMA_exportOutputHandler(PMA_createOpenDocument('application/vnd.oasis.opendocument.text', $GLOBALS['odt_buffer']))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export header
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader() {
|
||||
$GLOBALS['odt_buffer'] .= '<?xml version="1.0" encoding="utf-8"?' . '>'
|
||||
. '<office:document-content '. $GLOBALS['OpenDocumentNS'] . 'office:version="1.0">'
|
||||
. '<office:body>'
|
||||
. '<office:text>';
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db) {
|
||||
$GLOBALS['odt_buffer'] .= '<text:h text:outline-level="1" text:style-name="Heading_1" text:is-list-header="true">' . htmlspecialchars(__('Database') . ' ' . $db) . '</text:h>';
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in ODT format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
global $what;
|
||||
|
||||
// Gets the data from the database
|
||||
$result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
|
||||
$fields_cnt = PMA_DBI_num_fields($result);
|
||||
$fields_meta = PMA_DBI_get_fields_meta($result);
|
||||
$field_flags = array();
|
||||
for ($j = 0; $j < $fields_cnt; $j++) {
|
||||
$field_flags[$j] = PMA_DBI_field_flags($result, $j);
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter() {
|
||||
$GLOBALS['odt_buffer'] .= '</office:text>'
|
||||
. '</office:body>'
|
||||
. '</office:document-content>';
|
||||
if (!PMA_exportOutputHandler(PMA_createOpenDocument('application/vnd.oasis.opendocument.text', $GLOBALS['odt_buffer']))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
$GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2" text:is-list-header="true">' . htmlspecialchars(__('Dumping data for table') . ' ' . $table) . '</text:h>';
|
||||
$GLOBALS['odt_buffer'] .= '<table:table table:name="' . htmlspecialchars($table) . '_structure">';
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-column table:number-columns-repeated="' . $fields_cnt . '"/>';
|
||||
/**
|
||||
* Outputs export header
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader() {
|
||||
$GLOBALS['odt_buffer'] .= '<?xml version="1.0" encoding="utf-8"?' . '>'
|
||||
. '<office:document-content '. $GLOBALS['OpenDocumentNS'] . 'office:version="1.0">'
|
||||
. '<office:body>'
|
||||
. '<office:text>';
|
||||
return true;
|
||||
}
|
||||
|
||||
// If required, get fields name at the first line
|
||||
if (isset($GLOBALS[$what . '_columns'])) {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-row>';
|
||||
for ($i = 0; $i < $fields_cnt; $i++) {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars(stripslashes(PMA_DBI_field_name($result, $i))) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
} // end for
|
||||
$GLOBALS['odt_buffer'] .= '</table:table-row>';
|
||||
} // end if
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db) {
|
||||
$GLOBALS['odt_buffer'] .= '<text:h text:outline-level="1" text:style-name="Heading_1" text:is-list-header="true">' . htmlspecialchars(__('Database') . ' ' . $db) . '</text:h>';
|
||||
return true;
|
||||
}
|
||||
|
||||
// Format the data
|
||||
while ($row = PMA_DBI_fetch_row($result)) {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-row>';
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in ODT format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
global $what;
|
||||
|
||||
// Gets the data from the database
|
||||
$result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
|
||||
$fields_cnt = PMA_DBI_num_fields($result);
|
||||
$fields_meta = PMA_DBI_get_fields_meta($result);
|
||||
$field_flags = array();
|
||||
for ($j = 0; $j < $fields_cnt; $j++) {
|
||||
if (!isset($row[$j]) || is_null($row[$j])) {
|
||||
$field_flags[$j] = PMA_DBI_field_flags($result, $j);
|
||||
}
|
||||
|
||||
$GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2" text:is-list-header="true">' . htmlspecialchars(__('Dumping data for table') . ' ' . $table) . '</text:h>';
|
||||
$GLOBALS['odt_buffer'] .= '<table:table table:name="' . htmlspecialchars($table) . '_structure">';
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-column table:number-columns-repeated="' . $fields_cnt . '"/>';
|
||||
|
||||
// If required, get fields name at the first line
|
||||
if (isset($GLOBALS[$what . '_columns'])) {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-row>';
|
||||
for ($i = 0; $i < $fields_cnt; $i++) {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars($GLOBALS[$what . '_null']) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
// ignore BLOB
|
||||
} elseif (stristr($field_flags[$j], 'BINARY')
|
||||
&& $fields_meta[$j]->blob) {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p></text:p>'
|
||||
. '</table:table-cell>';
|
||||
} elseif ($fields_meta[$j]->numeric && $fields_meta[$j]->type != 'timestamp' && ! $fields_meta[$j]->blob) {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="float" office:value="' . $row[$j] . '" >'
|
||||
. '<text:p>' . htmlspecialchars($row[$j]) . '</text:p>'
|
||||
. '<text:p>' . htmlspecialchars(stripslashes(PMA_DBI_field_name($result, $i))) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
} // end for
|
||||
$GLOBALS['odt_buffer'] .= '</table:table-row>';
|
||||
} // end if
|
||||
|
||||
// Format the data
|
||||
while ($row = PMA_DBI_fetch_row($result)) {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-row>';
|
||||
for ($j = 0; $j < $fields_cnt; $j++) {
|
||||
if (!isset($row[$j]) || is_null($row[$j])) {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars($GLOBALS[$what . '_null']) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
// ignore BLOB
|
||||
} elseif (stristr($field_flags[$j], 'BINARY')
|
||||
&& $fields_meta[$j]->blob) {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p></text:p>'
|
||||
. '</table:table-cell>';
|
||||
} elseif ($fields_meta[$j]->numeric && $fields_meta[$j]->type != 'timestamp' && ! $fields_meta[$j]->blob) {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="float" office:value="' . $row[$j] . '" >'
|
||||
. '<text:p>' . htmlspecialchars($row[$j]) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
} else {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars($row[$j]) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
}
|
||||
} // end for
|
||||
$GLOBALS['odt_buffer'] .= '</table:table-row>';
|
||||
} // end while
|
||||
PMA_DBI_free_result($result);
|
||||
|
||||
$GLOBALS['odt_buffer'] .= '</table:table>';
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs table's structure
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param bool $do_relation whether to include relation comments
|
||||
* @param bool $do_comments whether to include the pmadb-style column comments
|
||||
* as comments in the structure; this is deprecated
|
||||
* but the parameter is left here because export.php
|
||||
* calls PMA_exportStructure() also for other export
|
||||
* types which use this parameter
|
||||
* @param bool $do_mime whether to include mime comments
|
||||
* @param bool $dates whether to include creation/update/check dates
|
||||
* @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
|
||||
* @param string $export_type 'server', 'database', 'table'
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $export_mode, $export_type)
|
||||
{
|
||||
global $cfgRelation;
|
||||
|
||||
/* Heading */
|
||||
$GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2" text:is-list-header="true">' . htmlspecialchars(__('Table structure for table') . ' ' . $table) . '</text:h>';
|
||||
|
||||
/**
|
||||
* Get the unique keys in the table
|
||||
*/
|
||||
$keys_query = PMA_DBI_get_table_indexes_sql($db, $table);
|
||||
$keys_result = PMA_DBI_query($keys_query);
|
||||
$unique_keys = array();
|
||||
while ($key = PMA_DBI_fetch_assoc($keys_result)) {
|
||||
if ($key['Non_unique'] == 0) {
|
||||
$unique_keys[] = $key['Column_name'];
|
||||
}
|
||||
}
|
||||
PMA_DBI_free_result($keys_result);
|
||||
|
||||
/**
|
||||
* Gets fields properties
|
||||
*/
|
||||
PMA_DBI_select_db($db);
|
||||
|
||||
// Check if we can use Relations
|
||||
if ($do_relation && !empty($cfgRelation['relation'])) {
|
||||
// Find which tables are related with the current one and write it in
|
||||
// an array
|
||||
$res_rel = PMA_getForeigners($db, $table);
|
||||
|
||||
if ($res_rel && count($res_rel) > 0) {
|
||||
$have_rel = true;
|
||||
} else {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars($row[$j]) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
}
|
||||
} // end for
|
||||
$GLOBALS['odt_buffer'] .= '</table:table-row>';
|
||||
} // end while
|
||||
PMA_DBI_free_result($result);
|
||||
|
||||
$GLOBALS['odt_buffer'] .= '</table:table>';
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs table's structure
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param bool $do_relation whether to include relation comments
|
||||
* @param bool $do_comments whether to include the pmadb-style column comments
|
||||
* as comments in the structure; this is deprecated
|
||||
* but the parameter is left here because export.php
|
||||
* calls PMA_exportStructure() also for other export
|
||||
* types which use this parameter
|
||||
* @param bool $do_mime whether to include mime comments
|
||||
* @param bool $dates whether to include creation/update/check dates
|
||||
* @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
|
||||
* @param string $export_type 'server', 'database', 'table'
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $export_mode, $export_type)
|
||||
{
|
||||
global $cfgRelation;
|
||||
|
||||
/* Heading */
|
||||
$GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2" text:is-list-header="true">' . htmlspecialchars(__('Table structure for table') . ' ' . $table) . '</text:h>';
|
||||
|
||||
/**
|
||||
* Get the unique keys in the table
|
||||
*/
|
||||
$keys_query = PMA_DBI_get_table_indexes_sql($db, $table);
|
||||
$keys_result = PMA_DBI_query($keys_query);
|
||||
$unique_keys = array();
|
||||
while ($key = PMA_DBI_fetch_assoc($keys_result)) {
|
||||
if ($key['Non_unique'] == 0) {
|
||||
$unique_keys[] = $key['Column_name'];
|
||||
}
|
||||
}
|
||||
PMA_DBI_free_result($keys_result);
|
||||
|
||||
/**
|
||||
* Gets fields properties
|
||||
*/
|
||||
PMA_DBI_select_db($db);
|
||||
|
||||
// Check if we can use Relations
|
||||
if ($do_relation && !empty($cfgRelation['relation'])) {
|
||||
// Find which tables are related with the current one and write it in
|
||||
// an array
|
||||
$res_rel = PMA_getForeigners($db, $table);
|
||||
|
||||
if ($res_rel && count($res_rel) > 0) {
|
||||
$have_rel = true;
|
||||
} else {
|
||||
$have_rel = false;
|
||||
}
|
||||
} else {
|
||||
$have_rel = false;
|
||||
} // end if
|
||||
|
||||
/**
|
||||
* Displays the table structure
|
||||
*/
|
||||
$GLOBALS['odt_buffer'] .= '<table:table table:name="' . htmlspecialchars($table) . '_data">';
|
||||
$columns_cnt = 4;
|
||||
if ($do_relation && $have_rel) {
|
||||
$columns_cnt++;
|
||||
}
|
||||
if ($do_comments) {
|
||||
$columns_cnt++;
|
||||
}
|
||||
if ($do_mime && $cfgRelation['mimework']) {
|
||||
$columns_cnt++;
|
||||
}
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-column table:number-columns-repeated="' . $columns_cnt . '"/>';
|
||||
/* Header */
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-row>';
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars(__('Column')) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars(__('Type')) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars(__('Null')) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars(__('Default')) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
if ($do_relation && $have_rel) {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars(__('Links to')) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
}
|
||||
if ($do_comments) {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars(__('Comments')) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
$comments = PMA_getComments($db, $table);
|
||||
}
|
||||
if ($do_mime && $cfgRelation['mimework']) {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars(__('MIME type')) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
$mime_map = PMA_getMIME($db, $table, true);
|
||||
}
|
||||
$GLOBALS['odt_buffer'] .= '</table:table-row>';
|
||||
|
||||
$columns = PMA_DBI_get_columns($db, $table);
|
||||
foreach ($columns as $column) {
|
||||
|
||||
$field_name = $column['Field'];
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-row>';
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars($field_name) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
// reformat mysql query output
|
||||
// set or enum types: slashes single quotes inside options
|
||||
$type = $column['Type'];
|
||||
if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) {
|
||||
$tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1);
|
||||
$type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
|
||||
$type_nowrap = '';
|
||||
|
||||
$binary = 0;
|
||||
$unsigned = 0;
|
||||
$zerofill = 0;
|
||||
} else {
|
||||
$type_nowrap = ' nowrap="nowrap"';
|
||||
$type = preg_replace('/BINARY/i', '', $type);
|
||||
$type = preg_replace('/ZEROFILL/i', '', $type);
|
||||
$type = preg_replace('/UNSIGNED/i', '', $type);
|
||||
if (empty($type)) {
|
||||
$type = ' ';
|
||||
}
|
||||
|
||||
$binary = preg_match('/BINARY/i', $column['Type']);
|
||||
$unsigned = preg_match('/UNSIGNED/i', $column['Type']);
|
||||
$zerofill = preg_match('/ZEROFILL/i', $column['Type']);
|
||||
}
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars($type) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
if (!isset($column['Default'])) {
|
||||
if ($column['Null'] != 'NO') {
|
||||
$column['Default'] = 'NULL';
|
||||
} else {
|
||||
$column['Default'] = '';
|
||||
$have_rel = false;
|
||||
}
|
||||
} else {
|
||||
$column['Default'] = $column['Default'];
|
||||
}
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars(($column['Null'] == '' || $column['Null'] == 'NO') ? __('No') : __('Yes')) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars($column['Default']) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
$have_rel = false;
|
||||
} // end if
|
||||
|
||||
/**
|
||||
* Displays the table structure
|
||||
*/
|
||||
$GLOBALS['odt_buffer'] .= '<table:table table:name="' . htmlspecialchars($table) . '_data">';
|
||||
$columns_cnt = 4;
|
||||
if ($do_relation && $have_rel) {
|
||||
if (isset($res_rel[$field_name])) {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')') . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
}
|
||||
$columns_cnt++;
|
||||
}
|
||||
if ($do_comments) {
|
||||
if (isset($comments[$field_name])) {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars($comments[$field_name]) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
} else {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p></text:p>'
|
||||
. '</table:table-cell>';
|
||||
}
|
||||
$columns_cnt++;
|
||||
}
|
||||
if ($do_mime && $cfgRelation['mimework']) {
|
||||
if (isset($mime_map[$field_name])) {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars(str_replace('_', '/', $mime_map[$field_name]['mimetype'])) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
} else {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p></text:p>'
|
||||
. '</table:table-cell>';
|
||||
}
|
||||
$columns_cnt++;
|
||||
}
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-column table:number-columns-repeated="' . $columns_cnt . '"/>';
|
||||
/* Header */
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-row>';
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars(__('Column')) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars(__('Type')) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars(__('Null')) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars(__('Default')) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
if ($do_relation && $have_rel) {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars(__('Links to')) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
}
|
||||
if ($do_comments) {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars(__('Comments')) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
$comments = PMA_getComments($db, $table);
|
||||
}
|
||||
if ($do_mime && $cfgRelation['mimework']) {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars(__('MIME type')) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
$mime_map = PMA_getMIME($db, $table, true);
|
||||
}
|
||||
$GLOBALS['odt_buffer'] .= '</table:table-row>';
|
||||
} // end while
|
||||
|
||||
$GLOBALS['odt_buffer'] .= '</table:table>';
|
||||
return true;
|
||||
} // end of the 'PMA_exportStructure' function
|
||||
$columns = PMA_DBI_get_columns($db, $table);
|
||||
foreach ($columns as $column) {
|
||||
|
||||
$field_name = $column['Field'];
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-row>';
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars($field_name) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
// reformat mysql query output
|
||||
// set or enum types: slashes single quotes inside options
|
||||
$type = $column['Type'];
|
||||
if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) {
|
||||
$tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1);
|
||||
$type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
|
||||
$type_nowrap = '';
|
||||
|
||||
$binary = 0;
|
||||
$unsigned = 0;
|
||||
$zerofill = 0;
|
||||
} else {
|
||||
$type_nowrap = ' nowrap="nowrap"';
|
||||
$type = preg_replace('/BINARY/i', '', $type);
|
||||
$type = preg_replace('/ZEROFILL/i', '', $type);
|
||||
$type = preg_replace('/UNSIGNED/i', '', $type);
|
||||
if (empty($type)) {
|
||||
$type = ' ';
|
||||
}
|
||||
|
||||
$binary = preg_match('/BINARY/i', $column['Type']);
|
||||
$unsigned = preg_match('/UNSIGNED/i', $column['Type']);
|
||||
$zerofill = preg_match('/ZEROFILL/i', $column['Type']);
|
||||
}
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars($type) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
if (!isset($column['Default'])) {
|
||||
if ($column['Null'] != 'NO') {
|
||||
$column['Default'] = 'NULL';
|
||||
} else {
|
||||
$column['Default'] = '';
|
||||
}
|
||||
} else {
|
||||
$column['Default'] = $column['Default'];
|
||||
}
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars(($column['Null'] == '' || $column['Null'] == 'NO') ? __('No') : __('Yes')) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars($column['Default']) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
|
||||
if ($do_relation && $have_rel) {
|
||||
if (isset($res_rel[$field_name])) {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')') . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
}
|
||||
}
|
||||
if ($do_comments) {
|
||||
if (isset($comments[$field_name])) {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars($comments[$field_name]) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
} else {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p></text:p>'
|
||||
. '</table:table-cell>';
|
||||
}
|
||||
}
|
||||
if ($do_mime && $cfgRelation['mimework']) {
|
||||
if (isset($mime_map[$field_name])) {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars(str_replace('_', '/', $mime_map[$field_name]['mimetype'])) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
} else {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p></text:p>'
|
||||
. '</table:table-cell>';
|
||||
}
|
||||
}
|
||||
$GLOBALS['odt_buffer'] .= '</table:table-row>';
|
||||
} // end while
|
||||
|
||||
$GLOBALS['odt_buffer'] .= '</table:table>';
|
||||
return true;
|
||||
} // end of the 'PMA_exportStructure' function
|
||||
|
||||
} // end else
|
||||
?>
|
||||
|
||||
@ -30,441 +30,441 @@ if (isset($plugin_list)) {
|
||||
);
|
||||
} else {
|
||||
|
||||
/**
|
||||
* Font used in PDF.
|
||||
*
|
||||
* @todo Make this configuratble (at least Sans/Serif).
|
||||
*/
|
||||
define('PMA_PDF_FONT', 'DejaVuSans');
|
||||
require_once './libraries/tcpdf/tcpdf.php';
|
||||
/**
|
||||
* Font used in PDF.
|
||||
*
|
||||
* @todo Make this configuratble (at least Sans/Serif).
|
||||
*/
|
||||
define('PMA_PDF_FONT', 'DejaVuSans');
|
||||
require_once './libraries/tcpdf/tcpdf.php';
|
||||
|
||||
/**
|
||||
* Adapted from a LGPL script by Philip Clarke
|
||||
* @package phpMyAdmin-Export
|
||||
* @subpackage PDF
|
||||
*/
|
||||
class PMA_PDF extends TCPDF
|
||||
{
|
||||
var $tablewidths;
|
||||
var $headerset;
|
||||
var $footerset;
|
||||
/**
|
||||
* Adapted from a LGPL script by Philip Clarke
|
||||
* @package phpMyAdmin-Export
|
||||
* @subpackage PDF
|
||||
*/
|
||||
class PMA_PDF extends TCPDF
|
||||
{
|
||||
var $tablewidths;
|
||||
var $headerset;
|
||||
var $footerset;
|
||||
|
||||
function checkPageBreak($h=0, $y='', $addpage=true) {
|
||||
if ($this->empty_string($y)) {
|
||||
$y = $this->y;
|
||||
}
|
||||
$current_page = $this->page;
|
||||
if ((($y + $h) > $this->PageBreakTrigger) AND (!$this->InFooter) AND ($this->AcceptPageBreak())) {
|
||||
if ($addpage) {
|
||||
//Automatic page break
|
||||
$x = $this->x;
|
||||
$this->AddPage($this->CurOrientation);
|
||||
$this->y = $this->dataY;
|
||||
$oldpage = $this->page - 1;
|
||||
if ($this->rtl) {
|
||||
if ($this->pagedim[$this->page]['orm'] != $this->pagedim[$oldpage]['orm']) {
|
||||
$this->x = $x - ($this->pagedim[$this->page]['orm'] - $this->pagedim[$oldpage]['orm']);
|
||||
function checkPageBreak($h=0, $y='', $addpage=true) {
|
||||
if ($this->empty_string($y)) {
|
||||
$y = $this->y;
|
||||
}
|
||||
$current_page = $this->page;
|
||||
if ((($y + $h) > $this->PageBreakTrigger) AND (!$this->InFooter) AND ($this->AcceptPageBreak())) {
|
||||
if ($addpage) {
|
||||
//Automatic page break
|
||||
$x = $this->x;
|
||||
$this->AddPage($this->CurOrientation);
|
||||
$this->y = $this->dataY;
|
||||
$oldpage = $this->page - 1;
|
||||
if ($this->rtl) {
|
||||
if ($this->pagedim[$this->page]['orm'] != $this->pagedim[$oldpage]['orm']) {
|
||||
$this->x = $x - ($this->pagedim[$this->page]['orm'] - $this->pagedim[$oldpage]['orm']);
|
||||
} else {
|
||||
$this->x = $x;
|
||||
}
|
||||
} else {
|
||||
$this->x = $x;
|
||||
}
|
||||
} else {
|
||||
if ($this->pagedim[$this->page]['olm'] != $this->pagedim[$oldpage]['olm']) {
|
||||
$this->x = $x + ($this->pagedim[$this->page]['olm'] - $this->pagedim[$oldpage]['olm']);
|
||||
} else {
|
||||
$this->x = $x;
|
||||
if ($this->pagedim[$this->page]['olm'] != $this->pagedim[$oldpage]['olm']) {
|
||||
$this->x = $x + ($this->pagedim[$this->page]['olm'] - $this->pagedim[$oldpage]['olm']);
|
||||
} else {
|
||||
$this->x = $x;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
if ($current_page != $this->page) {
|
||||
// account for columns mode
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if ($current_page != $this->page) {
|
||||
// account for columns mode
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function Header()
|
||||
{
|
||||
global $maxY;
|
||||
// Check if header for this page already exists
|
||||
if (!isset($this->headerset[$this->page])) {
|
||||
function Header()
|
||||
{
|
||||
global $maxY;
|
||||
// Check if header for this page already exists
|
||||
if (!isset($this->headerset[$this->page])) {
|
||||
$fullwidth = 0;
|
||||
foreach ($this->tablewidths as $width) {
|
||||
$fullwidth += $width;
|
||||
}
|
||||
$this->SetY(($this->tMargin) - ($this->FontSizePt/$this->k)*3);
|
||||
$this->cellFontSize = $this->FontSizePt ;
|
||||
$this->SetFont(PMA_PDF_FONT, '', ($this->titleFontSize ? $this->titleFontSize : $this->FontSizePt));
|
||||
$this->Cell(0, $this->FontSizePt, $this->titleText, 0, 1, 'C');
|
||||
$this->SetFont(PMA_PDF_FONT, '', $this->cellFontSize);
|
||||
$this->SetY(($this->tMargin) - ($this->FontSizePt/$this->k)*1.5);
|
||||
$this->Cell(0, $this->FontSizePt, __('Database') .': ' .$this->currentDb .', ' .__('Table') .': ' .$this->currentTable, 0, 1, 'L');
|
||||
$l = ($this->lMargin);
|
||||
foreach ($this->colTitles as $col => $txt) {
|
||||
$this->SetXY($l, ($this->tMargin));
|
||||
$this->MultiCell($this->tablewidths[$col], $this->FontSizePt, $txt);
|
||||
$l += $this->tablewidths[$col] ;
|
||||
$maxY = ($maxY < $this->getY()) ? $this->getY() : $maxY ;
|
||||
}
|
||||
$this->SetXY($this->lMargin, $this->tMargin);
|
||||
$this->setFillColor(200, 200, 200);
|
||||
$l = ($this->lMargin);
|
||||
foreach ($this->colTitles as $col => $txt) {
|
||||
$this->SetXY($l, $this->tMargin);
|
||||
$this->cell($this->tablewidths[$col], $maxY-($this->tMargin), '', 1, 0, 'L', 1);
|
||||
$this->SetXY($l, $this->tMargin);
|
||||
$this->MultiCell($this->tablewidths[$col], $this->FontSizePt, $txt, 0, 'C');
|
||||
$l += $this->tablewidths[$col];
|
||||
}
|
||||
$this->setFillColor(255, 255, 255);
|
||||
// set headerset
|
||||
$this->headerset[$this->page] = 1;
|
||||
}
|
||||
|
||||
$this->dataY = $maxY;
|
||||
}
|
||||
|
||||
function Footer()
|
||||
{
|
||||
// Check if footer for this page already exists
|
||||
if (!isset($this->footerset[$this->page])) {
|
||||
$this->SetY(-15);
|
||||
//Page number
|
||||
$this->setFooterFont(PMA_PDF_FONT, '', 14);
|
||||
$this->Cell(0, 6, __('Page number:') . ' ' . $this->getAliasNumPage() . '/' . $this->getAliasNbPages(), 'T', 0, 'C');
|
||||
|
||||
// set footerset
|
||||
$this->footerset[$this->page] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
function morepagestable($lineheight=8)
|
||||
{
|
||||
// some things to set and 'remember'
|
||||
$l = $this->lMargin;
|
||||
$startheight = $h = $this->dataY;
|
||||
$startpage = $currpage = $this->page;
|
||||
|
||||
// calculate the whole width
|
||||
$fullwidth = 0;
|
||||
foreach ($this->tablewidths as $width) {
|
||||
$fullwidth += $width;
|
||||
}
|
||||
$this->SetY(($this->tMargin) - ($this->FontSizePt/$this->k)*3);
|
||||
$this->cellFontSize = $this->FontSizePt ;
|
||||
$this->SetFont(PMA_PDF_FONT, '', ($this->titleFontSize ? $this->titleFontSize : $this->FontSizePt));
|
||||
$this->Cell(0, $this->FontSizePt, $this->titleText, 0, 1, 'C');
|
||||
$this->SetFont(PMA_PDF_FONT, '', $this->cellFontSize);
|
||||
$this->SetY(($this->tMargin) - ($this->FontSizePt/$this->k)*1.5);
|
||||
$this->Cell(0, $this->FontSizePt, __('Database') .': ' .$this->currentDb .', ' .__('Table') .': ' .$this->currentTable, 0, 1, 'L');
|
||||
$l = ($this->lMargin);
|
||||
foreach ($this->colTitles as $col => $txt) {
|
||||
$this->SetXY($l, ($this->tMargin));
|
||||
$this->MultiCell($this->tablewidths[$col], $this->FontSizePt, $txt);
|
||||
$l += $this->tablewidths[$col] ;
|
||||
$maxY = ($maxY < $this->getY()) ? $this->getY() : $maxY ;
|
||||
}
|
||||
$this->SetXY($this->lMargin, $this->tMargin);
|
||||
$this->setFillColor(200, 200, 200);
|
||||
$l = ($this->lMargin);
|
||||
foreach ($this->colTitles as $col => $txt) {
|
||||
$this->SetXY($l, $this->tMargin);
|
||||
$this->cell($this->tablewidths[$col], $maxY-($this->tMargin), '', 1, 0, 'L', 1);
|
||||
$this->SetXY($l, $this->tMargin);
|
||||
$this->MultiCell($this->tablewidths[$col], $this->FontSizePt, $txt, 0, 'C');
|
||||
$l += $this->tablewidths[$col];
|
||||
}
|
||||
$this->setFillColor(255, 255, 255);
|
||||
// set headerset
|
||||
$this->headerset[$this->page] = 1;
|
||||
}
|
||||
|
||||
$this->dataY = $maxY;
|
||||
}
|
||||
// Now let's start to write the table
|
||||
$row = 0;
|
||||
$tmpheight = array();
|
||||
$maxpage = $this->page;
|
||||
|
||||
function Footer()
|
||||
{
|
||||
// Check if footer for this page already exists
|
||||
if (!isset($this->footerset[$this->page])) {
|
||||
$this->SetY(-15);
|
||||
//Page number
|
||||
$this->setFooterFont(PMA_PDF_FONT, '', 14);
|
||||
$this->Cell(0, 6, __('Page number:') . ' ' . $this->getAliasNumPage() . '/' . $this->getAliasNbPages(), 'T', 0, 'C');
|
||||
|
||||
// set footerset
|
||||
$this->footerset[$this->page] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
function morepagestable($lineheight=8)
|
||||
{
|
||||
// some things to set and 'remember'
|
||||
$l = $this->lMargin;
|
||||
$startheight = $h = $this->dataY;
|
||||
$startpage = $currpage = $this->page;
|
||||
|
||||
// calculate the whole width
|
||||
$fullwidth = 0;
|
||||
foreach ($this->tablewidths as $width) {
|
||||
$fullwidth += $width;
|
||||
}
|
||||
|
||||
// Now let's start to write the table
|
||||
$row = 0;
|
||||
$tmpheight = array();
|
||||
$maxpage = $this->page;
|
||||
|
||||
while ($data = PMA_DBI_fetch_row($this->results)) {
|
||||
$this->page = $currpage;
|
||||
// write the horizontal borders
|
||||
$this->Line($l, $h, $fullwidth+$l, $h);
|
||||
// write the content and remember the height of the highest col
|
||||
foreach ($data as $col => $txt) {
|
||||
while ($data = PMA_DBI_fetch_row($this->results)) {
|
||||
$this->page = $currpage;
|
||||
$this->SetXY($l, $h);
|
||||
if ($this->tablewidths[$col] > 0) {
|
||||
$this->MultiCell($this->tablewidths[$col], $lineheight, $txt, 0, $this->colAlign[$col]);
|
||||
$l += $this->tablewidths[$col];
|
||||
// write the horizontal borders
|
||||
$this->Line($l, $h, $fullwidth+$l, $h);
|
||||
// write the content and remember the height of the highest col
|
||||
foreach ($data as $col => $txt) {
|
||||
$this->page = $currpage;
|
||||
$this->SetXY($l, $h);
|
||||
if ($this->tablewidths[$col] > 0) {
|
||||
$this->MultiCell($this->tablewidths[$col], $lineheight, $txt, 0, $this->colAlign[$col]);
|
||||
$l += $this->tablewidths[$col];
|
||||
}
|
||||
|
||||
if (!isset($tmpheight[$row.'-'.$this->page])) {
|
||||
$tmpheight[$row.'-'.$this->page] = 0;
|
||||
}
|
||||
if ($tmpheight[$row.'-'.$this->page] < $this->GetY()) {
|
||||
$tmpheight[$row.'-'.$this->page] = $this->GetY();
|
||||
}
|
||||
if ($this->page > $maxpage) {
|
||||
$maxpage = $this->page;
|
||||
}
|
||||
unset($data[$col]);
|
||||
}
|
||||
|
||||
if (!isset($tmpheight[$row.'-'.$this->page])) {
|
||||
$tmpheight[$row.'-'.$this->page] = 0;
|
||||
}
|
||||
if ($tmpheight[$row.'-'.$this->page] < $this->GetY()) {
|
||||
$tmpheight[$row.'-'.$this->page] = $this->GetY();
|
||||
}
|
||||
if ($this->page > $maxpage) {
|
||||
$maxpage = $this->page;
|
||||
}
|
||||
unset($data[$col]);
|
||||
// get the height we were in the last used page
|
||||
$h = $tmpheight[$row.'-'.$maxpage];
|
||||
// set the "pointer" to the left margin
|
||||
$l = $this->lMargin;
|
||||
// set the $currpage to the last page
|
||||
$currpage = $maxpage;
|
||||
unset($data[$row]);
|
||||
$row++;
|
||||
}
|
||||
|
||||
// get the height we were in the last used page
|
||||
$h = $tmpheight[$row.'-'.$maxpage];
|
||||
// set the "pointer" to the left margin
|
||||
$l = $this->lMargin;
|
||||
// set the $currpage to the last page
|
||||
$currpage = $maxpage;
|
||||
unset($data[$row]);
|
||||
$row++;
|
||||
}
|
||||
// draw the borders
|
||||
// we start adding a horizontal line on the last page
|
||||
$this->page = $maxpage;
|
||||
$this->Line($l, $h, $fullwidth+$l, $h);
|
||||
// now we start at the top of the document and walk down
|
||||
for ($i = $startpage; $i <= $maxpage; $i++) {
|
||||
$this->page = $i;
|
||||
$l = $this->lMargin;
|
||||
$t = ($i == $startpage) ? $startheight : $this->tMargin;
|
||||
$lh = ($i == $maxpage) ? $h : $this->h-$this->bMargin;
|
||||
$this->Line($l, $t, $l, $lh);
|
||||
foreach ($this->tablewidths as $width) {
|
||||
$l += $width;
|
||||
// draw the borders
|
||||
// we start adding a horizontal line on the last page
|
||||
$this->page = $maxpage;
|
||||
$this->Line($l, $h, $fullwidth+$l, $h);
|
||||
// now we start at the top of the document and walk down
|
||||
for ($i = $startpage; $i <= $maxpage; $i++) {
|
||||
$this->page = $i;
|
||||
$l = $this->lMargin;
|
||||
$t = ($i == $startpage) ? $startheight : $this->tMargin;
|
||||
$lh = ($i == $maxpage) ? $h : $this->h-$this->bMargin;
|
||||
$this->Line($l, $t, $l, $lh);
|
||||
}
|
||||
}
|
||||
// set it to the last page, if not it'll cause some problems
|
||||
$this->page = $maxpage;
|
||||
}
|
||||
|
||||
function setAttributes($attr = array())
|
||||
{
|
||||
foreach ($attr as $key => $val) {
|
||||
$this->$key = $val ;
|
||||
}
|
||||
}
|
||||
|
||||
function setTopMargin($topMargin)
|
||||
{
|
||||
$this->tMargin = $topMargin;
|
||||
}
|
||||
|
||||
function mysql_report($query)
|
||||
{
|
||||
unset($this->tablewidths);
|
||||
unset($this->colTitles);
|
||||
unset($this->titleWidth);
|
||||
unset($this->colFits);
|
||||
unset($this->display_column);
|
||||
unset($this->colAlign);
|
||||
|
||||
/**
|
||||
* Pass 1 for column widths
|
||||
*/
|
||||
$this->results = PMA_DBI_query($query, null, PMA_DBI_QUERY_UNBUFFERED);
|
||||
$this->numFields = PMA_DBI_num_fields($this->results);
|
||||
$this->fields = PMA_DBI_get_fields_meta($this->results);
|
||||
|
||||
// sColWidth = starting col width (an average size width)
|
||||
$availableWidth = $this->w - $this->lMargin - $this->rMargin;
|
||||
$this->sColWidth = $availableWidth / $this->numFields;
|
||||
$totalTitleWidth = 0;
|
||||
|
||||
// loop through results header and set initial col widths/ titles/ alignment
|
||||
// if a col title is less than the starting col width, reduce that column size
|
||||
for ($i = 0; $i < $this->numFields; $i++) {
|
||||
$stringWidth = $this->getstringwidth($this->fields[$i]->name) + 6 ;
|
||||
// save the real title's width
|
||||
$titleWidth[$i] = $stringWidth;
|
||||
$totalTitleWidth += $stringWidth;
|
||||
|
||||
// set any column titles less than the start width to the column title width
|
||||
if ($stringWidth < $this->sColWidth) {
|
||||
$colFits[$i] = $stringWidth ;
|
||||
}
|
||||
$this->colTitles[$i] = $this->fields[$i]->name;
|
||||
$this->display_column[$i] = true;
|
||||
|
||||
switch ($this->fields[$i]->type) {
|
||||
case 'int':
|
||||
$this->colAlign[$i] = 'R';
|
||||
break;
|
||||
case 'blob':
|
||||
case 'tinyblob':
|
||||
case 'mediumblob':
|
||||
case 'longblob':
|
||||
/**
|
||||
* @todo do not deactivate completely the display
|
||||
* but show the field's name and [BLOB]
|
||||
*/
|
||||
if (stristr($this->fields[$i]->flags, 'BINARY')) {
|
||||
$this->display_column[$i] = false;
|
||||
unset($this->colTitles[$i]);
|
||||
foreach ($this->tablewidths as $width) {
|
||||
$l += $width;
|
||||
$this->Line($l, $t, $l, $lh);
|
||||
}
|
||||
$this->colAlign[$i] = 'L';
|
||||
break;
|
||||
default:
|
||||
$this->colAlign[$i] = 'L';
|
||||
}
|
||||
// set it to the last page, if not it'll cause some problems
|
||||
$this->page = $maxpage;
|
||||
}
|
||||
|
||||
function setAttributes($attr = array())
|
||||
{
|
||||
foreach ($attr as $key => $val) {
|
||||
$this->$key = $val ;
|
||||
}
|
||||
}
|
||||
|
||||
// title width verification
|
||||
if ($totalTitleWidth > $availableWidth) {
|
||||
$adjustingMode = true;
|
||||
} else {
|
||||
$adjustingMode = false;
|
||||
// we have enough space for all the titles at their
|
||||
// original width so use the true title's width
|
||||
foreach ($titleWidth as $key => $val) {
|
||||
$colFits[$key] = $val;
|
||||
}
|
||||
function setTopMargin($topMargin)
|
||||
{
|
||||
$this->tMargin = $topMargin;
|
||||
}
|
||||
|
||||
// loop through the data; any column whose contents
|
||||
// is greater than the column size is resized
|
||||
/**
|
||||
* @todo force here a LIMIT to avoid reading all rows
|
||||
*/
|
||||
while ($row = PMA_DBI_fetch_row($this->results)) {
|
||||
foreach ($colFits as $key => $val) {
|
||||
$stringWidth = $this->getstringwidth($row[$key]) + 6 ;
|
||||
if ($adjustingMode && ($stringWidth > $this->sColWidth)) {
|
||||
// any column whose data's width is bigger than the start width is now discarded
|
||||
unset($colFits[$key]);
|
||||
} else {
|
||||
// if data's width is bigger than the current column width,
|
||||
// enlarge the column (but avoid enlarging it if the
|
||||
// data's width is very big)
|
||||
if ($stringWidth > $val && $stringWidth < ($this->sColWidth * 3)) {
|
||||
$colFits[$key] = $stringWidth ;
|
||||
function mysql_report($query)
|
||||
{
|
||||
unset($this->tablewidths);
|
||||
unset($this->colTitles);
|
||||
unset($this->titleWidth);
|
||||
unset($this->colFits);
|
||||
unset($this->display_column);
|
||||
unset($this->colAlign);
|
||||
|
||||
/**
|
||||
* Pass 1 for column widths
|
||||
*/
|
||||
$this->results = PMA_DBI_query($query, null, PMA_DBI_QUERY_UNBUFFERED);
|
||||
$this->numFields = PMA_DBI_num_fields($this->results);
|
||||
$this->fields = PMA_DBI_get_fields_meta($this->results);
|
||||
|
||||
// sColWidth = starting col width (an average size width)
|
||||
$availableWidth = $this->w - $this->lMargin - $this->rMargin;
|
||||
$this->sColWidth = $availableWidth / $this->numFields;
|
||||
$totalTitleWidth = 0;
|
||||
|
||||
// loop through results header and set initial col widths/ titles/ alignment
|
||||
// if a col title is less than the starting col width, reduce that column size
|
||||
for ($i = 0; $i < $this->numFields; $i++) {
|
||||
$stringWidth = $this->getstringwidth($this->fields[$i]->name) + 6 ;
|
||||
// save the real title's width
|
||||
$titleWidth[$i] = $stringWidth;
|
||||
$totalTitleWidth += $stringWidth;
|
||||
|
||||
// set any column titles less than the start width to the column title width
|
||||
if ($stringWidth < $this->sColWidth) {
|
||||
$colFits[$i] = $stringWidth ;
|
||||
}
|
||||
$this->colTitles[$i] = $this->fields[$i]->name;
|
||||
$this->display_column[$i] = true;
|
||||
|
||||
switch ($this->fields[$i]->type) {
|
||||
case 'int':
|
||||
$this->colAlign[$i] = 'R';
|
||||
break;
|
||||
case 'blob':
|
||||
case 'tinyblob':
|
||||
case 'mediumblob':
|
||||
case 'longblob':
|
||||
/**
|
||||
* @todo do not deactivate completely the display
|
||||
* but show the field's name and [BLOB]
|
||||
*/
|
||||
if (stristr($this->fields[$i]->flags, 'BINARY')) {
|
||||
$this->display_column[$i] = false;
|
||||
unset($this->colTitles[$i]);
|
||||
}
|
||||
$this->colAlign[$i] = 'L';
|
||||
break;
|
||||
default:
|
||||
$this->colAlign[$i] = 'L';
|
||||
}
|
||||
}
|
||||
|
||||
// title width verification
|
||||
if ($totalTitleWidth > $availableWidth) {
|
||||
$adjustingMode = true;
|
||||
} else {
|
||||
$adjustingMode = false;
|
||||
// we have enough space for all the titles at their
|
||||
// original width so use the true title's width
|
||||
foreach ($titleWidth as $key => $val) {
|
||||
$colFits[$key] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
// loop through the data; any column whose contents
|
||||
// is greater than the column size is resized
|
||||
/**
|
||||
* @todo force here a LIMIT to avoid reading all rows
|
||||
*/
|
||||
while ($row = PMA_DBI_fetch_row($this->results)) {
|
||||
foreach ($colFits as $key => $val) {
|
||||
$stringWidth = $this->getstringwidth($row[$key]) + 6 ;
|
||||
if ($adjustingMode && ($stringWidth > $this->sColWidth)) {
|
||||
// any column whose data's width is bigger than the start width is now discarded
|
||||
unset($colFits[$key]);
|
||||
} else {
|
||||
// if data's width is bigger than the current column width,
|
||||
// enlarge the column (but avoid enlarging it if the
|
||||
// data's width is very big)
|
||||
if ($stringWidth > $val && $stringWidth < ($this->sColWidth * 3)) {
|
||||
$colFits[$key] = $stringWidth ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$totAlreadyFitted = 0;
|
||||
foreach ($colFits as $key => $val) {
|
||||
// set fitted columns to smallest size
|
||||
$this->tablewidths[$key] = $val;
|
||||
// to work out how much (if any) space has been freed up
|
||||
$totAlreadyFitted += $val;
|
||||
}
|
||||
|
||||
if ($adjustingMode) {
|
||||
$surplus = (sizeof($colFits) * $this->sColWidth) - $totAlreadyFitted;
|
||||
$surplusToAdd = $surplus / ($this->numFields - sizeof($colFits));
|
||||
} else {
|
||||
$surplusToAdd = 0;
|
||||
}
|
||||
|
||||
for ($i=0; $i < $this->numFields; $i++) {
|
||||
if (!in_array($i, array_keys($colFits))) {
|
||||
$this->tablewidths[$i] = $this->sColWidth + $surplusToAdd;
|
||||
$totAlreadyFitted = 0;
|
||||
foreach ($colFits as $key => $val) {
|
||||
// set fitted columns to smallest size
|
||||
$this->tablewidths[$key] = $val;
|
||||
// to work out how much (if any) space has been freed up
|
||||
$totAlreadyFitted += $val;
|
||||
}
|
||||
if ($this->display_column[$i] == false) {
|
||||
$this->tablewidths[$i] = 0;
|
||||
|
||||
if ($adjustingMode) {
|
||||
$surplus = (sizeof($colFits) * $this->sColWidth) - $totAlreadyFitted;
|
||||
$surplusToAdd = $surplus / ($this->numFields - sizeof($colFits));
|
||||
} else {
|
||||
$surplusToAdd = 0;
|
||||
}
|
||||
|
||||
for ($i=0; $i < $this->numFields; $i++) {
|
||||
if (!in_array($i, array_keys($colFits))) {
|
||||
$this->tablewidths[$i] = $this->sColWidth + $surplusToAdd;
|
||||
}
|
||||
if ($this->display_column[$i] == false) {
|
||||
$this->tablewidths[$i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
ksort($this->tablewidths);
|
||||
|
||||
PMA_DBI_free_result($this->results);
|
||||
|
||||
// Pass 2
|
||||
|
||||
$this->results = PMA_DBI_query($query, null, PMA_DBI_QUERY_UNBUFFERED);
|
||||
$this->setY($this->tMargin);
|
||||
$this->AddPage();
|
||||
$this->morepagestable($this->FontSizePt);
|
||||
PMA_DBI_free_result($this->results);
|
||||
|
||||
} // end of mysql_report function
|
||||
|
||||
} // end of PMA_PDF class
|
||||
|
||||
$pdf = new PMA_PDF('L', 'pt', 'A3');
|
||||
|
||||
/**
|
||||
* Finalize the pdf.
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter()
|
||||
{
|
||||
global $pdf;
|
||||
|
||||
// instead of $pdf->Output():
|
||||
if (!PMA_exportOutputHandler($pdf->getPDFData())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ksort($this->tablewidths);
|
||||
|
||||
PMA_DBI_free_result($this->results);
|
||||
|
||||
// Pass 2
|
||||
|
||||
$this->results = PMA_DBI_query($query, null, PMA_DBI_QUERY_UNBUFFERED);
|
||||
$this->setY($this->tMargin);
|
||||
$this->AddPage();
|
||||
$this->morepagestable($this->FontSizePt);
|
||||
PMA_DBI_free_result($this->results);
|
||||
|
||||
} // end of mysql_report function
|
||||
|
||||
} // end of PMA_PDF class
|
||||
|
||||
$pdf = new PMA_PDF('L', 'pt', 'A3');
|
||||
|
||||
/**
|
||||
* Finalize the pdf.
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter()
|
||||
{
|
||||
global $pdf;
|
||||
|
||||
// instead of $pdf->Output():
|
||||
if (!PMA_exportOutputHandler($pdf->getPDFData())) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Initialize the pdf to export data.
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader()
|
||||
{
|
||||
global $pdf_report_title;
|
||||
global $pdf;
|
||||
|
||||
/**
|
||||
* Initialize the pdf to export data.
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader()
|
||||
{
|
||||
global $pdf_report_title;
|
||||
global $pdf;
|
||||
$pdf->AddFont('DejaVuSans', '', 'dejavusans.php');
|
||||
$pdf->AddFont('DejaVuSans', 'B', 'dejavusansb.php');
|
||||
$pdf->AddFont('DejaVuSerif', '', 'dejavuserif.php');
|
||||
$pdf->AddFont('DejaVuSerif', 'B', 'dejavuserifb.php');
|
||||
$pdf->SetFont(PMA_PDF_FONT, '', 11.5);
|
||||
$pdf->setFooterFont(array(PMA_PDF_FONT, '', 11.5));
|
||||
$pdf->AliasNbPages();
|
||||
$pdf->Open();
|
||||
|
||||
$pdf->AddFont('DejaVuSans', '', 'dejavusans.php');
|
||||
$pdf->AddFont('DejaVuSans', 'B', 'dejavusansb.php');
|
||||
$pdf->AddFont('DejaVuSerif', '', 'dejavuserif.php');
|
||||
$pdf->AddFont('DejaVuSerif', 'B', 'dejavuserifb.php');
|
||||
$pdf->SetFont(PMA_PDF_FONT, '', 11.5);
|
||||
$pdf->setFooterFont(array(PMA_PDF_FONT, '', 11.5));
|
||||
$pdf->AliasNbPages();
|
||||
$pdf->Open();
|
||||
$attr=array('titleFontSize' => 18, 'titleText' => $pdf_report_title);
|
||||
$pdf->setAttributes($attr);
|
||||
$pdf->setTopMargin(45);
|
||||
|
||||
$attr=array('titleFontSize' => 18, 'titleText' => $pdf_report_title);
|
||||
$pdf->setAttributes($attr);
|
||||
$pdf->setTopMargin(45);
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Outputs the content of a table in PDF format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
{
|
||||
global $pdf;
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in PDF format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
{
|
||||
global $pdf;
|
||||
$attr=array('currentDb' => $db, 'currentTable' => $table);
|
||||
$pdf->setAttributes($attr);
|
||||
$pdf->mysql_report($sql_query);
|
||||
|
||||
$attr=array('currentDb' => $db, 'currentTable' => $table);
|
||||
$pdf->setAttributes($attr);
|
||||
$pdf->mysql_report($sql_query);
|
||||
|
||||
return true;
|
||||
} // end of the 'PMA_exportData()' function
|
||||
return true;
|
||||
} // end of the 'PMA_exportData()' function
|
||||
}
|
||||
?>
|
||||
|
||||
@ -30,134 +30,134 @@ if (isset($plugin_list)) {
|
||||
);
|
||||
} else {
|
||||
|
||||
/**
|
||||
* Set of functions used to build exports of tables
|
||||
*/
|
||||
/**
|
||||
* Set of functions used to build exports of tables
|
||||
*/
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export header
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader()
|
||||
{
|
||||
PMA_exportOutputHandler(
|
||||
'<?php' . $GLOBALS['crlf']
|
||||
. '/**' . $GLOBALS['crlf']
|
||||
. ' * Export to PHP Array plugin for PHPMyAdmin' . $GLOBALS['crlf']
|
||||
. ' * @version 0.2b' . $GLOBALS['crlf']
|
||||
. ' */' . $GLOBALS['crlf'] . $GLOBALS['crlf']
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db)
|
||||
{
|
||||
PMA_exportOutputHandler('//' . $GLOBALS['crlf'] . '// Database "' . $db . '"' . $GLOBALS['crlf'] . '//' . $GLOBALS['crlf']);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table as a fragment of PHP code
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
{
|
||||
$result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
|
||||
|
||||
$columns_cnt = PMA_DBI_num_fields($result);
|
||||
for ($i = 0; $i < $columns_cnt; $i++) {
|
||||
$columns[$i] = stripslashes(PMA_DBI_field_name($result, $i));
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
unset($i);
|
||||
|
||||
$buffer = '';
|
||||
$record_cnt = 0;
|
||||
while ($record = PMA_DBI_fetch_row($result)) {
|
||||
/**
|
||||
* Outputs export header
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader()
|
||||
{
|
||||
PMA_exportOutputHandler(
|
||||
'<?php' . $GLOBALS['crlf']
|
||||
. '/**' . $GLOBALS['crlf']
|
||||
. ' * Export to PHP Array plugin for PHPMyAdmin' . $GLOBALS['crlf']
|
||||
. ' * @version 0.2b' . $GLOBALS['crlf']
|
||||
. ' */' . $GLOBALS['crlf'] . $GLOBALS['crlf']
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
$record_cnt++;
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db)
|
||||
{
|
||||
PMA_exportOutputHandler('//' . $GLOBALS['crlf'] . '// Database "' . $db . '"' . $GLOBALS['crlf'] . '//' . $GLOBALS['crlf']);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Output table name as comment if this is the first record of the table
|
||||
if ($record_cnt == 1) {
|
||||
$buffer .= $crlf . '// ' . $db . '.' . $table . $crlf;
|
||||
$buffer .= '$' . $table . ' = array(' . $crlf;
|
||||
$buffer .= ' array(';
|
||||
} else {
|
||||
$buffer .= ',' . $crlf . ' array(';
|
||||
}
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table as a fragment of PHP code
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
{
|
||||
$result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
|
||||
|
||||
$columns_cnt = PMA_DBI_num_fields($result);
|
||||
for ($i = 0; $i < $columns_cnt; $i++) {
|
||||
$buffer .= "'" . $columns[$i]. "'=>" . var_export($record[$i], true) . (($i + 1 >= $columns_cnt) ? '' : ',');
|
||||
$columns[$i] = stripslashes(PMA_DBI_field_name($result, $i));
|
||||
}
|
||||
unset($i);
|
||||
|
||||
$buffer = '';
|
||||
$record_cnt = 0;
|
||||
while ($record = PMA_DBI_fetch_row($result)) {
|
||||
|
||||
$record_cnt++;
|
||||
|
||||
// Output table name as comment if this is the first record of the table
|
||||
if ($record_cnt == 1) {
|
||||
$buffer .= $crlf . '// ' . $db . '.' . $table . $crlf;
|
||||
$buffer .= '$' . $table . ' = array(' . $crlf;
|
||||
$buffer .= ' array(';
|
||||
} else {
|
||||
$buffer .= ',' . $crlf . ' array(';
|
||||
}
|
||||
|
||||
|
||||
for ($i = 0; $i < $columns_cnt; $i++) {
|
||||
$buffer .= "'" . $columns[$i]. "'=>" . var_export($record[$i], true) . (($i + 1 >= $columns_cnt) ? '' : ',');
|
||||
}
|
||||
|
||||
$buffer .= ')';
|
||||
}
|
||||
|
||||
$buffer .= ')';
|
||||
$buffer .= $crlf . ');' . $crlf;
|
||||
if (! PMA_exportOutputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PMA_DBI_free_result($result);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
$buffer .= $crlf . ');' . $crlf;
|
||||
if (! PMA_exportOutputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PMA_DBI_free_result($result);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -32,302 +32,302 @@ if (isset($plugin_list)) {
|
||||
);
|
||||
} else {
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export header
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db) {
|
||||
return PMA_exportOutputHandler('===' . __('Database') . ' ' . $db . "\n\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in Texy format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
{
|
||||
global $what;
|
||||
|
||||
if (! PMA_exportOutputHandler('== ' . __('Dumping data for table') . ' ' . $table . "\n\n")) {
|
||||
return false;
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Gets the data from the database
|
||||
$result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
|
||||
$fields_cnt = PMA_DBI_num_fields($result);
|
||||
/**
|
||||
* Outputs export header
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If required, get fields name at the first line
|
||||
if (isset($GLOBALS[$what . '_columns'])) {
|
||||
$text_output = "|------\n";
|
||||
for ($i = 0; $i < $fields_cnt; $i++) {
|
||||
$text_output .= '|' . htmlspecialchars(stripslashes(PMA_DBI_field_name($result, $i)));
|
||||
} // end for
|
||||
$text_output .= "\n|------\n";
|
||||
if (! PMA_exportOutputHandler($text_output)) {
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db) {
|
||||
return PMA_exportOutputHandler('===' . __('Database') . ' ' . $db . "\n\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in Texy format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
{
|
||||
global $what;
|
||||
|
||||
if (! PMA_exportOutputHandler('== ' . __('Dumping data for table') . ' ' . $table . "\n\n")) {
|
||||
return false;
|
||||
}
|
||||
} // end if
|
||||
|
||||
// Format the data
|
||||
while ($row = PMA_DBI_fetch_row($result)) {
|
||||
$text_output = '';
|
||||
for ($j = 0; $j < $fields_cnt; $j++) {
|
||||
if (! isset($row[$j]) || is_null($row[$j])) {
|
||||
$value = $GLOBALS[$what . '_null'];
|
||||
} elseif ($row[$j] == '0' || $row[$j] != '') {
|
||||
$value = $row[$j];
|
||||
// Gets the data from the database
|
||||
$result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
|
||||
$fields_cnt = PMA_DBI_num_fields($result);
|
||||
|
||||
// If required, get fields name at the first line
|
||||
if (isset($GLOBALS[$what . '_columns'])) {
|
||||
$text_output = "|------\n";
|
||||
for ($i = 0; $i < $fields_cnt; $i++) {
|
||||
$text_output .= '|' . htmlspecialchars(stripslashes(PMA_DBI_field_name($result, $i)));
|
||||
} // end for
|
||||
$text_output .= "\n|------\n";
|
||||
if (! PMA_exportOutputHandler($text_output)) {
|
||||
return false;
|
||||
}
|
||||
} // end if
|
||||
|
||||
// Format the data
|
||||
while ($row = PMA_DBI_fetch_row($result)) {
|
||||
$text_output = '';
|
||||
for ($j = 0; $j < $fields_cnt; $j++) {
|
||||
if (! isset($row[$j]) || is_null($row[$j])) {
|
||||
$value = $GLOBALS[$what . '_null'];
|
||||
} elseif ($row[$j] == '0' || $row[$j] != '') {
|
||||
$value = $row[$j];
|
||||
} else {
|
||||
$value = ' ';
|
||||
}
|
||||
$text_output .= '|' . htmlspecialchars($value);
|
||||
} // end for
|
||||
$text_output .= "\n";
|
||||
if (! PMA_exportOutputHandler($text_output)) {
|
||||
return false;
|
||||
}
|
||||
} // end while
|
||||
PMA_DBI_free_result($result);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs table's structure
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param bool $do_relation whether to include relation comments
|
||||
* @param bool $do_comments whether to include the pmadb-style column comments
|
||||
* as comments in the structure; this is deprecated
|
||||
* but the parameter is left here because export.php
|
||||
* calls PMA_exportStructure() also for other export
|
||||
* types which use this parameter
|
||||
* @param bool $do_mime whether to include mime comments
|
||||
* @param bool $dates whether to include creation/update/check dates
|
||||
* @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
|
||||
* @param string $export_type 'server', 'database', 'table'
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $export_mode, $export_type)
|
||||
{
|
||||
global $cfgRelation;
|
||||
|
||||
if (! PMA_exportOutputHandler('== ' . __('Table structure for table') . ' ' .$table . "\n\n")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the unique keys in the table
|
||||
*/
|
||||
$keys_query = PMA_DBI_get_table_indexes_sql($db, $table);
|
||||
$keys_result = PMA_DBI_query($keys_query);
|
||||
$unique_keys = array();
|
||||
while ($key = PMA_DBI_fetch_assoc($keys_result)) {
|
||||
if ($key['Non_unique'] == 0) {
|
||||
$unique_keys[] = $key['Column_name'];
|
||||
}
|
||||
}
|
||||
PMA_DBI_free_result($keys_result);
|
||||
|
||||
/**
|
||||
* Gets fields properties
|
||||
*/
|
||||
PMA_DBI_select_db($db);
|
||||
|
||||
// Check if we can use Relations
|
||||
if ($do_relation && ! empty($cfgRelation['relation'])) {
|
||||
// Find which tables are related with the current one and write it in
|
||||
// an array
|
||||
$res_rel = PMA_getForeigners($db, $table);
|
||||
|
||||
if ($res_rel && count($res_rel) > 0) {
|
||||
$have_rel = true;
|
||||
} else {
|
||||
$value = ' ';
|
||||
$have_rel = false;
|
||||
}
|
||||
$text_output .= '|' . htmlspecialchars($value);
|
||||
} // end for
|
||||
$text_output .= "\n";
|
||||
if (! PMA_exportOutputHandler($text_output)) {
|
||||
return false;
|
||||
}
|
||||
} // end while
|
||||
PMA_DBI_free_result($result);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs table's structure
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param bool $do_relation whether to include relation comments
|
||||
* @param bool $do_comments whether to include the pmadb-style column comments
|
||||
* as comments in the structure; this is deprecated
|
||||
* but the parameter is left here because export.php
|
||||
* calls PMA_exportStructure() also for other export
|
||||
* types which use this parameter
|
||||
* @param bool $do_mime whether to include mime comments
|
||||
* @param bool $dates whether to include creation/update/check dates
|
||||
* @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
|
||||
* @param string $export_type 'server', 'database', 'table'
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $export_mode, $export_type)
|
||||
{
|
||||
global $cfgRelation;
|
||||
|
||||
if (! PMA_exportOutputHandler('== ' . __('Table structure for table') . ' ' .$table . "\n\n")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the unique keys in the table
|
||||
*/
|
||||
$keys_query = PMA_DBI_get_table_indexes_sql($db, $table);
|
||||
$keys_result = PMA_DBI_query($keys_query);
|
||||
$unique_keys = array();
|
||||
while ($key = PMA_DBI_fetch_assoc($keys_result)) {
|
||||
if ($key['Non_unique'] == 0) {
|
||||
$unique_keys[] = $key['Column_name'];
|
||||
}
|
||||
}
|
||||
PMA_DBI_free_result($keys_result);
|
||||
|
||||
/**
|
||||
* Gets fields properties
|
||||
*/
|
||||
PMA_DBI_select_db($db);
|
||||
|
||||
// Check if we can use Relations
|
||||
if ($do_relation && ! empty($cfgRelation['relation'])) {
|
||||
// Find which tables are related with the current one and write it in
|
||||
// an array
|
||||
$res_rel = PMA_getForeigners($db, $table);
|
||||
|
||||
if ($res_rel && count($res_rel) > 0) {
|
||||
$have_rel = true;
|
||||
} else {
|
||||
$have_rel = false;
|
||||
}
|
||||
} else {
|
||||
$have_rel = false;
|
||||
} // end if
|
||||
$have_rel = false;
|
||||
} // end if
|
||||
|
||||
/**
|
||||
* Displays the table structure
|
||||
*/
|
||||
|
||||
$columns_cnt = 4;
|
||||
if ($do_relation && $have_rel) {
|
||||
$columns_cnt++;
|
||||
}
|
||||
if ($do_comments && $cfgRelation['commwork']) {
|
||||
$columns_cnt++;
|
||||
}
|
||||
if ($do_mime && $cfgRelation['mimework']) {
|
||||
$columns_cnt++;
|
||||
}
|
||||
|
||||
$text_output = "|------\n";
|
||||
$text_output .= '|' . htmlspecialchars(__('Column'));
|
||||
$text_output .= '|' . htmlspecialchars(__('Type'));
|
||||
$text_output .= '|' . htmlspecialchars(__('Null'));
|
||||
$text_output .= '|' . htmlspecialchars(__('Default'));
|
||||
if ($do_relation && $have_rel) {
|
||||
$text_output .= '|' . htmlspecialchars(__('Links to'));
|
||||
}
|
||||
if ($do_comments) {
|
||||
$text_output .= '|' . htmlspecialchars(__('Comments'));
|
||||
$comments = PMA_getComments($db, $table);
|
||||
}
|
||||
if ($do_mime && $cfgRelation['mimework']) {
|
||||
$text_output .= '|' . htmlspecialchars('MIME');
|
||||
$mime_map = PMA_getMIME($db, $table, true);
|
||||
}
|
||||
$text_output .= "\n|------\n";
|
||||
|
||||
if (! PMA_exportOutputHandler($text_output)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$columns = PMA_DBI_get_columns($db, $table);
|
||||
foreach ($columns as $column) {
|
||||
|
||||
$text_output = '';
|
||||
$type = $column['Type'];
|
||||
// reformat mysql query output
|
||||
// set or enum types: slashes single quotes inside options
|
||||
if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) {
|
||||
$tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1);
|
||||
$type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
|
||||
$type_nowrap = '';
|
||||
|
||||
$binary = 0;
|
||||
$unsigned = 0;
|
||||
$zerofill = 0;
|
||||
} else {
|
||||
$type_nowrap = ' nowrap="nowrap"';
|
||||
$type = preg_replace('/BINARY/i', '', $type);
|
||||
$type = preg_replace('/ZEROFILL/i', '', $type);
|
||||
$type = preg_replace('/UNSIGNED/i', '', $type);
|
||||
if (empty($type)) {
|
||||
$type = ' ';
|
||||
}
|
||||
|
||||
$binary = preg_match('/BINARY/i', $column['Type']);
|
||||
$unsigned = preg_match('/UNSIGNED/i', $column['Type']);
|
||||
$zerofill = preg_match('/ZEROFILL/i', $column['Type']);
|
||||
}
|
||||
$attribute = ' ';
|
||||
if ($binary) {
|
||||
$attribute = 'BINARY';
|
||||
}
|
||||
if ($unsigned) {
|
||||
$attribute = 'UNSIGNED';
|
||||
}
|
||||
if ($zerofill) {
|
||||
$attribute = 'UNSIGNED ZEROFILL';
|
||||
}
|
||||
if (! isset($column['Default'])) {
|
||||
if ($column['Null'] != 'NO') {
|
||||
$column['Default'] = 'NULL';
|
||||
}
|
||||
}
|
||||
|
||||
$fmt_pre = '';
|
||||
$fmt_post = '';
|
||||
if (in_array($column['Field'], $unique_keys)) {
|
||||
$fmt_pre = '**' . $fmt_pre;
|
||||
$fmt_post = $fmt_post . '**';
|
||||
}
|
||||
if ($column['Key']=='PRI') {
|
||||
$fmt_pre = '//' . $fmt_pre;
|
||||
$fmt_post = $fmt_post . '//';
|
||||
}
|
||||
$text_output .= '|' . $fmt_pre . htmlspecialchars($column['Field']) . $fmt_post;
|
||||
$text_output .= '|' . htmlspecialchars($type);
|
||||
$text_output .= '|' . htmlspecialchars(($column['Null'] == '' || $column['Null'] == 'NO') ? __('No') : __('Yes'));
|
||||
$text_output .= '|' . htmlspecialchars(isset($column['Default']) ? $column['Default'] : '');
|
||||
|
||||
$field_name = $column['Field'];
|
||||
/**
|
||||
* Displays the table structure
|
||||
*/
|
||||
|
||||
$columns_cnt = 4;
|
||||
if ($do_relation && $have_rel) {
|
||||
$text_output .= '|' . (isset($res_rel[$field_name]) ? htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')') : '');
|
||||
$columns_cnt++;
|
||||
}
|
||||
if ($do_comments && $cfgRelation['commwork']) {
|
||||
$text_output .= '|' . (isset($comments[$field_name]) ? htmlspecialchars($comments[$field_name]) : '');
|
||||
$columns_cnt++;
|
||||
}
|
||||
if ($do_mime && $cfgRelation['mimework']) {
|
||||
$text_output .= '|' . (isset($mime_map[$field_name]) ? htmlspecialchars(str_replace('_', '/', $mime_map[$field_name]['mimetype'])) : '');
|
||||
$columns_cnt++;
|
||||
}
|
||||
|
||||
$text_output .= "\n";
|
||||
$text_output = "|------\n";
|
||||
$text_output .= '|' . htmlspecialchars(__('Column'));
|
||||
$text_output .= '|' . htmlspecialchars(__('Type'));
|
||||
$text_output .= '|' . htmlspecialchars(__('Null'));
|
||||
$text_output .= '|' . htmlspecialchars(__('Default'));
|
||||
if ($do_relation && $have_rel) {
|
||||
$text_output .= '|' . htmlspecialchars(__('Links to'));
|
||||
}
|
||||
if ($do_comments) {
|
||||
$text_output .= '|' . htmlspecialchars(__('Comments'));
|
||||
$comments = PMA_getComments($db, $table);
|
||||
}
|
||||
if ($do_mime && $cfgRelation['mimework']) {
|
||||
$text_output .= '|' . htmlspecialchars('MIME');
|
||||
$mime_map = PMA_getMIME($db, $table, true);
|
||||
}
|
||||
$text_output .= "\n|------\n";
|
||||
|
||||
if (! PMA_exportOutputHandler($text_output)) {
|
||||
return false;
|
||||
}
|
||||
} // end while
|
||||
|
||||
return true;
|
||||
}
|
||||
$columns = PMA_DBI_get_columns($db, $table);
|
||||
foreach ($columns as $column) {
|
||||
|
||||
$text_output = '';
|
||||
$type = $column['Type'];
|
||||
// reformat mysql query output
|
||||
// set or enum types: slashes single quotes inside options
|
||||
if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) {
|
||||
$tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1);
|
||||
$type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
|
||||
$type_nowrap = '';
|
||||
|
||||
$binary = 0;
|
||||
$unsigned = 0;
|
||||
$zerofill = 0;
|
||||
} else {
|
||||
$type_nowrap = ' nowrap="nowrap"';
|
||||
$type = preg_replace('/BINARY/i', '', $type);
|
||||
$type = preg_replace('/ZEROFILL/i', '', $type);
|
||||
$type = preg_replace('/UNSIGNED/i', '', $type);
|
||||
if (empty($type)) {
|
||||
$type = ' ';
|
||||
}
|
||||
|
||||
$binary = preg_match('/BINARY/i', $column['Type']);
|
||||
$unsigned = preg_match('/UNSIGNED/i', $column['Type']);
|
||||
$zerofill = preg_match('/ZEROFILL/i', $column['Type']);
|
||||
}
|
||||
$attribute = ' ';
|
||||
if ($binary) {
|
||||
$attribute = 'BINARY';
|
||||
}
|
||||
if ($unsigned) {
|
||||
$attribute = 'UNSIGNED';
|
||||
}
|
||||
if ($zerofill) {
|
||||
$attribute = 'UNSIGNED ZEROFILL';
|
||||
}
|
||||
if (! isset($column['Default'])) {
|
||||
if ($column['Null'] != 'NO') {
|
||||
$column['Default'] = 'NULL';
|
||||
}
|
||||
}
|
||||
|
||||
$fmt_pre = '';
|
||||
$fmt_post = '';
|
||||
if (in_array($column['Field'], $unique_keys)) {
|
||||
$fmt_pre = '**' . $fmt_pre;
|
||||
$fmt_post = $fmt_post . '**';
|
||||
}
|
||||
if ($column['Key']=='PRI') {
|
||||
$fmt_pre = '//' . $fmt_pre;
|
||||
$fmt_post = $fmt_post . '//';
|
||||
}
|
||||
$text_output .= '|' . $fmt_pre . htmlspecialchars($column['Field']) . $fmt_post;
|
||||
$text_output .= '|' . htmlspecialchars($type);
|
||||
$text_output .= '|' . htmlspecialchars(($column['Null'] == '' || $column['Null'] == 'NO') ? __('No') : __('Yes'));
|
||||
$text_output .= '|' . htmlspecialchars(isset($column['Default']) ? $column['Default'] : '');
|
||||
|
||||
$field_name = $column['Field'];
|
||||
|
||||
if ($do_relation && $have_rel) {
|
||||
$text_output .= '|' . (isset($res_rel[$field_name]) ? htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')') : '');
|
||||
}
|
||||
if ($do_comments && $cfgRelation['commwork']) {
|
||||
$text_output .= '|' . (isset($comments[$field_name]) ? htmlspecialchars($comments[$field_name]) : '');
|
||||
}
|
||||
if ($do_mime && $cfgRelation['mimework']) {
|
||||
$text_output .= '|' . (isset($mime_map[$field_name]) ? htmlspecialchars(str_replace('_', '/', $mime_map[$field_name]['mimetype'])) : '');
|
||||
}
|
||||
|
||||
$text_output .= "\n";
|
||||
|
||||
if (! PMA_exportOutputHandler($text_output)) {
|
||||
return false;
|
||||
}
|
||||
} // end while
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@ -30,164 +30,164 @@ if (isset($plugin_list)) {
|
||||
);
|
||||
} else {
|
||||
|
||||
/* Append the PHPExcel directory to the include path variable */
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . getcwd() . '/libraries/PHPExcel/');
|
||||
/* Append the PHPExcel directory to the include path variable */
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . getcwd() . '/libraries/PHPExcel/');
|
||||
|
||||
require_once './libraries/PHPExcel/PHPExcel.php';
|
||||
require_once './libraries/PHPExcel/PHPExcel/Writer/Excel5.php';
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter() {
|
||||
global $workbook;
|
||||
global $tmp_filename;
|
||||
|
||||
$tmp_filename = tempnam(realpath($GLOBALS['cfg']['TempDir']), 'pma_xls_');
|
||||
|
||||
$workbookWriter = new PHPExcel_Writer_Excel5($workbook);
|
||||
$workbookWriter->setTempDir(realpath($GLOBALS['cfg']['TempDir']));
|
||||
$workbookWriter->save($tmp_filename);
|
||||
|
||||
if (!PMA_exportOutputHandler(file_get_contents($tmp_filename))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
unlink($tmp_filename);
|
||||
|
||||
unset($GLOBALS['workbook']);
|
||||
unset($GLOBALS['sheet_index']);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export header
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader() {
|
||||
global $db;
|
||||
|
||||
/* Initialize the workbook */
|
||||
$GLOBALS['workbook'] = new PHPExcel();
|
||||
$GLOBALS['sheet_index'] = 0;
|
||||
global $workbook;
|
||||
|
||||
$workbook->getProperties()->setCreator('phpMyAdmin ' . PMA_VERSION);
|
||||
$workbook->getProperties()->setLastModifiedBy('phpMyAdmin ' . PMA_VERSION);
|
||||
$workbook->getProperties()->setTitle($db);
|
||||
$workbook->getProperties()->setSubject('phpMyAdmin ' . PMA_VERSION . ' XLS Dump');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db) {
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in XLS format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
global $workbook;
|
||||
global $sheet_index;
|
||||
require_once './libraries/PHPExcel/PHPExcel.php';
|
||||
require_once './libraries/PHPExcel/PHPExcel/Writer/Excel5.php';
|
||||
|
||||
/**
|
||||
* Get the data from the database using the original query
|
||||
* Outputs export footer
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
$result = PMA_DBI_fetch_result($sql_query);
|
||||
$row_cnt = count($result);
|
||||
function PMA_exportFooter() {
|
||||
global $workbook;
|
||||
global $tmp_filename;
|
||||
|
||||
if ($row_cnt > 0) {
|
||||
$col_names = array_keys($result[0]);
|
||||
$fields_cnt = count($result[0]);
|
||||
$row_offset = 1;
|
||||
$tmp_filename = tempnam(realpath($GLOBALS['cfg']['TempDir']), 'pma_xls_');
|
||||
|
||||
/* Only one sheet is created on workbook initialization */
|
||||
if ($sheet_index > 0) {
|
||||
$workbook->createSheet();
|
||||
$workbookWriter = new PHPExcel_Writer_Excel5($workbook);
|
||||
$workbookWriter->setTempDir(realpath($GLOBALS['cfg']['TempDir']));
|
||||
$workbookWriter->save($tmp_filename);
|
||||
|
||||
if (!PMA_exportOutputHandler(file_get_contents($tmp_filename))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$workbook->setActiveSheetIndex($sheet_index);
|
||||
$workbook->getActiveSheet()->setTitle(substr($table, 0, 31));
|
||||
unlink($tmp_filename);
|
||||
|
||||
if (isset($GLOBALS['xls_columns']) && $GLOBALS['xls_columns']) {
|
||||
for ($i = 0; $i < $fields_cnt; ++$i) {
|
||||
$workbook->getActiveSheet()->setCellValueByColumnAndRow($i, $row_offset, $col_names[$i]);
|
||||
}
|
||||
$row_offset++;
|
||||
}
|
||||
unset($GLOBALS['workbook']);
|
||||
unset($GLOBALS['sheet_index']);
|
||||
|
||||
for ($r = 0; ($r < 65536) && ($r < $row_cnt); ++$r) {
|
||||
for ($c = 0; $c < $fields_cnt; ++$c) {
|
||||
if (!isset($result[$r][$col_names[$c]]) || is_null($result[$r][$col_names[$c]])) {
|
||||
$workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), $GLOBALS['xls_null']);
|
||||
} elseif ($result[$r][$col_names[$c]] == '0' || $result[$r][$col_names[$c]] != '') {
|
||||
/**
|
||||
* @todo we should somehow handle character set here!
|
||||
*/
|
||||
$workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), $result[$r][$col_names[$c]]);
|
||||
} else {
|
||||
$workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sheet_index++;
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Outputs export header
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader() {
|
||||
global $db;
|
||||
|
||||
/* Initialize the workbook */
|
||||
$GLOBALS['workbook'] = new PHPExcel();
|
||||
$GLOBALS['sheet_index'] = 0;
|
||||
global $workbook;
|
||||
|
||||
$workbook->getProperties()->setCreator('phpMyAdmin ' . PMA_VERSION);
|
||||
$workbook->getProperties()->setLastModifiedBy('phpMyAdmin ' . PMA_VERSION);
|
||||
$workbook->getProperties()->setTitle($db);
|
||||
$workbook->getProperties()->setSubject('phpMyAdmin ' . PMA_VERSION . ' XLS Dump');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db) {
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in XLS format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
global $workbook;
|
||||
global $sheet_index;
|
||||
|
||||
/**
|
||||
* Get the data from the database using the original query
|
||||
*/
|
||||
$result = PMA_DBI_fetch_result($sql_query);
|
||||
$row_cnt = count($result);
|
||||
|
||||
if ($row_cnt > 0) {
|
||||
$col_names = array_keys($result[0]);
|
||||
$fields_cnt = count($result[0]);
|
||||
$row_offset = 1;
|
||||
|
||||
/* Only one sheet is created on workbook initialization */
|
||||
if ($sheet_index > 0) {
|
||||
$workbook->createSheet();
|
||||
}
|
||||
|
||||
$workbook->setActiveSheetIndex($sheet_index);
|
||||
$workbook->getActiveSheet()->setTitle(substr($table, 0, 31));
|
||||
|
||||
if (isset($GLOBALS['xls_columns']) && $GLOBALS['xls_columns']) {
|
||||
for ($i = 0; $i < $fields_cnt; ++$i) {
|
||||
$workbook->getActiveSheet()->setCellValueByColumnAndRow($i, $row_offset, $col_names[$i]);
|
||||
}
|
||||
$row_offset++;
|
||||
}
|
||||
|
||||
for ($r = 0; ($r < 65536) && ($r < $row_cnt); ++$r) {
|
||||
for ($c = 0; $c < $fields_cnt; ++$c) {
|
||||
if (!isset($result[$r][$col_names[$c]]) || is_null($result[$r][$col_names[$c]])) {
|
||||
$workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), $GLOBALS['xls_null']);
|
||||
} elseif ($result[$r][$col_names[$c]] == '0' || $result[$r][$col_names[$c]] != '') {
|
||||
/**
|
||||
* @todo we should somehow handle character set here!
|
||||
*/
|
||||
$workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), $result[$r][$col_names[$c]]);
|
||||
} else {
|
||||
$workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sheet_index++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@ -30,163 +30,163 @@ if (isset($plugin_list)) {
|
||||
);
|
||||
} else {
|
||||
|
||||
/* Append the PHPExcel directory to the include path variable */
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . getcwd() . '/libraries/PHPExcel/');
|
||||
/* Append the PHPExcel directory to the include path variable */
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . getcwd() . '/libraries/PHPExcel/');
|
||||
|
||||
require_once './libraries/PHPExcel/PHPExcel.php';
|
||||
require_once './libraries/PHPExcel/PHPExcel/Writer/Excel2007.php';
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter() {
|
||||
global $workbook;
|
||||
global $tmp_filename;
|
||||
|
||||
$tmp_filename = tempnam(realpath($GLOBALS['cfg']['TempDir']), 'pma_xlsx_');
|
||||
|
||||
$workbookWriter = new PHPExcel_Writer_Excel2007($workbook);
|
||||
$workbookWriter->save($tmp_filename);
|
||||
|
||||
if (!PMA_exportOutputHandler(file_get_contents($tmp_filename))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
unlink($tmp_filename);
|
||||
|
||||
unset($GLOBALS['workbook']);
|
||||
unset($GLOBALS['sheet_index']);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export header
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader() {
|
||||
global $db;
|
||||
|
||||
/* Initialize the workbook */
|
||||
$GLOBALS['workbook'] = new PHPExcel();
|
||||
$GLOBALS['sheet_index'] = 0;
|
||||
global $workbook;
|
||||
|
||||
$workbook->getProperties()->setCreator('phpMyAdmin ' . PMA_VERSION);
|
||||
$workbook->getProperties()->setLastModifiedBy('phpMyAdmin ' . PMA_VERSION);
|
||||
$workbook->getProperties()->setTitle($db);
|
||||
$workbook->getProperties()->setSubject('phpMyAdmin ' . PMA_VERSION . ' XLSX Dump');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db) {
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in XLSX format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
global $workbook;
|
||||
global $sheet_index;
|
||||
require_once './libraries/PHPExcel/PHPExcel.php';
|
||||
require_once './libraries/PHPExcel/PHPExcel/Writer/Excel2007.php';
|
||||
|
||||
/**
|
||||
* Get the data from the database using the original query
|
||||
* Outputs export footer
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
$result = PMA_DBI_fetch_result($sql_query);
|
||||
$row_cnt = count($result);
|
||||
function PMA_exportFooter() {
|
||||
global $workbook;
|
||||
global $tmp_filename;
|
||||
|
||||
if ($row_cnt > 0) {
|
||||
$col_names = array_keys($result[0]);
|
||||
$fields_cnt = count($result[0]);
|
||||
$row_offset = 1;
|
||||
$tmp_filename = tempnam(realpath($GLOBALS['cfg']['TempDir']), 'pma_xlsx_');
|
||||
|
||||
/* Only one sheet is created on workbook initialization */
|
||||
if ($sheet_index > 0) {
|
||||
$workbook->createSheet();
|
||||
$workbookWriter = new PHPExcel_Writer_Excel2007($workbook);
|
||||
$workbookWriter->save($tmp_filename);
|
||||
|
||||
if (!PMA_exportOutputHandler(file_get_contents($tmp_filename))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$workbook->setActiveSheetIndex($sheet_index);
|
||||
$workbook->getActiveSheet()->setTitle(substr($table, 0, 31));
|
||||
unlink($tmp_filename);
|
||||
|
||||
if (isset($GLOBALS['xlsx_columns']) && $GLOBALS['xlsx_columns']) {
|
||||
for ($i = 0; $i < $fields_cnt; ++$i) {
|
||||
$workbook->getActiveSheet()->setCellValueByColumnAndRow($i, $row_offset, $col_names[$i]);
|
||||
}
|
||||
$row_offset++;
|
||||
}
|
||||
unset($GLOBALS['workbook']);
|
||||
unset($GLOBALS['sheet_index']);
|
||||
|
||||
for ($r = 0; ($r < 65536) && ($r < $row_cnt); ++$r) {
|
||||
for ($c = 0; $c < $fields_cnt; ++$c) {
|
||||
if (!isset($result[$r][$col_names[$c]]) || is_null($result[$r][$col_names[$c]])) {
|
||||
$workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), $GLOBALS['xlsx_null']);
|
||||
} elseif ($result[$r][$col_names[$c]] == '0' || $result[$r][$col_names[$c]] != '') {
|
||||
/**
|
||||
* @todo we should somehow handle character set here!
|
||||
*/
|
||||
$workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), $result[$r][$col_names[$c]]);
|
||||
} else {
|
||||
$workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sheet_index++;
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Outputs export header
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader() {
|
||||
global $db;
|
||||
|
||||
/* Initialize the workbook */
|
||||
$GLOBALS['workbook'] = new PHPExcel();
|
||||
$GLOBALS['sheet_index'] = 0;
|
||||
global $workbook;
|
||||
|
||||
$workbook->getProperties()->setCreator('phpMyAdmin ' . PMA_VERSION);
|
||||
$workbook->getProperties()->setLastModifiedBy('phpMyAdmin ' . PMA_VERSION);
|
||||
$workbook->getProperties()->setTitle($db);
|
||||
$workbook->getProperties()->setSubject('phpMyAdmin ' . PMA_VERSION . ' XLSX Dump');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db) {
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in XLSX format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
global $workbook;
|
||||
global $sheet_index;
|
||||
|
||||
/**
|
||||
* Get the data from the database using the original query
|
||||
*/
|
||||
$result = PMA_DBI_fetch_result($sql_query);
|
||||
$row_cnt = count($result);
|
||||
|
||||
if ($row_cnt > 0) {
|
||||
$col_names = array_keys($result[0]);
|
||||
$fields_cnt = count($result[0]);
|
||||
$row_offset = 1;
|
||||
|
||||
/* Only one sheet is created on workbook initialization */
|
||||
if ($sheet_index > 0) {
|
||||
$workbook->createSheet();
|
||||
}
|
||||
|
||||
$workbook->setActiveSheetIndex($sheet_index);
|
||||
$workbook->getActiveSheet()->setTitle(substr($table, 0, 31));
|
||||
|
||||
if (isset($GLOBALS['xlsx_columns']) && $GLOBALS['xlsx_columns']) {
|
||||
for ($i = 0; $i < $fields_cnt; ++$i) {
|
||||
$workbook->getActiveSheet()->setCellValueByColumnAndRow($i, $row_offset, $col_names[$i]);
|
||||
}
|
||||
$row_offset++;
|
||||
}
|
||||
|
||||
for ($r = 0; ($r < 65536) && ($r < $row_cnt); ++$r) {
|
||||
for ($c = 0; $c < $fields_cnt; ++$c) {
|
||||
if (!isset($result[$r][$col_names[$c]]) || is_null($result[$r][$col_names[$c]])) {
|
||||
$workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), $GLOBALS['xlsx_null']);
|
||||
} elseif ($result[$r][$col_names[$c]] == '0' || $result[$r][$col_names[$c]] != '') {
|
||||
/**
|
||||
* @todo we should somehow handle character set here!
|
||||
*/
|
||||
$workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), $result[$r][$col_names[$c]]);
|
||||
} else {
|
||||
$workbook->getActiveSheet()->setCellValueByColumnAndRow($c, ($r + $row_offset), '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sheet_index++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@ -52,304 +52,304 @@ if (isset($plugin_list)) {
|
||||
$plugin_list['xml']['options'][] = array('type' => 'end_group');
|
||||
} else {
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter() {
|
||||
$foot = '</pma_xml_export>';
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter() {
|
||||
$foot = '</pma_xml_export>';
|
||||
|
||||
return PMA_exportOutputHandler($foot);
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export header
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader() {
|
||||
global $crlf;
|
||||
global $cfg;
|
||||
global $db;
|
||||
global $table;
|
||||
global $tables;
|
||||
|
||||
$export_struct = isset($GLOBALS['xml_export_functions']) || isset($GLOBALS['xml_export_procedures'])
|
||||
|| isset($GLOBALS['xml_export_tables']) || isset($GLOBALS['xml_export_triggers'])
|
||||
|| isset($GLOBALS['xml_export_views']);
|
||||
$export_data = isset($GLOBALS['xml_export_contents']) ? true : false;
|
||||
|
||||
if ($GLOBALS['output_charset_conversion']) {
|
||||
$charset = $GLOBALS['charset_of_file'];
|
||||
} else {
|
||||
$charset = 'utf-8';
|
||||
return PMA_exportOutputHandler($foot);
|
||||
}
|
||||
|
||||
$head = '<?xml version="1.0" encoding="' . $charset . '"?>' . $crlf
|
||||
. '<!--' . $crlf
|
||||
. '- phpMyAdmin XML Dump' . $crlf
|
||||
. '- version ' . PMA_VERSION . $crlf
|
||||
. '- http://www.phpmyadmin.net' . $crlf
|
||||
. '-' . $crlf
|
||||
. '- ' . __('Host') . ': ' . $cfg['Server']['host'];
|
||||
if (!empty($cfg['Server']['port'])) {
|
||||
$head .= ':' . $cfg['Server']['port'];
|
||||
}
|
||||
$head .= $crlf
|
||||
. '- ' . __('Generation Time') . ': ' . PMA_localisedDate() . $crlf
|
||||
. '- ' . __('Server version') . ': ' . PMA_MYSQL_STR_VERSION . $crlf
|
||||
. '- ' . __('PHP Version') . ': ' . phpversion() . $crlf
|
||||
. '-->' . $crlf . $crlf;
|
||||
/**
|
||||
* Outputs export header
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader() {
|
||||
global $crlf;
|
||||
global $cfg;
|
||||
global $db;
|
||||
global $table;
|
||||
global $tables;
|
||||
|
||||
$head .= '<pma_xml_export version="1.0"' . (($export_struct) ? ' xmlns:pma="http://www.phpmyadmin.net/some_doc_url/"' : '') . '>' . $crlf;
|
||||
$export_struct = isset($GLOBALS['xml_export_functions']) || isset($GLOBALS['xml_export_procedures'])
|
||||
|| isset($GLOBALS['xml_export_tables']) || isset($GLOBALS['xml_export_triggers'])
|
||||
|| isset($GLOBALS['xml_export_views']);
|
||||
$export_data = isset($GLOBALS['xml_export_contents']) ? true : false;
|
||||
|
||||
if ($export_struct) {
|
||||
if (PMA_DRIZZLE) {
|
||||
$result = PMA_DBI_fetch_result("
|
||||
SELECT
|
||||
'utf8' AS DEFAULT_CHARACTER_SET_NAME,
|
||||
DEFAULT_COLLATION_NAME
|
||||
FROM data_dictionary.SCHEMAS
|
||||
WHERE SCHEMA_NAME = '" . PMA_sqlAddSlashes($db) . "'");
|
||||
if ($GLOBALS['output_charset_conversion']) {
|
||||
$charset = $GLOBALS['charset_of_file'];
|
||||
} else {
|
||||
$result = PMA_DBI_fetch_result('SELECT `DEFAULT_CHARACTER_SET_NAME`, `DEFAULT_COLLATION_NAME` FROM `information_schema`.`SCHEMATA` WHERE `SCHEMA_NAME` = \''.PMA_sqlAddSlashes($db).'\' LIMIT 1');
|
||||
}
|
||||
$db_collation = $result[0]['DEFAULT_COLLATION_NAME'];
|
||||
$db_charset = $result[0]['DEFAULT_CHARACTER_SET_NAME'];
|
||||
|
||||
$head .= ' <!--' . $crlf;
|
||||
$head .= ' - Structure schemas' . $crlf;
|
||||
$head .= ' -->' . $crlf;
|
||||
$head .= ' <pma:structure_schemas>' . $crlf;
|
||||
$head .= ' <pma:database name="' . htmlspecialchars($db) . '" collation="' . $db_collation . '" charset="' . $db_charset . '">' . $crlf;
|
||||
|
||||
if (count($tables) == 0) {
|
||||
$tables[] = $table;
|
||||
$charset = 'utf-8';
|
||||
}
|
||||
|
||||
foreach ($tables as $table) {
|
||||
// Export tables and views
|
||||
$result = PMA_DBI_fetch_result('SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table), 0);
|
||||
$tbl = $result[$table][1];
|
||||
$head = '<?xml version="1.0" encoding="' . $charset . '"?>' . $crlf
|
||||
. '<!--' . $crlf
|
||||
. '- phpMyAdmin XML Dump' . $crlf
|
||||
. '- version ' . PMA_VERSION . $crlf
|
||||
. '- http://www.phpmyadmin.net' . $crlf
|
||||
. '-' . $crlf
|
||||
. '- ' . __('Host') . ': ' . $cfg['Server']['host'];
|
||||
if (!empty($cfg['Server']['port'])) {
|
||||
$head .= ':' . $cfg['Server']['port'];
|
||||
}
|
||||
$head .= $crlf
|
||||
. '- ' . __('Generation Time') . ': ' . PMA_localisedDate() . $crlf
|
||||
. '- ' . __('Server version') . ': ' . PMA_MYSQL_STR_VERSION . $crlf
|
||||
. '- ' . __('PHP Version') . ': ' . phpversion() . $crlf
|
||||
. '-->' . $crlf . $crlf;
|
||||
|
||||
$is_view = PMA_isView($db, $table);
|
||||
$head .= '<pma_xml_export version="1.0"' . (($export_struct) ? ' xmlns:pma="http://www.phpmyadmin.net/some_doc_url/"' : '') . '>' . $crlf;
|
||||
|
||||
if ($is_view) {
|
||||
$type = 'view';
|
||||
if ($export_struct) {
|
||||
if (PMA_DRIZZLE) {
|
||||
$result = PMA_DBI_fetch_result("
|
||||
SELECT
|
||||
'utf8' AS DEFAULT_CHARACTER_SET_NAME,
|
||||
DEFAULT_COLLATION_NAME
|
||||
FROM data_dictionary.SCHEMAS
|
||||
WHERE SCHEMA_NAME = '" . PMA_sqlAddSlashes($db) . "'");
|
||||
} else {
|
||||
$type = 'table';
|
||||
$result = PMA_DBI_fetch_result('SELECT `DEFAULT_CHARACTER_SET_NAME`, `DEFAULT_COLLATION_NAME` FROM `information_schema`.`SCHEMATA` WHERE `SCHEMA_NAME` = \''.PMA_sqlAddSlashes($db).'\' LIMIT 1');
|
||||
}
|
||||
|
||||
if ($is_view && ! isset($GLOBALS['xml_export_views'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! $is_view && ! isset($GLOBALS['xml_export_tables'])) {
|
||||
continue;
|
||||
$db_collation = $result[0]['DEFAULT_COLLATION_NAME'];
|
||||
$db_charset = $result[0]['DEFAULT_CHARACTER_SET_NAME'];
|
||||
|
||||
$head .= ' <!--' . $crlf;
|
||||
$head .= ' - Structure schemas' . $crlf;
|
||||
$head .= ' -->' . $crlf;
|
||||
$head .= ' <pma:structure_schemas>' . $crlf;
|
||||
$head .= ' <pma:database name="' . htmlspecialchars($db) . '" collation="' . $db_collation . '" charset="' . $db_charset . '">' . $crlf;
|
||||
|
||||
if (count($tables) == 0) {
|
||||
$tables[] = $table;
|
||||
}
|
||||
|
||||
$head .= ' <pma:' . $type . ' name="' . $table . '">' . $crlf;
|
||||
|
||||
$tbl = " " . htmlspecialchars($tbl);
|
||||
$tbl = str_replace("\n", "\n ", $tbl);
|
||||
foreach ($tables as $table) {
|
||||
// Export tables and views
|
||||
$result = PMA_DBI_fetch_result('SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table), 0);
|
||||
$tbl = $result[$table][1];
|
||||
|
||||
$head .= $tbl . ';' . $crlf;
|
||||
$head .= ' </pma:' . $type . '>' . $crlf;
|
||||
|
||||
if (isset($GLOBALS['xml_export_triggers']) && $GLOBALS['xml_export_triggers']) {
|
||||
// Export triggers
|
||||
$triggers = PMA_DBI_get_triggers($db, $table);
|
||||
if ($triggers) {
|
||||
foreach ($triggers as $trigger) {
|
||||
$code = $trigger['create'];
|
||||
$head .= ' <pma:trigger name="' . $trigger['name'] . '">' . $crlf;
|
||||
$is_view = PMA_isView($db, $table);
|
||||
|
||||
if ($is_view) {
|
||||
$type = 'view';
|
||||
} else {
|
||||
$type = 'table';
|
||||
}
|
||||
|
||||
if ($is_view && ! isset($GLOBALS['xml_export_views'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! $is_view && ! isset($GLOBALS['xml_export_tables'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$head .= ' <pma:' . $type . ' name="' . $table . '">' . $crlf;
|
||||
|
||||
$tbl = " " . htmlspecialchars($tbl);
|
||||
$tbl = str_replace("\n", "\n ", $tbl);
|
||||
|
||||
$head .= $tbl . ';' . $crlf;
|
||||
$head .= ' </pma:' . $type . '>' . $crlf;
|
||||
|
||||
if (isset($GLOBALS['xml_export_triggers']) && $GLOBALS['xml_export_triggers']) {
|
||||
// Export triggers
|
||||
$triggers = PMA_DBI_get_triggers($db, $table);
|
||||
if ($triggers) {
|
||||
foreach ($triggers as $trigger) {
|
||||
$code = $trigger['create'];
|
||||
$head .= ' <pma:trigger name="' . $trigger['name'] . '">' . $crlf;
|
||||
|
||||
// Do some formatting
|
||||
$code = substr(rtrim($code), 0, -3);
|
||||
$code = " " . htmlspecialchars($code);
|
||||
$code = str_replace("\n", "\n ", $code);
|
||||
|
||||
$head .= $code . $crlf;
|
||||
$head .= ' </pma:trigger>' . $crlf;
|
||||
}
|
||||
|
||||
unset($trigger);
|
||||
unset($triggers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($GLOBALS['xml_export_functions']) && $GLOBALS['xml_export_functions']) {
|
||||
// Export functions
|
||||
$functions = PMA_DBI_get_procedures_or_functions($db, 'FUNCTION');
|
||||
if ($functions) {
|
||||
foreach ($functions as $function) {
|
||||
$head .= ' <pma:function name="' . $function . '">' . $crlf;
|
||||
|
||||
// Do some formatting
|
||||
$code = substr(rtrim($code), 0, -3);
|
||||
$code = " " . htmlspecialchars($code);
|
||||
$code = str_replace("\n", "\n ", $code);
|
||||
$sql = PMA_DBI_get_definition($db, 'FUNCTION', $function);
|
||||
$sql = rtrim($sql);
|
||||
$sql = " " . htmlspecialchars($sql);
|
||||
$sql = str_replace("\n", "\n ", $sql);
|
||||
|
||||
$head .= $code . $crlf;
|
||||
$head .= ' </pma:trigger>' . $crlf;
|
||||
$head .= $sql . $crlf;
|
||||
$head .= ' </pma:function>' . $crlf;
|
||||
}
|
||||
|
||||
unset($trigger);
|
||||
unset($triggers);
|
||||
unset($create_func);
|
||||
unset($function);
|
||||
unset($functions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($GLOBALS['xml_export_functions']) && $GLOBALS['xml_export_functions']) {
|
||||
// Export functions
|
||||
$functions = PMA_DBI_get_procedures_or_functions($db, 'FUNCTION');
|
||||
if ($functions) {
|
||||
foreach ($functions as $function) {
|
||||
$head .= ' <pma:function name="' . $function . '">' . $crlf;
|
||||
|
||||
// Do some formatting
|
||||
$sql = PMA_DBI_get_definition($db, 'FUNCTION', $function);
|
||||
$sql = rtrim($sql);
|
||||
$sql = " " . htmlspecialchars($sql);
|
||||
$sql = str_replace("\n", "\n ", $sql);
|
||||
if (isset($GLOBALS['xml_export_procedures']) && $GLOBALS['xml_export_procedures']) {
|
||||
// Export procedures
|
||||
$procedures = PMA_DBI_get_procedures_or_functions($db, 'PROCEDURE');
|
||||
if ($procedures) {
|
||||
foreach ($procedures as $procedure) {
|
||||
$head .= ' <pma:procedure name="' . $procedure . '">' . $crlf;
|
||||
|
||||
$head .= $sql . $crlf;
|
||||
$head .= ' </pma:function>' . $crlf;
|
||||
// Do some formatting
|
||||
$sql = PMA_DBI_get_definition($db, 'PROCEDURE', $procedure);
|
||||
$sql = rtrim($sql);
|
||||
$sql = " " . htmlspecialchars($sql);
|
||||
$sql = str_replace("\n", "\n ", $sql);
|
||||
|
||||
$head .= $sql . $crlf;
|
||||
$head .= ' </pma:procedure>' . $crlf;
|
||||
}
|
||||
|
||||
unset($create_proc);
|
||||
unset($procedure);
|
||||
unset($procedures);
|
||||
}
|
||||
|
||||
unset($create_func);
|
||||
unset($function);
|
||||
unset($functions);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($GLOBALS['xml_export_procedures']) && $GLOBALS['xml_export_procedures']) {
|
||||
// Export procedures
|
||||
$procedures = PMA_DBI_get_procedures_or_functions($db, 'PROCEDURE');
|
||||
if ($procedures) {
|
||||
foreach ($procedures as $procedure) {
|
||||
$head .= ' <pma:procedure name="' . $procedure . '">' . $crlf;
|
||||
|
||||
// Do some formatting
|
||||
$sql = PMA_DBI_get_definition($db, 'PROCEDURE', $procedure);
|
||||
$sql = rtrim($sql);
|
||||
$sql = " " . htmlspecialchars($sql);
|
||||
$sql = str_replace("\n", "\n ", $sql);
|
||||
unset($result);
|
||||
|
||||
$head .= $sql . $crlf;
|
||||
$head .= ' </pma:procedure>' . $crlf;
|
||||
}
|
||||
$head .= ' </pma:database>' . $crlf;
|
||||
$head .= ' </pma:structure_schemas>' . $crlf;
|
||||
|
||||
unset($create_proc);
|
||||
unset($procedure);
|
||||
unset($procedures);
|
||||
if ($export_data) {
|
||||
$head .= $crlf;
|
||||
}
|
||||
}
|
||||
|
||||
unset($result);
|
||||
|
||||
$head .= ' </pma:database>' . $crlf;
|
||||
$head .= ' </pma:structure_schemas>' . $crlf;
|
||||
|
||||
if ($export_data) {
|
||||
$head .= $crlf;
|
||||
}
|
||||
}
|
||||
|
||||
return PMA_exportOutputHandler($head);
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db) {
|
||||
global $crlf;
|
||||
|
||||
if (isset($GLOBALS['xml_export_contents']) && $GLOBALS['xml_export_contents']) {
|
||||
$head = ' <!--' . $crlf
|
||||
. ' - ' . __('Database') . ': ' . (isset($GLOBALS['use_backquotes']) ? PMA_backquote($db) : '\'' . $db . '\''). $crlf
|
||||
. ' -->' . $crlf
|
||||
. ' <database name="' . htmlspecialchars($db) . '">' . $crlf;
|
||||
|
||||
return PMA_exportOutputHandler($head);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db) {
|
||||
global $crlf;
|
||||
|
||||
if (isset($GLOBALS['xml_export_contents']) && $GLOBALS['xml_export_contents']) {
|
||||
$head = ' <!--' . $crlf
|
||||
. ' - ' . __('Database') . ': ' . (isset($GLOBALS['use_backquotes']) ? PMA_backquote($db) : '\'' . $db . '\''). $crlf
|
||||
. ' -->' . $crlf
|
||||
. ' <database name="' . htmlspecialchars($db) . '">' . $crlf;
|
||||
|
||||
return PMA_exportOutputHandler($head);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db) {
|
||||
global $crlf;
|
||||
|
||||
if (isset($GLOBALS['xml_export_contents']) && $GLOBALS['xml_export_contents']) {
|
||||
return PMA_exportOutputHandler(' </database>' . $crlf);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db) {
|
||||
global $crlf;
|
||||
|
||||
if (isset($GLOBALS['xml_export_contents']) && $GLOBALS['xml_export_contents']) {
|
||||
return PMA_exportOutputHandler(' </database>' . $crlf);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Outputs the content of a table in XML format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db) {
|
||||
return true;
|
||||
}
|
||||
if (isset($GLOBALS['xml_export_contents']) && $GLOBALS['xml_export_contents']) {
|
||||
$result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in XML format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
|
||||
if (isset($GLOBALS['xml_export_contents']) && $GLOBALS['xml_export_contents']) {
|
||||
$result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
|
||||
|
||||
$columns_cnt = PMA_DBI_num_fields($result);
|
||||
$columns = array();
|
||||
for ($i = 0; $i < $columns_cnt; $i++) {
|
||||
$columns[$i] = stripslashes(str_replace(' ', '_', PMA_DBI_field_name($result, $i)));
|
||||
}
|
||||
unset($i);
|
||||
|
||||
$buffer = ' <!-- ' . __('Table') . ' ' . $table . ' -->' . $crlf;
|
||||
if (!PMA_exportOutputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
while ($record = PMA_DBI_fetch_row($result)) {
|
||||
$buffer = ' <table name="' . htmlspecialchars($table) . '">' . $crlf;
|
||||
$columns_cnt = PMA_DBI_num_fields($result);
|
||||
$columns = array();
|
||||
for ($i = 0; $i < $columns_cnt; $i++) {
|
||||
// If a cell is NULL, still export it to preserve the XML structure
|
||||
if (!isset($record[$i]) || is_null($record[$i])) {
|
||||
$record[$i] = 'NULL';
|
||||
}
|
||||
$buffer .= ' <column name="' . htmlspecialchars($columns[$i]) . '">' . htmlspecialchars((string)$record[$i])
|
||||
. '</column>' . $crlf;
|
||||
$columns[$i] = stripslashes(str_replace(' ', '_', PMA_DBI_field_name($result, $i)));
|
||||
}
|
||||
$buffer .= ' </table>' . $crlf;
|
||||
unset($i);
|
||||
|
||||
$buffer = ' <!-- ' . __('Table') . ' ' . $table . ' -->' . $crlf;
|
||||
if (!PMA_exportOutputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
PMA_DBI_free_result($result);
|
||||
}
|
||||
|
||||
return true;
|
||||
} // end of the 'PMA_getTableXML()' function
|
||||
}
|
||||
while ($record = PMA_DBI_fetch_row($result)) {
|
||||
$buffer = ' <table name="' . htmlspecialchars($table) . '">' . $crlf;
|
||||
for ($i = 0; $i < $columns_cnt; $i++) {
|
||||
// If a cell is NULL, still export it to preserve the XML structure
|
||||
if (!isset($record[$i]) || is_null($record[$i])) {
|
||||
$record[$i] = 'NULL';
|
||||
}
|
||||
$buffer .= ' <column name="' . htmlspecialchars($columns[$i]) . '">' . htmlspecialchars((string)$record[$i])
|
||||
. '</column>' . $crlf;
|
||||
}
|
||||
$buffer .= ' </table>' . $crlf;
|
||||
|
||||
if (!PMA_exportOutputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
PMA_DBI_free_result($result);
|
||||
}
|
||||
|
||||
return true;
|
||||
} // end of the 'PMA_getTableXML()' function
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -31,139 +31,139 @@ if (isset($plugin_list)) {
|
||||
);
|
||||
} else {
|
||||
|
||||
/**
|
||||
* Set of functions used to build exports of tables
|
||||
*/
|
||||
/**
|
||||
* Set of functions used to build exports of tables
|
||||
*/
|
||||
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter()
|
||||
{
|
||||
PMA_exportOutputHandler('...' . $GLOBALS['crlf']);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs export header
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader()
|
||||
{
|
||||
PMA_exportOutputHandler('%YAML 1.1' . $GLOBALS['crlf'] . '---' . $GLOBALS['crlf']);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in YAML format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
{
|
||||
$result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
|
||||
|
||||
$columns_cnt = PMA_DBI_num_fields($result);
|
||||
for ($i = 0; $i < $columns_cnt; $i++) {
|
||||
$columns[$i] = stripslashes(PMA_DBI_field_name($result, $i));
|
||||
/**
|
||||
* Outputs export footer
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportFooter()
|
||||
{
|
||||
PMA_exportOutputHandler('...' . $GLOBALS['crlf']);
|
||||
return true;
|
||||
}
|
||||
unset($i);
|
||||
|
||||
$buffer = '';
|
||||
$record_cnt = 0;
|
||||
while ($record = PMA_DBI_fetch_row($result)) {
|
||||
$record_cnt++;
|
||||
/**
|
||||
* Outputs export header
|
||||
*
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportHeader()
|
||||
{
|
||||
PMA_exportOutputHandler('%YAML 1.1' . $GLOBALS['crlf'] . '---' . $GLOBALS['crlf']);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Output table name as comment if this is the first record of the table
|
||||
if ($record_cnt == 1) {
|
||||
$buffer = '# ' . $db . '.' . $table . $crlf;
|
||||
$buffer .= '-' . $crlf;
|
||||
} else {
|
||||
$buffer = '-' . $crlf;
|
||||
}
|
||||
/**
|
||||
* Outputs database header
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBHeader($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs database footer
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBFooter($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs CREATE DATABASE statement
|
||||
*
|
||||
* @param string $db Database name
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportDBCreate($db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content of a table in YAML format
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param string $crlf the end of line sequence
|
||||
* @param string $error_url the url to go back in case of error
|
||||
* @param string $sql_query SQL query for obtaining data
|
||||
* @return bool Whether it suceeded
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
{
|
||||
$result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
|
||||
|
||||
$columns_cnt = PMA_DBI_num_fields($result);
|
||||
for ($i = 0; $i < $columns_cnt; $i++) {
|
||||
if (! isset($record[$i])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$column = $columns[$i];
|
||||
|
||||
if (is_null($record[$i])) {
|
||||
$buffer .= ' ' . $column . ': null' . $crlf;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_numeric($record[$i])) {
|
||||
$buffer .= ' ' . $column . ': ' . $record[$i] . $crlf;
|
||||
continue;
|
||||
}
|
||||
|
||||
$record[$i] = str_replace(array('\\', '"', "\n", "\r"), array('\\\\', '\"', '\n', '\r'), $record[$i]);
|
||||
$buffer .= ' ' . $column . ': "' . $record[$i] . '"' . $crlf;
|
||||
$columns[$i] = stripslashes(PMA_DBI_field_name($result, $i));
|
||||
}
|
||||
unset($i);
|
||||
|
||||
if (! PMA_exportOutputHandler($buffer)) {
|
||||
return false;
|
||||
$buffer = '';
|
||||
$record_cnt = 0;
|
||||
while ($record = PMA_DBI_fetch_row($result)) {
|
||||
$record_cnt++;
|
||||
|
||||
// Output table name as comment if this is the first record of the table
|
||||
if ($record_cnt == 1) {
|
||||
$buffer = '# ' . $db . '.' . $table . $crlf;
|
||||
$buffer .= '-' . $crlf;
|
||||
} else {
|
||||
$buffer = '-' . $crlf;
|
||||
}
|
||||
|
||||
for ($i = 0; $i < $columns_cnt; $i++) {
|
||||
if (! isset($record[$i])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$column = $columns[$i];
|
||||
|
||||
if (is_null($record[$i])) {
|
||||
$buffer .= ' ' . $column . ': null' . $crlf;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_numeric($record[$i])) {
|
||||
$buffer .= ' ' . $column . ': ' . $record[$i] . $crlf;
|
||||
continue;
|
||||
}
|
||||
|
||||
$record[$i] = str_replace(array('\\', '"', "\n", "\r"), array('\\\\', '\"', '\n', '\r'), $record[$i]);
|
||||
$buffer .= ' ' . $column . ': "' . $record[$i] . '"' . $crlf;
|
||||
}
|
||||
|
||||
if (! PMA_exportOutputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
PMA_DBI_free_result($result);
|
||||
|
||||
return true;
|
||||
}
|
||||
PMA_DBI_free_result($result);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@ -1287,66 +1287,75 @@ function PMA_displayQuery($query) {
|
||||
}
|
||||
|
||||
/**
|
||||
* PMA_syncDisplayHeaderSource() shows the header for source database
|
||||
* PMA_syncDisplayHeaderCompare() shows the header for source database
|
||||
*
|
||||
* @param string $src_db source db name
|
||||
* @param string $src_db source db name
|
||||
* @param string $trg_db target db name
|
||||
* @return nothing
|
||||
*/
|
||||
function PMA_syncDisplayHeaderSource($src_db) {
|
||||
echo '<div id="serverstatus" style = "overflow: auto; width: 1020px; height: 220px; border-left: 1px gray solid; border-bottom: 1px gray solid; padding:0; margin-bottom: 1em "> ';
|
||||
function PMA_syncDisplayHeaderCompare($src_db, $trg_db) {
|
||||
echo '<fieldset style="padding:0"><div style="padding:1.5em; overflow:auto; height:220px">';
|
||||
|
||||
echo '<table id="serverstatusconnections" class="data" width="55%">';
|
||||
echo '<table class="data">';
|
||||
echo '<tr>';
|
||||
echo '<th>' . __('Source database') . ': ' . $src_db . '<br />(';
|
||||
echo '<th>' . __('Source database') . ': ' . htmlspecialchars($src_db) . '<br />(';
|
||||
if ('cur' == $_SESSION['src_type']) {
|
||||
echo __('Current server');
|
||||
} else {
|
||||
echo __('Remote server') . ' ' . $_SESSION['src_server']['host'];
|
||||
echo __('Remote server') . ' ' . htmlspecialchars($_SESSION['src_server']['host']);
|
||||
}
|
||||
echo ')</th>';
|
||||
echo '<th>' . __('Difference') . '</th>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
/**
|
||||
* PMA_syncDisplayHeaderTargetAndMatchingTables() shows the header for target database and the matching tables
|
||||
*
|
||||
* @param string $trg_db target db name
|
||||
* @param array $matching_tables
|
||||
* @return boolean $odd_row current value of this toggle
|
||||
*/
|
||||
function PMA_syncDisplayHeaderTargetAndMatchingTables($trg_db, $matching_tables) {
|
||||
echo '<table id="serverstatusconnections" class="data" width="43%">';
|
||||
echo '<tr>';
|
||||
echo '<th>' . __('Target database') . ': '. $trg_db . '<br />(';
|
||||
echo '<th>' . __('Target database') . ': '. htmlspecialchars($trg_db) . '<br />(';
|
||||
if ('cur' == $_SESSION['trg_type']) {
|
||||
echo __('Current server');
|
||||
} else {
|
||||
echo __('Remote server') . ' ' . $_SESSION['trg_server']['host'];
|
||||
echo __('Remote server') . ' ' . htmlspecialchars($_SESSION['trg_server']['host']);
|
||||
}
|
||||
echo ')</th>';
|
||||
echo '</tr>';
|
||||
$odd_row = false;
|
||||
foreach ($matching_tables as $tbl_name) {
|
||||
$odd_row = PMA_syncDisplayBeginTableRow($odd_row);
|
||||
echo '<td> ' . htmlspecialchars($tbl_name) . '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
return $odd_row;
|
||||
}
|
||||
|
||||
/**
|
||||
* PMA_syncDisplayBeginTableRow() displays the TR tag for alternating colors
|
||||
* Prints table row
|
||||
*
|
||||
* @param boolean $odd_row current status of the toggle
|
||||
* @return boolean $odd_row final status of the toggle
|
||||
* $rows contains following keys:
|
||||
* - src_table_name - source server table name
|
||||
* - dst_table_name - target server table name
|
||||
* - btn_type - 'M' or 'U'
|
||||
* - btn_structure - null or arguments for showDetails in server_synchronize.js (without img_obj and table_name):
|
||||
* i, update_size, insert_size, remove_size, insert_index, remove_index
|
||||
*
|
||||
* @param array $rows
|
||||
*/
|
||||
function PMA_syncDisplayBeginTableRow($odd_row) {
|
||||
$odd_row = ! $odd_row;
|
||||
echo '<tr height="32" class=" ';
|
||||
echo $odd_row ? 'odd' : 'even';
|
||||
echo '">';
|
||||
return $odd_row;
|
||||
function PMA_syncDisplayDataCompare($rows) {
|
||||
global $pmaThemeImage;
|
||||
|
||||
$odd_row = true;
|
||||
foreach ($rows as $row) {
|
||||
echo '<tr class=" ' . ($odd_row ? 'odd' : 'even') . '">';
|
||||
echo '<td>' . htmlspecialchars($row['src_table_name']) . '</td><td style="text-align:center">';
|
||||
if (isset($row['btn_structure']) && $row['btn_structure']) {
|
||||
// parameters: i, update_size, insert_size, remove_size, insert_index, remove_index
|
||||
$p = $row['btn_structure'];
|
||||
$p[0] = $row['btn_type'] . 'S' . $p[0];
|
||||
echo '<img class="icon struct_img" src="' . $pmaThemeImage . 'new_struct.png" width="16" height="16"
|
||||
alt="Structure" title="' . __('Click to select') . '" style="cursor:pointer" onclick="showDetails('
|
||||
. "'" . implode($p, "','") . "'"
|
||||
. ', this, ' . "'" . PMA_escapeJsString(htmlspecialchars($row['src_table_name'])) . "'" . ')" /> ';
|
||||
}
|
||||
if (isset($row['btn_data']) && $row['btn_data']) {
|
||||
// parameters: i, update_size, insert_size, remove_size, insert_index, remove_index
|
||||
$p = $row['btn_data'];
|
||||
$p[0] = $row['btn_type'] . 'D' . $p[0];
|
||||
echo '<img class="icon data_img" src="' . $pmaThemeImage . 'new_data.png" width="16" height="16"
|
||||
alt="Data" title="' . __('Click to select') . '" style="cursor:pointer" onclick="showDetails('
|
||||
. "'" . implode($p, "','") . "'"
|
||||
. ', this, ' . "'" . PMA_escapeJsString(htmlspecialchars($row['src_table_name'])) . "'" . ')" />';
|
||||
}
|
||||
echo '</td><td>' . htmlspecialchars($row['dst_table_name']) . '</td></tr>';
|
||||
$odd_row = !$odd_row;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -2629,12 +2629,12 @@ if (! defined('PMA_MINIMUM_COMMON')) {
|
||||
break;
|
||||
} // end switch ($typearr[2])
|
||||
|
||||
/*
|
||||
/*
|
||||
if ($typearr[3] != 'punct_qualifier') {
|
||||
$after .= ' ';
|
||||
}
|
||||
$after .= "\n";
|
||||
*/
|
||||
*/
|
||||
$str .= $before;
|
||||
if ($mode=='color') {
|
||||
$str .= PMA_SQP_formatHTML_colorize($arr[$i]);
|
||||
@ -2650,7 +2650,7 @@ if (! defined('PMA_MINIMUM_COMMON')) {
|
||||
$indent--;
|
||||
$str .= ($mode != 'query_only' ? '</div>' : ' ');
|
||||
}
|
||||
/* End possibly unclosed documentation link */
|
||||
/* End possibly unclosed documentation link */
|
||||
if ($close_docu_link) {
|
||||
$str .= '</a>';
|
||||
$close_docu_link = false;
|
||||
|
||||
@ -628,7 +628,7 @@ if (is_array($content_cells) && is_array($header_cells)) {
|
||||
// last row is for javascript insert
|
||||
//$empty_row = array_pop($content_cells);
|
||||
|
||||
echo '<table id="table_columns">';
|
||||
echo '<table id="table_columns" class="noclick">';
|
||||
echo '<caption class="tblHeaders">' . __('Structure') . PMA_showMySQLDocu('SQL-Syntax', 'CREATE_TABLE') . '</caption>';
|
||||
|
||||
if ($display_type == 'horizontal') {
|
||||
@ -642,7 +642,7 @@ if (is_array($content_cells) && is_array($header_cells)) {
|
||||
|
||||
$odd_row = true;
|
||||
foreach ($content_cells as $content_row) {
|
||||
echo '<tr class="' . ($odd_row ? 'odd' : 'even') . ' noclick">';
|
||||
echo '<tr class="' . ($odd_row ? 'odd' : 'even') . '">';
|
||||
$odd_row = ! $odd_row;
|
||||
|
||||
if (is_array($content_row)) {
|
||||
@ -658,7 +658,7 @@ if (is_array($content_cells) && is_array($header_cells)) {
|
||||
$i = 0;
|
||||
$odd_row = true;
|
||||
foreach ($header_cells as $header_val) {
|
||||
echo '<tr class="' . ($odd_row ? 'odd' : 'even') . ' noclick">';
|
||||
echo '<tr class="' . ($odd_row ? 'odd' : 'even') . '">';
|
||||
$odd_row = ! $odd_row;
|
||||
?>
|
||||
<th><?php echo $header_val; ?></th>
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* @requires moves.js
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
|
||||
var history_array = []; // Global array to store history objects
|
||||
var select_field = []; // Global array to store informaation for columns which are used in select clause
|
||||
var g_index;
|
||||
@ -14,12 +14,12 @@ var g_index;
|
||||
/**
|
||||
* function for panel, hides and shows toggle_container <div>,which is for history elements uses {@link JQuery}.
|
||||
*
|
||||
* @param index has value 1 or 0,decides wheter to hide toggle_container on load.
|
||||
* @param index has value 1 or 0,decides wheter to hide toggle_container on load.
|
||||
**/
|
||||
|
||||
function panel(index) {
|
||||
if (!index) {
|
||||
$(".toggle_container").hide();
|
||||
$(".toggle_container").hide();
|
||||
}
|
||||
$("h2.tiger").click(function(){
|
||||
$(this).toggleClass("active").next().slideToggle("slow");
|
||||
@ -31,18 +31,18 @@ function panel(index) {
|
||||
* clubbing all objects of same tables together
|
||||
* This function is called whenever changes are made in history_array[]
|
||||
*
|
||||
* @uses and_or()
|
||||
* @uses history_edit()
|
||||
* @uses history_delete()
|
||||
*
|
||||
* @param {int} init starting index of unsorted array
|
||||
* @param {int} final last index of unsorted array
|
||||
* @uses and_or()
|
||||
* @uses history_edit()
|
||||
* @uses history_delete()
|
||||
*
|
||||
* @param {int} init starting index of unsorted array
|
||||
* @param {int} final last index of unsorted array
|
||||
*
|
||||
**/
|
||||
|
||||
function display(init,final) {
|
||||
var str,i,j,k,sto;
|
||||
// this part sorts the history array based on table name,this is needed for clubbing all object of same name together.
|
||||
// this part sorts the history array based on table name,this is needed for clubbing all object of same name together.
|
||||
for (i = init;i < final;i++) {
|
||||
sto = history_array[i];
|
||||
var temp = history_array[i].get_tab() ;//+ '.' + history_array[i].get_obj_no(); for Self JOINS
|
||||
@ -60,7 +60,7 @@ function display(init,final) {
|
||||
str =''; // string to store Html code for history tab
|
||||
for ( var i=0; i < history_array.length; i++){
|
||||
var temp = history_array[i].get_tab(); //+ '.' + history_array[i].get_obj_no(); for Self JOIN
|
||||
str += '<h2 class="tiger"><a href="#">' + temp + '</a></h2>';
|
||||
str += '<h2 class="tiger"><a href="#">' + temp + '</a></h2>';
|
||||
str += '<div class="toggle_container">\n';
|
||||
while((history_array[i].get_tab()) == temp) { //+ '.' + history_array[i].get_obj_no()) == temp) {
|
||||
str +='<div class="block"> <table width ="250">';
|
||||
@ -76,7 +76,7 @@ function display(init,final) {
|
||||
str += '</td><td align="center"><img class="icon ic_b_info" src="themes/dot.gif" title="'+detail(i)+'"/><td title="' + detail(i) +'">' + history_array[i].get_type() + '</td></td><td onmouseover="this.className=\'history_table\';" onmouseout="this.className=\'history_table2\'" onclick=history_delete('+ i +')><img class="icon ic_b_drop" src="themes/dot.gif" title="Delete"></td></tr></thead>';
|
||||
}
|
||||
else {
|
||||
str += '</td><td align="center"><img class="icon ic_b_info" src="themes/dot.gif" title="'+detail(i)+'"/></td><td title="' + detail(i) +'">' + history_array[i]. get_type() + '</td><td <td onmouseover="this.className=\'history_table\';" onmouseout="this.className=\'history_table2\'" onclick=history_edit('+ i +')><img class="icon ic_b_edit" src="themes/dot.gif" title="Edit"/></td><td onmouseover="this.className=\'history_table\';" onmouseout="this.className=\'history_table2\'" onclick=history_delete('+ i +')><img src="themes/original/img/b_drop.png" title="Delete"></td></tr></thead>';
|
||||
str += '</td><td align="center"><img class="icon ic_b_info" src="themes/dot.gif" title="'+detail(i)+'"/></td><td title="' + detail(i) +'">' + history_array[i]. get_type() + '</td><td <td onmouseover="this.className=\'history_table\';" onmouseout="this.className=\'history_table2\'" onclick=history_edit('+ i +')><img class="icon ic_b_edit" src="themes/dot.gif" title="Edit"/></td><td onmouseover="this.className=\'history_table\';" onmouseout="this.className=\'history_table2\'" onclick=history_delete('+ i +')><img src="themes/original/img/b_drop.png" title="Delete"></td></tr></thead>';
|
||||
}
|
||||
i++;
|
||||
if(i >= history_array.length) {
|
||||
@ -91,9 +91,9 @@ function display(init,final) {
|
||||
}
|
||||
|
||||
/**
|
||||
* To change And/Or relation in history tab
|
||||
*
|
||||
* @uses panel()
|
||||
* To change And/Or relation in history tab
|
||||
*
|
||||
* @uses panel()
|
||||
*
|
||||
* @param {int} index of history_array where change is to be made
|
||||
*
|
||||
@ -113,8 +113,8 @@ function and_or(index) {
|
||||
|
||||
/**
|
||||
* To display details of obects(where,rename,Having,aggregate,groupby,orderby,having)
|
||||
*
|
||||
* @param index index of history_array where change is to be made
|
||||
*
|
||||
* @param index index of history_array where change is to be made
|
||||
*
|
||||
**/
|
||||
|
||||
@ -152,16 +152,16 @@ function detail (index) {
|
||||
/**
|
||||
* Deletes entry in history_array
|
||||
*
|
||||
* @uses panel()
|
||||
* @uses display()
|
||||
* @param index index of history_array[] which is to be deleted
|
||||
* @uses panel()
|
||||
* @uses display()
|
||||
* @param index index of history_array[] which is to be deleted
|
||||
*
|
||||
**/
|
||||
|
||||
function history_delete(index) {
|
||||
for(var k =0 ;k < from_array.length;k++){
|
||||
if(from_array[k] == history_array[index].get_tab()){
|
||||
from_array.splice(k,1);
|
||||
if(from_array[k] == history_array[index].get_tab()){
|
||||
from_array.splice(k,1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -173,8 +173,8 @@ function history_delete(index) {
|
||||
|
||||
/**
|
||||
* To show where,rename,aggregate,having forms to edit a object
|
||||
*
|
||||
* @param{int} index index of history_array where change is to be made
|
||||
*
|
||||
* @param{int} index index of history_array where change is to be made
|
||||
*
|
||||
**/
|
||||
|
||||
@ -219,10 +219,10 @@ function history_edit(index) {
|
||||
/**
|
||||
* Make changes in history_array when Edit button is clicked
|
||||
* checks for the type of object and then sets the new value
|
||||
* @uses panel()
|
||||
* @uses display()
|
||||
* @uses panel()
|
||||
* @uses display()
|
||||
*
|
||||
* @param index index of history_array where change is to be made
|
||||
* @param index index of history_array where change is to be made
|
||||
**/
|
||||
|
||||
function edit(type) {
|
||||
@ -261,13 +261,13 @@ function edit(type) {
|
||||
}
|
||||
|
||||
/**
|
||||
* history object closure
|
||||
* history object closure
|
||||
*
|
||||
* @param ncolumn_name name of the column on which conditions are put
|
||||
* @param nobj object details(where,rename,orderby,groupby,aggregate)
|
||||
* @param ntab table name of the column on which conditions are applied
|
||||
* @param nobj_no object no used for inner join
|
||||
* @param ntype type of object
|
||||
* @param ncolumn_name name of the column on which conditions are put
|
||||
* @param nobj object details(where,rename,orderby,groupby,aggregate)
|
||||
* @param ntab table name of the column on which conditions are applied
|
||||
* @param nobj_no object no used for inner join
|
||||
* @param ntype type of object
|
||||
*
|
||||
**/
|
||||
|
||||
@ -328,8 +328,8 @@ function history(ncolumn_name,nobj,ntab,nobj_no,ntype) {
|
||||
/**
|
||||
* where object closure, makes an object with all information of where
|
||||
*
|
||||
* @param nrelation_operator type of relation operator to be applied
|
||||
* @param nquery stores value of value/sub-query
|
||||
* @param nrelation_operator type of relation operator to be applied
|
||||
* @param nquery stores value of value/sub-query
|
||||
*
|
||||
**/
|
||||
|
||||
@ -357,8 +357,8 @@ var where = function (nrelation_operator,nquery) {
|
||||
/**
|
||||
* Having object closure, makes an object with all information of where
|
||||
*
|
||||
* @param nrelation_operator type of relation operator to be applied
|
||||
* @param nquery stores value of value/sub-query
|
||||
* @param nrelation_operator type of relation operator to be applied
|
||||
* @param nquery stores value of value/sub-query
|
||||
*
|
||||
**/
|
||||
|
||||
@ -392,7 +392,7 @@ var having = function (nrelation_operator,nquery,noperator) {
|
||||
/**
|
||||
* rename object closure,makes an object with all information of rename
|
||||
*
|
||||
* @param nrename_to new name information
|
||||
* @param nrename_to new name information
|
||||
*
|
||||
**/
|
||||
|
||||
@ -410,7 +410,7 @@ var rename = function(nrename_to) {
|
||||
/**
|
||||
* aggregate object closure
|
||||
*
|
||||
* @param noperator aggregte operator
|
||||
* @param noperator aggregte operator
|
||||
*
|
||||
**/
|
||||
|
||||
@ -435,10 +435,10 @@ var aggregate = function(noperator) {
|
||||
function unique(arrayName) {
|
||||
var newArray=new Array();
|
||||
label:for(var i=0; i<arrayName.length;i++ )
|
||||
{
|
||||
{
|
||||
for(var j=0; j<newArray.length;j++ )
|
||||
{
|
||||
if(newArray[j]==arrayName[i])
|
||||
if(newArray[j]==arrayName[i])
|
||||
continue label;
|
||||
}
|
||||
newArray[newArray.length] = arrayName[i];
|
||||
@ -453,27 +453,27 @@ function unique(arrayName) {
|
||||
* @param arrayName array
|
||||
* @param value value which is to be searched in the array
|
||||
*/
|
||||
|
||||
|
||||
function found(arrayName,value) {
|
||||
for(var i=0; i<arrayName.length; i++) {
|
||||
if(arrayName[i] == value) { return 1;}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function is the main function for query building.
|
||||
* uses history object details for this.
|
||||
*
|
||||
* @ uses query_where()
|
||||
* @ uses query_groupby()
|
||||
* @ uses query_having()
|
||||
* @ uses query_having()
|
||||
* @ uses query_orderby()
|
||||
*
|
||||
*
|
||||
* @param formtitle title for the form
|
||||
* @param fadin
|
||||
* @param fadin
|
||||
*/
|
||||
|
||||
|
||||
function build_query(formtitle, fadin) {
|
||||
var q_select = "SELECT ";
|
||||
var temp;
|
||||
@ -486,19 +486,19 @@ function build_query(formtitle, fadin) {
|
||||
}
|
||||
else {
|
||||
temp = check_rename(select_field[i]);
|
||||
q_select += select_field[i] + temp +",";
|
||||
q_select += select_field[i] + temp +",";
|
||||
}
|
||||
}
|
||||
q_select = q_select.substring(0,q_select.length - 1);
|
||||
q_select += " FROM " + query_from();
|
||||
if(query_where() != "") {
|
||||
q_select +="\n WHERE";
|
||||
q_select += query_where();
|
||||
q_select += query_where();
|
||||
}
|
||||
if(query_groupby() != "") { q_select += "\nGROUP BY " + query_groupby(); }
|
||||
if(query_having() != "") { q_select += "\nHAVING " + query_having(); }
|
||||
if(query_orderby() != "") { q_select += "\nORDER BY " + query_orderby(); }
|
||||
var box = document.getElementById('box');
|
||||
var box = document.getElementById('box');
|
||||
document.getElementById('filter').style.display='block';
|
||||
var btitle = document.getElementById('boxtitle');
|
||||
btitle.innerHTML = 'SELECT';//formtitle;
|
||||
@ -506,21 +506,21 @@ function build_query(formtitle, fadin) {
|
||||
gradient("box", 0);
|
||||
fadein("box");
|
||||
}
|
||||
else{
|
||||
else{
|
||||
box.style.display='block';
|
||||
}
|
||||
}
|
||||
document.getElementById('textSqlquery').innerHTML = q_select;
|
||||
}
|
||||
/**
|
||||
* This function builds from clause of query
|
||||
* makes automatic joins.
|
||||
*
|
||||
*
|
||||
* @uses unique
|
||||
* @uses add_array
|
||||
* @uses remove_array
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
function query_from() {
|
||||
var i =0;
|
||||
@ -543,12 +543,12 @@ function query_from() {
|
||||
temp = tab_left.shift();
|
||||
quer = temp;
|
||||
tab_used.push(temp);
|
||||
// if master table (key2) matches with tab used get all keys and check if tab_left matches
|
||||
//after this check if master table (key2) matches with tab left then check if any foriegn matches with master .
|
||||
for( i =0; i<2 ; i++) {
|
||||
// if master table (key2) matches with tab used get all keys and check if tab_left matches
|
||||
//after this check if master table (key2) matches with tab left then check if any foriegn matches with master .
|
||||
for( i =0; i<2 ; i++) {
|
||||
for (K in contr){
|
||||
for (key in contr[K]){// contr name
|
||||
for (key2 in contr[K][key]){// table name
|
||||
for (key2 in contr[K][key]){// table name
|
||||
parts = key2.split(".");
|
||||
if(found(tab_used,parts[1]) > 0) {
|
||||
for (key3 in contr[K][key][key2]) {
|
||||
@ -564,7 +564,7 @@ function query_from() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
K = 0;
|
||||
t_tab_left = unique (t_tab_left);
|
||||
tab_used = add_array(t_tab_left,tab_used);
|
||||
@ -574,7 +574,7 @@ function query_from() {
|
||||
for (key in contr[K]) {
|
||||
for (key2 in contr[K][key]){// table name
|
||||
parts = key2.split(".");
|
||||
if(found(tab_left,parts[1]) > 0){
|
||||
if(found(tab_left,parts[1]) > 0){
|
||||
for (key3 in contr[K][key][key2]){
|
||||
parts1 = contr[K][key][key2][key3][0].split(".");
|
||||
if(found(tab_used,parts1[1]) > 0) {
|
||||
@ -601,9 +601,7 @@ function query_from() {
|
||||
from_array = t_array;
|
||||
return query;
|
||||
}
|
||||
/* document.write(key3+";"); //master_field
|
||||
document.write(contr[K][key][key2][key3][0]+";"); // foreign_table
|
||||
document.write(contr[K][key][key2][key3][1]+";"); //forieign_feild */
|
||||
|
||||
/**
|
||||
* This function concatenates two array
|
||||
*
|
||||
@ -616,7 +614,7 @@ function add_array(add,arr){
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
|
||||
/* This fucntion removes all elements present in one array from the other.
|
||||
*
|
||||
* @params rem array from which each element is removed from other array.
|
||||
@ -635,7 +633,7 @@ function remove_array(rem,arr){
|
||||
* This function builds the groupby clause from history object
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
function query_groupby() {
|
||||
var i = 0;
|
||||
var str = "";
|
||||
@ -658,7 +656,7 @@ function query_having() {
|
||||
if(history_array[i].get_type() == "Having") {
|
||||
if (history_array[i].get_obj().get_operator() != 'None') {
|
||||
and += history_array[i].get_obj().get_operator() + "(" + history_array[i].get_column_name() + " ) " + history_array[i].get_obj().getrelation_operator();
|
||||
and += " " + history_array[i].get_obj().getquery() + ", " ;
|
||||
and += " " + history_array[i].get_obj().getquery() + ", " ;
|
||||
}
|
||||
else {
|
||||
and += history_array[i].get_column_name() + " " + history_array[i].get_obj().getrelation_operator() + " " + history_array[i].get_obj().getquery() + ", ";
|
||||
@ -707,11 +705,19 @@ function query_where(){
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( or != "(") { or = or.substring(0,(or.length - 4 )) + ")"; }
|
||||
else { or = "" ;}
|
||||
if (and !="(") {and = and.substring(0,(and.length - 5)) + ")"; }
|
||||
else {and = "" ;}
|
||||
if ( or != "" ) { and = and + " OR " + or + " )"; }
|
||||
if ( or != "(") {
|
||||
or = or.substring(0,(or.length - 4 )) + ")";
|
||||
} else {
|
||||
or = "" ;
|
||||
}
|
||||
if (and !="(") {
|
||||
and = and.substring(0,(and.length - 5)) + ")";
|
||||
} else {
|
||||
and = "" ;
|
||||
}
|
||||
if ( or != "" ) {
|
||||
and = and + " OR " + or + " )";
|
||||
}
|
||||
return and;
|
||||
}
|
||||
|
||||
@ -749,7 +755,7 @@ function gradient(id, level)
|
||||
}
|
||||
|
||||
|
||||
function fadein(id)
|
||||
function fadein(id)
|
||||
{
|
||||
var level = 0;
|
||||
while(level <= 1){
|
||||
|
||||
@ -26,20 +26,20 @@
|
||||
eval (hrefscript);
|
||||
return false;
|
||||
}).attr('href', '#');
|
||||
});
|
||||
});
|
||||
|
||||
// Below is the function to bind onbeforeunload events with the content_frame as well as the top window.
|
||||
|
||||
$(document).ready(function(){
|
||||
$(window).bind('beforeunload', function(){ // onbeforeunload for the frame window.
|
||||
if (_change == 1 && _staying == 0)
|
||||
if (_change == 1 && _staying == 0)
|
||||
return PMA_messages['strLeavingDesigner'];
|
||||
else if (_change == 1 && _staying == 1)
|
||||
else if (_change == 1 && _staying == 1)
|
||||
_staying = 0;
|
||||
});
|
||||
$(window).unload(function(){
|
||||
_change = 0;
|
||||
});
|
||||
});
|
||||
window.top.onbeforeunload = function(){ // onbeforeunload for the browser main window.
|
||||
if (_change == 1 && _staying == 0){
|
||||
_staying = 1; // Helps if the user stays on the page as there
|
||||
@ -48,7 +48,7 @@
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
function make_zero(){ // Function called if the user stays after seeing the confirmation prompt.
|
||||
_staying = 0;
|
||||
}
|
||||
@ -1015,7 +1015,7 @@ function getColorByTarget( target )
|
||||
return color;
|
||||
}
|
||||
|
||||
function Click_option(id_this,column_name,table_name)
|
||||
function Click_option(id_this,column_name,table_name)
|
||||
{
|
||||
var left = Glob_X - (document.getElementById(id_this).offsetWidth>>1);
|
||||
document.getElementById(id_this).style.left = left + 'px';
|
||||
@ -1044,10 +1044,10 @@ function Select_all(id_this,owner)
|
||||
parent.elements[i].checked = true;
|
||||
parent.elements[i].disabled = true;
|
||||
var temp = '`' + id_this.substring(owner.length +1) + '`.*';
|
||||
}
|
||||
}
|
||||
else {
|
||||
parent.elements[i].checked = false;
|
||||
parent.elements[i].disabled = false;
|
||||
parent.elements[i].disabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1063,8 +1063,8 @@ function Select_all(id_this,owner)
|
||||
}
|
||||
}
|
||||
for(k =0 ;k < from_array.length;k++){
|
||||
if(from_array[k] == id_this){
|
||||
from_array.splice(k,1);
|
||||
if(from_array[k] == id_this){
|
||||
from_array.splice(k,1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1096,7 +1096,7 @@ function store_column(id_this,owner,col) {
|
||||
var i = 0;
|
||||
var k = 0;
|
||||
if (document.getElementById('select_' + owner + '.' + id_this + '._' + col).checked == true) {
|
||||
select_field.push('`' + id_this + '`.`' + col +'`');
|
||||
select_field.push('`' + id_this + '`.`' + col +'`');
|
||||
from_array.push(id_this);
|
||||
}
|
||||
else {
|
||||
@ -1107,9 +1107,9 @@ function store_column(id_this,owner,col) {
|
||||
}
|
||||
}
|
||||
for(k =0 ;k < from_array.length;k++){
|
||||
if(from_array[k] == id_this){
|
||||
from_array.splice(k,1);
|
||||
break;
|
||||
if(from_array[k] == id_this){
|
||||
from_array.splice(k,1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1119,13 +1119,13 @@ function store_column(id_this,owner,col) {
|
||||
* This function builds object and adds them to history_array
|
||||
* first it does a few checks on each object, then makes an object(where,rename,groupby,aggregate,orderby)
|
||||
* then a new history object is made and finally all these history objects are addded to history_array[]
|
||||
*
|
||||
* @uses where()
|
||||
* @uses history()
|
||||
* @uses aggregate()
|
||||
* @uses rename()
|
||||
* @uses panel()
|
||||
* @uses display()
|
||||
*
|
||||
* @uses where()
|
||||
* @uses history()
|
||||
* @uses aggregate()
|
||||
* @uses rename()
|
||||
* @uses panel()
|
||||
* @uses display()
|
||||
**/
|
||||
|
||||
function add_object() {
|
||||
@ -1151,18 +1151,18 @@ function add_object() {
|
||||
sum = sum + 1;
|
||||
document.getElementById('new_name').value = "" ;
|
||||
}
|
||||
if (document.getElementById('operator').value != '---') {
|
||||
if (document.getElementById('operator').value != '---') {
|
||||
var aggregate_obj = new aggregate(document.getElementById('operator').value) ;
|
||||
history_array.push(new history(col_name,aggregate_obj,tab_name,h_tabs[downer + '.' + tab_name],"Aggregate"));
|
||||
sum = sum + 1;
|
||||
document.getElementById('operator').value = '---';
|
||||
//make aggregate operator
|
||||
//make aggregate operator
|
||||
}
|
||||
if (document.getElementById('groupby').checked == true ) {
|
||||
history_array.push(new history(col_name,'GroupBy',tab_name,h_tabs[downer + '.' +tab_name],"GroupBy"));
|
||||
sum = sum + 1;
|
||||
document.getElementById('groupby').checked = false;
|
||||
//make groupby
|
||||
//make groupby
|
||||
}
|
||||
if (document.getElementById('h_rel_opt').value != '--') {
|
||||
if (document.getElementById('having').value == "") {
|
||||
@ -1182,11 +1182,11 @@ function add_object() {
|
||||
history_array.push(new history(col_name,'OrderBy',tab_name,h_tabs[downer + '.' + tab_name],"OrderBy"));
|
||||
sum = sum + 1;
|
||||
document.getElementById('orderby').checked = false;
|
||||
//make orderby
|
||||
//make orderby
|
||||
}
|
||||
document.getElementById('hint').innerHTML = sum + "object created" ;
|
||||
document.getElementById('hint').style.visibility = "visible";
|
||||
//output sum new objects created
|
||||
//output sum new objects created
|
||||
var existingDiv = document.getElementById('ab');
|
||||
existingDiv.innerHTML = display(init,history_array.length);
|
||||
Close_option();
|
||||
|
||||
40
po/de.po
@ -4,8 +4,8 @@ msgstr ""
|
||||
"Project-Id-Version: phpMyAdmin 3.5.0-dev\n"
|
||||
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
|
||||
"POT-Creation-Date: 2011-07-30 14:14-0400\n"
|
||||
"PO-Revision-Date: 2011-07-31 21:12+0200\n"
|
||||
"Last-Translator: <mrbendig@mrbendig.com>\n"
|
||||
"PO-Revision-Date: 2011-08-01 20:57+0200\n"
|
||||
"Last-Translator: Sven Strickroth <email@cs-ware.de>\n"
|
||||
"Language-Team: german <de@li.org>\n"
|
||||
"Language: de\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@ -10006,7 +10006,6 @@ msgid "Monitor Instructions"
|
||||
msgstr "Einführung zur Überwachung"
|
||||
|
||||
#: server_status.php:1364
|
||||
#, fuzzy
|
||||
#| msgid ""
|
||||
#| "The phpMyAdmin Monitor can assist you in optimizing the server "
|
||||
#| "configuration and track down time intensive\n"
|
||||
@ -10023,14 +10022,13 @@ msgid ""
|
||||
"increases server load by up to 15%"
|
||||
msgstr ""
|
||||
"Die phpMyAdmin-Überwachung kann Sie bei der Server-Konfiguration, und auch "
|
||||
"beim Aufspühren von zeitintensiven Abfragen unterstützen. Für das Letztere "
|
||||
"beim Aufspühren von zeitintensiven Abfragen unterstützen. Für Letzteres "
|
||||
"müssen Sie log_output auf 'TABLE' stellen und entweder slow_query_log oder "
|
||||
"general_log aktivieren. Beachten Sie aber, dass das Aktivieren der "
|
||||
"general_log viele Daten produzieren und die Serverauslastung um bis zu 15% "
|
||||
"erhöhen kann."
|
||||
|
||||
#: server_status.php:1371
|
||||
#, fuzzy
|
||||
#| msgid ""
|
||||
#| "<b>Using the monitor:</b><br/>\n"
|
||||
#| " Ok, you are good to go! Once you click 'Start monitor' your "
|
||||
@ -10053,21 +10051,19 @@ msgid ""
|
||||
"will load statistics from the logs helping you find what caused the activity "
|
||||
"spike.</p>"
|
||||
msgstr ""
|
||||
"<b>Verwendung der Überwachung:</b><br />\n"
|
||||
"OK, Sie sind bereit zum Starten! Sobald Sie 'Überwachung starten' angeklickt "
|
||||
"haben, wird Ihr Browser in regelmäßigen Intervallen alle angezeigten "
|
||||
"Diagramme aktualisieren. Unter 'Einstellungen' können Sie Diagramme "
|
||||
"hinzufügen und das Aktualisierungsintervall ändern oder beliebige Diagramme "
|
||||
"entfernen, wenn Sie das Zahnrad-Icon des entsprechenden Schaubilds "
|
||||
"verwenden.\n"
|
||||
"<p>Wenn Sie eine plötzliche Spitze in der Aktivität feststellen, wählen Sie "
|
||||
"den entsprechenden Zeitraum in einem beliebigen Diagramm, indem Sie die\n"
|
||||
"linke Maustaste gedrückt halten und über das Schaubild ziehen. Dies wird "
|
||||
"Statistiken aus den Protokollen laden um Sie bei der Auffindung der \n"
|
||||
"<b>Verwendung der Überwachung:</b><br />OK, Sie sind bereit zum Starten! "
|
||||
"Sobald Sie 'Überwachung starten' angeklickt haben, wird Ihr Browser in "
|
||||
"regelmäßigen Intervallen alle angezeigten Diagramme aktualisieren. Unter "
|
||||
"'Einstellungen' können Sie Diagramme hinzufügen und das "
|
||||
"Aktualisierungsintervall ändern oder beliebige Diagramme entfernen, wenn Sie "
|
||||
"das Zahnrad-Icon des entsprechenden Schaubilds verwenden.<p>Wenn Sie eine "
|
||||
"plötzliche Spitze in der Aktivität feststellen, wählen Sie den "
|
||||
"entsprechenden Zeitraum in einem beliebigen Diagramm, indem Sie die linke "
|
||||
"Maustaste gedrückt halten und über das Schaubild ziehen. Dies wird "
|
||||
"Statistiken aus den Protokollen laden um Sie bei der Auffindung der "
|
||||
"Aktivitätsspitze zu unterstützen.</p>"
|
||||
|
||||
#: server_status.php:1375
|
||||
#, fuzzy
|
||||
#| msgid ""
|
||||
#| "<b>Please note:</b>\n"
|
||||
#| " Enabling the general_log may increase the server load by 5-15%. "
|
||||
@ -10083,12 +10079,10 @@ msgid ""
|
||||
"disable the general_log and empty its table once monitoring is not required "
|
||||
"any more."
|
||||
msgstr ""
|
||||
"<b>Bitte beachten Sie:</b>\n"
|
||||
"Das Aktivieren des general_log kann die Serverlast um 5-15% steigern. Seien "
|
||||
"Sie sich bewusst, dass das Erzeugen von Statistiken aus den Logs ein \n"
|
||||
"sehr aufwändiger Prozess ist. Deshalb ist es ratsam, nur einen kleinen "
|
||||
"Zeitraum auszuwählen.\n"
|
||||
" "
|
||||
"<b>Bitte beachten Sie:</b> Das Aktivieren des general_log kann die "
|
||||
"Serverlast um 5-15% steigern. Seien Sie sich bewusst, dass das Erzeugen von "
|
||||
"Statistiken aus den Logs ein sehr aufwändiger Prozess ist. Deshalb ist es "
|
||||
"ratsam, nur einen kleinen Zeitraum auszuwählen."
|
||||
|
||||
#: server_status.php:1385
|
||||
msgid "CPU Usage"
|
||||
|
||||
59
po/es.po
@ -4,13 +4,13 @@ msgstr ""
|
||||
"Project-Id-Version: phpMyAdmin 3.5.0-dev\n"
|
||||
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
|
||||
"POT-Creation-Date: 2011-07-30 14:14-0400\n"
|
||||
"PO-Revision-Date: 2011-07-27 16:54+0200\n"
|
||||
"PO-Revision-Date: 2011-08-01 18:53+0200\n"
|
||||
"Last-Translator: Matías Bellone <matiasbellone@gmail.com>\n"
|
||||
"Language-Team: spanish <es@li.org>\n"
|
||||
"Language: es\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Language: es\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"X-Generator: Pootle 2.0.5\n"
|
||||
|
||||
@ -1326,7 +1326,6 @@ msgid "Analysing & loading logs. This may take a while."
|
||||
msgstr "Analizando y cargando registros. Esto puede demorar."
|
||||
|
||||
#: js/messages.php:143
|
||||
#, fuzzy
|
||||
#| msgid ""
|
||||
#| "This columns shows the amount of identical queries that are grouped "
|
||||
#| "together. However only the SQL Text is being compared, thus the queries "
|
||||
@ -1337,8 +1336,9 @@ msgid ""
|
||||
"the other attributes of queries, such as start time, may differ."
|
||||
msgstr ""
|
||||
"Esta columna muestra la cantidad de consultas idénticas que fueron "
|
||||
"agrupadas. Sin embargo, sólo el texto SQL es comparado, por lo que los demás "
|
||||
"atributos de las consultas como el tiempo de inicio podría diferir."
|
||||
"agrupadas. Sin embargo, sólo la consulta SQL en sí es es utilizada para "
|
||||
"agrupar, por lo que los demás atributos de las consultas como el tiempo de "
|
||||
"inicio podría diferir."
|
||||
|
||||
#: js/messages.php:144
|
||||
msgid ""
|
||||
@ -1360,11 +1360,11 @@ msgid "Jump to Log table"
|
||||
msgstr "Saltar a la tabla de registros"
|
||||
|
||||
#: js/messages.php:148
|
||||
#, fuzzy
|
||||
#| msgid "Log analysed, but not data found in this time span."
|
||||
msgid "Log analysed, but no data found in this time span."
|
||||
msgstr ""
|
||||
"Registros analizados, pero no se encontraron datos en este período de tiempo."
|
||||
"Registros analizados, pero no se encontraron datos en este período de "
|
||||
"tiempo."
|
||||
|
||||
#. l10n: A collection of available filters
|
||||
#: js/messages.php:151
|
||||
@ -1381,10 +1381,9 @@ msgid "Filter queries by word/regexp:"
|
||||
msgstr "Filtrar consultas por palabra/expresión regular:"
|
||||
|
||||
#: js/messages.php:155
|
||||
#, fuzzy
|
||||
#| msgid "Group queries, ignoring variable data in WHERE statements"
|
||||
msgid "Group queries, ignoring variable data in WHERE clauses"
|
||||
msgstr "Agrupar consultas, ignorando datos variables en sentencias WHERE"
|
||||
msgstr "Agrupar consultas ignorando datos variables en sentencias WHERE"
|
||||
|
||||
#: js/messages.php:156
|
||||
msgid "Sum of grouped rows:"
|
||||
@ -10061,7 +10060,6 @@ msgid "Monitor Instructions"
|
||||
msgstr "Instrucciones de monitorización"
|
||||
|
||||
#: server_status.php:1364
|
||||
#, fuzzy
|
||||
#| msgid ""
|
||||
#| "The phpMyAdmin Monitor can assist you in optimizing the server "
|
||||
#| "configuration and track down time intensive\n"
|
||||
@ -10077,14 +10075,14 @@ msgid ""
|
||||
"enabled. Note however, that the general_log produces a lot of data and "
|
||||
"increases server load by up to 15%"
|
||||
msgstr ""
|
||||
"El monitorizador de phpMyAdmin puede asistir en la optimización de la "
|
||||
"El Monitorizador de phpMyAdmin puede asistir en la optimización de la "
|
||||
"configuración del servidor y rastrear consultas que toman mucho tiempo. Para "
|
||||
"esto último necesitará que «log_output» esté definido como 'TABLE' y tener "
|
||||
"activado «slow_query_log» o «general_log». Note, sin embargo, que «general_log» "
|
||||
"produce mucha información y aumenta la carga en el servidor hasta en un 15%"
|
||||
"activado «slow_query_log» o «general_log». Note, sin embargo, que "
|
||||
"«general_log» produce mucha información y aumenta la carga en el servidor "
|
||||
"hasta en un 15%"
|
||||
|
||||
#: server_status.php:1371
|
||||
#, fuzzy
|
||||
#| msgid ""
|
||||
#| "<b>Using the monitor:</b><br/>\n"
|
||||
#| " Ok, you are good to go! Once you click 'Start monitor' your "
|
||||
@ -10107,19 +10105,17 @@ msgid ""
|
||||
"will load statistics from the logs helping you find what caused the activity "
|
||||
"spike.</p>"
|
||||
msgstr ""
|
||||
"<b>Utilizando el monitorizador:</b><br />\n"
|
||||
"¡Ya estás listo! Una vez que pulses en 'Iniciar monitorización' el navegador "
|
||||
"actualizará a intervalos regulares todos los gráficos mostrados. Podría "
|
||||
"agregar gráficos y cambiar la velocidad de actualización en 'Configuración', "
|
||||
"o eliminar cualquier gráfico utilizando el icono de rueda dentada en cada "
|
||||
"gráfico.\n"
|
||||
"<p>Cuando vea un pico repentino de actividad, seleccione el intervalo de "
|
||||
"tiempo relevante en el gráfico manteniendo pulsado el botón izquierdo y "
|
||||
"arrastrando sobre el gráfico. Esto cargará las estadísticas de los "
|
||||
"registros, lo que lo ayudará a encontrar la causa del pico de actividad.</p>"
|
||||
"<b>Utilizando el monitorizador:</b><br /> ¡Ya está listo! Una vez que pulse "
|
||||
"en 'Iniciar monitorización' el navegador actualizará a intervalos regulares "
|
||||
"todos los gráficos mostrados. Puede agregar gráficos y cambiar la velocidad "
|
||||
"de actualización en la sección 'Configuración' o eliminar cualquier gráfico "
|
||||
"utilizando el icono de rueda dentada en cada gráfico. <p>Cuando vea un pico "
|
||||
"repentino de actividad, seleccione el intervalo de tiempo relevante en el "
|
||||
"gráfico manteniendo pulsado el botón izquierdo y arrastrando sobre el "
|
||||
"gráfico. Esto cargará las estadísticas de los registros, lo que lo ayudará a "
|
||||
"encontrar la causa del pico de actividad.</p>"
|
||||
|
||||
#: server_status.php:1375
|
||||
#, fuzzy
|
||||
#| msgid ""
|
||||
#| "<b>Please note:</b>\n"
|
||||
#| " Enabling the general_log may increase the server load by 5-15%. "
|
||||
@ -10135,13 +10131,12 @@ msgid ""
|
||||
"disable the general_log and empty its table once monitoring is not required "
|
||||
"any more."
|
||||
msgstr ""
|
||||
"<b>Notar que:</b>\n"
|
||||
"Activar «general_log» puede aumentar la carga en el servidor hasta un 5-15%. "
|
||||
"También esté al tanto que generar estadísticas de los registros es una tarea "
|
||||
"muy intensiva por lo que se recomienda seleccionar un período de tiempo lo "
|
||||
"más pequeño posible y desactivar «general_log» y vaciar sus tablas una vez "
|
||||
"que ya no se necesite monitorizar.\n"
|
||||
" "
|
||||
"<b>Notar que:</b> Activar «general_log» puede aumentar la carga en el "
|
||||
"servidor hasta un 5-15%. También esté al tanto que generar estadísticas de "
|
||||
"los registros es una tarea muy intensiva por lo que se recomienda "
|
||||
"seleccionar un período de tiempo lo más pequeño posible y desactivar "
|
||||
"«general_log» y vaciar sus tablas una vez que ya no se necesite monitorizar. "
|
||||
" "
|
||||
|
||||
#: server_status.php:1385
|
||||
msgid "CPU Usage"
|
||||
|
||||
27
po/fr.po
@ -4,13 +4,13 @@ msgstr ""
|
||||
"Project-Id-Version: phpMyAdmin 3.5.0-dev\n"
|
||||
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
|
||||
"POT-Creation-Date: 2011-07-30 14:14-0400\n"
|
||||
"PO-Revision-Date: 2011-07-29 16:58+0200\n"
|
||||
"PO-Revision-Date: 2011-08-01 12:56+0200\n"
|
||||
"Last-Translator: Marc Delisle <marc@infomarc.info>\n"
|
||||
"Language-Team: french <fr@li.org>\n"
|
||||
"Language: fr\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Language: fr\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||
"X-Generator: Pootle 2.0.5\n"
|
||||
|
||||
@ -1342,6 +1342,10 @@ msgid ""
|
||||
"However only the SQL query itself has been used as a grouping criteria, so "
|
||||
"the other attributes of queries, such as start time, may differ."
|
||||
msgstr ""
|
||||
"Cette colonne montre le nombre de requêtes identiques qui sont regroupées. "
|
||||
"Cependant, seulement le texte SQL de la requête a été utilisé comme critère "
|
||||
"de regroupement, donc les autres propriétés des requêtes, comme l'heure de "
|
||||
"début, peuvent différer."
|
||||
|
||||
#: js/messages.php:144
|
||||
msgid ""
|
||||
@ -9992,6 +9996,11 @@ msgid ""
|
||||
"enabled. Note however, that the general_log produces a lot of data and "
|
||||
"increases server load by up to 15%"
|
||||
msgstr ""
|
||||
"Le moniteur phpMyAdmin peut vous aider à optimiser la configuration serveur "
|
||||
"et à traquer les requêtes qui prennent beaucoup de temps. Pour ce faire vous "
|
||||
"devrez régler le paramètre log_output à 'TABLE' et activer le journal "
|
||||
"slow_query_log ou general_log. Cependant, general_log produit beaucoup de "
|
||||
"données et augmente jusqu'à 15% la charge du serveur"
|
||||
|
||||
#: server_status.php:1371
|
||||
msgid ""
|
||||
@ -10004,6 +10013,15 @@ msgid ""
|
||||
"will load statistics from the logs helping you find what caused the activity "
|
||||
"spike.</p>"
|
||||
msgstr ""
|
||||
"<b>Utilisation de la surveillance :</b><br />Vous êtes maintenant prêt! "
|
||||
"Après avoir cliqué sur «Démarrer la surveillance», votre navigateur va "
|
||||
"rafraîchir les graphiques à intervalle régulier. Vous pouvez ajouter des "
|
||||
"graphiques et modifier le taux de rafraîchissement sous «Paramètres», ou "
|
||||
"supprimer tout graphique via l'cône de rouage.<p>Lorsque vous constatez un "
|
||||
"pic d'activité soudain, sélectionnez la portion de temps pertinent sur l'un "
|
||||
"des graphiques en tenant enfoncé le bouton gauche de la souris et en vous "
|
||||
"déplaçant sur le graphique. Ceci va charger les statistiques à partir des "
|
||||
"journaux et vous aidera à trouver la cause du pic dans l'activité.</p>"
|
||||
|
||||
#: server_status.php:1375
|
||||
msgid ""
|
||||
@ -10013,6 +10031,11 @@ msgid ""
|
||||
"disable the general_log and empty its table once monitoring is not required "
|
||||
"any more."
|
||||
msgstr ""
|
||||
"<b>À noter :</b>Activer le journal general_log peut causer une augmentation "
|
||||
"de charge de 5 à 15%. Également, la génération des statistiques à partir des "
|
||||
"journaux est une tâche intensive, donc il est suggéré de ne sélectionner "
|
||||
"qu'une petite portion de temps et de désactiver general_log puis de vider la "
|
||||
"table correspondante lorsque la surveillance n'est plus requise."
|
||||
|
||||
#: server_status.php:1385
|
||||
msgid "CPU Usage"
|
||||
|
||||
75
po/ja.po
@ -4,13 +4,13 @@ msgstr ""
|
||||
"Project-Id-Version: phpMyAdmin 3.5.0-dev\n"
|
||||
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
|
||||
"POT-Creation-Date: 2011-07-30 14:14-0400\n"
|
||||
"PO-Revision-Date: 2011-07-27 12:14+0200\n"
|
||||
"PO-Revision-Date: 2011-08-02 16:09+0200\n"
|
||||
"Last-Translator: Yuichiro <yuichiro@pop07.odn.ne.jp>\n"
|
||||
"Language-Team: japanese <jp@li.org>\n"
|
||||
"Language: ja\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Language: ja\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
"X-Generator: Pootle 2.0.5\n"
|
||||
|
||||
@ -1201,27 +1201,27 @@ msgstr "モニタ一時中断"
|
||||
|
||||
#: js/messages.php:114
|
||||
msgid "general_log and slow_query_log are enabled."
|
||||
msgstr ""
|
||||
msgstr "general_log および slow_query_log は有効です。"
|
||||
|
||||
#: js/messages.php:115
|
||||
msgid "general_log is enabled."
|
||||
msgstr ""
|
||||
msgstr "general_log は有効です。"
|
||||
|
||||
#: js/messages.php:116
|
||||
msgid "slow_query_log is enabled."
|
||||
msgstr ""
|
||||
msgstr "slow_query_log は有効です。"
|
||||
|
||||
#: js/messages.php:117
|
||||
msgid "slow_query_log and general_log are disabled."
|
||||
msgstr ""
|
||||
msgstr "slow_query_log および general_log は無効です。"
|
||||
|
||||
#: js/messages.php:118
|
||||
msgid "log_output is not set to TABLE."
|
||||
msgstr ""
|
||||
msgstr "log_output はテーブルに設定されていません。"
|
||||
|
||||
#: js/messages.php:119
|
||||
msgid "log_output is set to TABLE."
|
||||
msgstr ""
|
||||
msgstr "log_output はテーブルに設定されています。"
|
||||
|
||||
#: js/messages.php:120
|
||||
#, php-format
|
||||
@ -1230,11 +1230,13 @@ msgid ""
|
||||
"than %d seconds. It is advisable to set this long_query_time 0-2 seconds, "
|
||||
"depending on your system."
|
||||
msgstr ""
|
||||
"slow_query_log は有効になっていますが、サーバは %d "
|
||||
"秒より長くかかるクエリだけをログに記録します。お使いのシステムによっては、long_query_time を 0~2 秒に設定したほうがいいでしょう。"
|
||||
|
||||
#: js/messages.php:121
|
||||
#, php-format
|
||||
msgid "long_query_time is set to %d second(s)."
|
||||
msgstr ""
|
||||
msgstr "long_query_time は %d 秒に設定されています。"
|
||||
|
||||
#: js/messages.php:122
|
||||
msgid ""
|
||||
@ -1246,10 +1248,10 @@ msgstr ""
|
||||
|
||||
#. l10n: %s is FILE or TABLE
|
||||
#: js/messages.php:124
|
||||
#, fuzzy, php-format
|
||||
#, php-format
|
||||
#| msgid "Save output to a file"
|
||||
msgid "Set log_output to %s"
|
||||
msgstr "出力をファイルに保存する"
|
||||
msgstr "%s に log_output を設定する"
|
||||
|
||||
#. l10n: Enable in this context means setting a status variable to ON
|
||||
#: js/messages.php:126
|
||||
@ -1267,7 +1269,7 @@ msgstr "%s を無効にする"
|
||||
#: js/messages.php:130
|
||||
#, php-format
|
||||
msgid "Set long_query_time to %ds"
|
||||
msgstr ""
|
||||
msgstr "long_query_time を %d 秒に設定する"
|
||||
|
||||
#: js/messages.php:131
|
||||
msgid ""
|
||||
@ -1311,7 +1313,7 @@ msgstr ""
|
||||
|
||||
#: js/messages.php:142
|
||||
msgid "Analysing & loading logs. This may take a while."
|
||||
msgstr ""
|
||||
msgstr "ログの解析および読み込み中。すこし時間がかかることがあります。"
|
||||
|
||||
#: js/messages.php:143
|
||||
msgid ""
|
||||
@ -1329,17 +1331,16 @@ msgstr ""
|
||||
|
||||
#: js/messages.php:145
|
||||
msgid "Log data loaded. Queries executed in this time span:"
|
||||
msgstr ""
|
||||
msgstr "ログデータを読み込みました。この期間に行われたクエリは以下の通りです。"
|
||||
|
||||
#: js/messages.php:147
|
||||
#, fuzzy
|
||||
#| msgid "Jump to database"
|
||||
msgid "Jump to Log table"
|
||||
msgstr "データベースに移動"
|
||||
msgstr "ログの表に移動する"
|
||||
|
||||
#: js/messages.php:148
|
||||
msgid "Log analysed, but no data found in this time span."
|
||||
msgstr ""
|
||||
msgstr "ログの解析を行いましたが、この期間のデータは見つかりませんでした。"
|
||||
|
||||
#. l10n: A collection of available filters
|
||||
#: js/messages.php:151
|
||||
@ -1357,7 +1358,7 @@ msgstr ""
|
||||
|
||||
#: js/messages.php:155
|
||||
msgid "Group queries, ignoring variable data in WHERE clauses"
|
||||
msgstr ""
|
||||
msgstr "クエリをまとめる(WHERE 句内のデータ部(文字列や数値など)は同一として扱われます)"
|
||||
|
||||
#: js/messages.php:156
|
||||
#, fuzzy
|
||||
@ -1366,10 +1367,9 @@ msgid "Sum of grouped rows:"
|
||||
msgstr "挿入する行数"
|
||||
|
||||
#: js/messages.php:157
|
||||
#, fuzzy
|
||||
#| msgid "Total"
|
||||
msgid "Total:"
|
||||
msgstr "合計"
|
||||
msgstr "合計:"
|
||||
|
||||
#: js/messages.php:161 libraries/tbl_properties.inc.php:780
|
||||
#: pmd_general.php:388 pmd_general.php:425 pmd_general.php:545
|
||||
@ -9782,10 +9782,9 @@ msgid "Start Monitor"
|
||||
msgstr "モニタ開始"
|
||||
|
||||
#: server_status.php:1328
|
||||
#, fuzzy
|
||||
#| msgid "Introduction"
|
||||
msgid "Instructions/Setup"
|
||||
msgstr "はじめに"
|
||||
msgstr "使用方法/セットアップ"
|
||||
|
||||
#: server_status.php:1332
|
||||
msgid "Done rearranging/editing charts"
|
||||
@ -9812,13 +9811,11 @@ msgid "Clear monitor config"
|
||||
msgstr "モニタ設定のクリア"
|
||||
|
||||
#: server_status.php:1363
|
||||
#, fuzzy
|
||||
#| msgid "Introduction"
|
||||
msgid "Monitor Instructions"
|
||||
msgstr "はじめに"
|
||||
msgstr "モニタの使用方法"
|
||||
|
||||
#: server_status.php:1364
|
||||
#, fuzzy
|
||||
#| msgid ""
|
||||
#| "The phpMyAdmin Monitor can assist you in optimizing the server "
|
||||
#| "configuration and track down time intensive\n"
|
||||
@ -9834,11 +9831,9 @@ msgid ""
|
||||
"enabled. Note however, that the general_log produces a lot of data and "
|
||||
"increases server load by up to 15%"
|
||||
msgstr ""
|
||||
"phpMyAdmin モニタは、サーバ構成の最適化を支援し、時間のかかるクエリを追跡する"
|
||||
"ことができます。後者の場合には、テーブルに log_output を設定し、"
|
||||
"slow_query_log または general_log のいずれかを有効にする必要があります。な"
|
||||
"お、general_log を大量のデータを生成し、サーバの負荷を 15% 増加させますので、"
|
||||
"注意するようにしてください。"
|
||||
"phpMyAdmin モニタは、サーバ構成の最適化を支援し、時間のかかるクエリを追跡することができます。後者の場合には、テーブルに log_output "
|
||||
"を設定し、slow_query_log または general_log のいずれかを有効にする必要があります。なお、general_log "
|
||||
"は大量のデータを生成し、サーバの負荷を 15% 増加させますので、注意するようにしてください。"
|
||||
|
||||
#: server_status.php:1371
|
||||
msgid ""
|
||||
@ -9851,6 +9846,10 @@ msgid ""
|
||||
"will load statistics from the logs helping you find what caused the activity "
|
||||
"spike.</p>"
|
||||
msgstr ""
|
||||
"<b>モニタの使い方:</b><br/>「モニタ開始」をクリックすると、ブラウザは一定間隔で表示されている全てのグラフを更新します。「設定」のところより"
|
||||
"グラフを追加や再描画間隔の変更が行え、それぞれのグラフにある歯車のアイコンを通じて削除を行えます。<p>モニタリングしていてスパイク信号が見られることが"
|
||||
"あります。マウスの左ボタンを押したままグラフの上をドラッグするように移動させことで、グラフの任意の期間を選択できます。こうすることでログから統計の読み込"
|
||||
"みが行え、スパイク信号の原因を探ることができます。</p>"
|
||||
|
||||
#: server_status.php:1375
|
||||
msgid ""
|
||||
@ -9860,6 +9859,9 @@ msgid ""
|
||||
"disable the general_log and empty its table once monitoring is not required "
|
||||
"any more."
|
||||
msgstr ""
|
||||
"<b>注意事項:</b>general_log を有効にすると、5~15% サーバの負荷が増加することがあります。ログから生成される統計は、負荷が集中す"
|
||||
"る作業であることを認識しておいてください。ですから、テーブルのモニタで必要としないのであれば、しばらくの間 general_log "
|
||||
"を無効にして空にしておくのが望ましいです。"
|
||||
|
||||
#: server_status.php:1385
|
||||
msgid "CPU Usage"
|
||||
@ -9916,26 +9918,23 @@ msgid "Series in Chart:"
|
||||
msgstr "グラフの系列"
|
||||
|
||||
#: server_status.php:1445
|
||||
#, fuzzy
|
||||
#| msgid "Loading"
|
||||
msgid "Loading logs"
|
||||
msgstr "読み込み中"
|
||||
msgstr "ログの読み込み"
|
||||
|
||||
#: server_status.php:1448
|
||||
#, fuzzy
|
||||
#| msgid "Show statistics"
|
||||
msgid "Log statistics"
|
||||
msgstr "統計を表示する"
|
||||
msgstr "ログの統計"
|
||||
|
||||
#: server_status.php:1449
|
||||
#, fuzzy
|
||||
#| msgid "Select page"
|
||||
msgid "Selected time range:"
|
||||
msgstr "ページを選択してください"
|
||||
msgstr "選択期間:"
|
||||
|
||||
#: server_status.php:1454
|
||||
msgid "Only retrieve SELECT,INSERT,UPDATE and DELETE Statements"
|
||||
msgstr ""
|
||||
msgstr "SELECT、INSERT、UPDATE、DELETE 文のみ取得する"
|
||||
|
||||
#: server_status.php:1459
|
||||
msgid "Remove variable data in INSERT statements for better grouping"
|
||||
@ -9945,7 +9944,7 @@ msgstr ""
|
||||
msgid ""
|
||||
"<p>Choose from which log you want the statistics to be generated from.</p> "
|
||||
"Results are grouped by query text."
|
||||
msgstr ""
|
||||
msgstr "<p>ログの統計元を選択することができます。</p>結果はクエリ文でグループ化されます。"
|
||||
|
||||
#: server_status.php:1465
|
||||
#, fuzzy
|
||||
|
||||
60
po/tr.po
@ -4,13 +4,13 @@ msgstr ""
|
||||
"Project-Id-Version: phpMyAdmin 3.5.0-dev\n"
|
||||
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
|
||||
"POT-Creation-Date: 2011-07-30 14:14-0400\n"
|
||||
"PO-Revision-Date: 2011-07-29 21:55+0200\n"
|
||||
"PO-Revision-Date: 2011-08-02 10:45+0200\n"
|
||||
"Last-Translator: Burak Yavuz <hitowerdigit@hotmail.com>\n"
|
||||
"Language-Team: turkish <tr@li.org>\n"
|
||||
"Language: tr\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Language: tr\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
"X-Generator: Pootle 2.0.5\n"
|
||||
|
||||
@ -1313,7 +1313,6 @@ msgid "Analysing & loading logs. This may take a while."
|
||||
msgstr "Günlükler çözümleniyor ve yükleniyor. Bu biraz zaman alabilir."
|
||||
|
||||
#: js/messages.php:143
|
||||
#, fuzzy
|
||||
#| msgid ""
|
||||
#| "This columns shows the amount of identical queries that are grouped "
|
||||
#| "together. However only the SQL Text is being compared, thus the queries "
|
||||
@ -1324,8 +1323,8 @@ msgid ""
|
||||
"the other attributes of queries, such as start time, may differ."
|
||||
msgstr ""
|
||||
"Bu sütunlar birlikte gruplanmış özdeş sorguların miktarını gösterir. Ancak "
|
||||
"sadece SQL Metin karşılaştırılır, böylece başlama zamanı gibi sorgular diğer "
|
||||
"öznitelikler farklı olabilir."
|
||||
"sadece SQL Metnin kendisi gruplama kriteri olarak kullanılır, böylece "
|
||||
"başlama zamanı gibi, sorguların diğer öznitelikleri farklı olabilir."
|
||||
|
||||
#: js/messages.php:144
|
||||
msgid ""
|
||||
@ -1346,10 +1345,9 @@ msgid "Jump to Log table"
|
||||
msgstr "Günlük tablosuna atla"
|
||||
|
||||
#: js/messages.php:148
|
||||
#, fuzzy
|
||||
#| msgid "Log analysed, but not data found in this time span."
|
||||
msgid "Log analysed, but no data found in this time span."
|
||||
msgstr "Günlük çözümlendi, ama bu zaman aralığında bulunan veri yok."
|
||||
msgstr "Günlük çözümlendi, ama bu zaman aralığı içinde bulunan veri yok."
|
||||
|
||||
#. l10n: A collection of available filters
|
||||
#: js/messages.php:151
|
||||
@ -1363,13 +1361,12 @@ msgstr "Süzgeç"
|
||||
|
||||
#: js/messages.php:154
|
||||
msgid "Filter queries by word/regexp:"
|
||||
msgstr "Kelime/düzenli ifadeye göre sorguları süz"
|
||||
msgstr "Kelime/düzenli ifadeye göre sorguları süz:"
|
||||
|
||||
#: js/messages.php:155
|
||||
#, fuzzy
|
||||
#| msgid "Group queries, ignoring variable data in WHERE statements"
|
||||
msgid "Group queries, ignoring variable data in WHERE clauses"
|
||||
msgstr "Sorguları grupla, WHERE ifadelerindeki değişken veri yoksayılıyor"
|
||||
msgstr "Grup sorguları, WHERE cümleciklerindeki değişken veri yoksayılıyor"
|
||||
|
||||
#: js/messages.php:156
|
||||
msgid "Sum of grouped rows:"
|
||||
@ -9897,7 +9894,6 @@ msgid "Monitor Instructions"
|
||||
msgstr "İzleme Yönergeleri"
|
||||
|
||||
#: server_status.php:1364
|
||||
#, fuzzy
|
||||
#| msgid ""
|
||||
#| "The phpMyAdmin Monitor can assist you in optimizing the server "
|
||||
#| "configuration and track down time intensive\n"
|
||||
@ -9914,14 +9910,12 @@ msgid ""
|
||||
"increases server load by up to 15%"
|
||||
msgstr ""
|
||||
"phpMyAdmin İzleyici sunucu yapılandırmasını uyarlamada ve yoğun sorgularda "
|
||||
"iz sürme süresinde size yardımcı\n"
|
||||
"olabilir. Sonrası için log_output'u 'TABLE'a ayarlamanız gerekecektir ve ya "
|
||||
"slow_query_log ya da general_log etkinleştirilir.\n"
|
||||
"Ancak unutmayın, general_log çok fazla veri üretir ve sunucu yükünü %15'e "
|
||||
"kadar arttırır"
|
||||
"iz sürme süresinde size yardımcı olabilir. Sonrası için log_output'u "
|
||||
"'TABLE'a ayarlamanız gerekecektir ve ya slow_query_log ya da general_log "
|
||||
"etkinleştirilir. Ancak unutmayın, general_log çok fazla veri üretir ve "
|
||||
"sunucu yükünü %15'e kadar arttırır"
|
||||
|
||||
#: server_status.php:1371
|
||||
#, fuzzy
|
||||
#| msgid ""
|
||||
#| "<b>Using the monitor:</b><br/>\n"
|
||||
#| " Ok, you are good to go! Once you click 'Start monitor' your "
|
||||
@ -9944,17 +9938,14 @@ msgid ""
|
||||
"will load statistics from the logs helping you find what caused the activity "
|
||||
"spike.</p>"
|
||||
msgstr ""
|
||||
"<b>İzleyici kullanımı:</b><br/>\n"
|
||||
"Tamam, ilerlemeye hazırsınız! Bir kere 'İzlemeyi başlat'a tıkladığınızda "
|
||||
"tarayıcınız tüm görüntülenen\n"
|
||||
"çizelgeleri düzenli aralıklarla yenileyecek. 'Ayarlar' altında çizelgeleri "
|
||||
"ekleyebilir ve yenileme oranını değiştirebilirsiniz\n"
|
||||
"veya her çizelgenin kendi dişli çark simgesini kullanarak herhangi bir "
|
||||
"çizelgeyi kaldırabilirsiniz.\n"
|
||||
"<p>Ani hareketlilik gördüğünüzde, herhangi bir çizlgede sol fare tuşunu "
|
||||
"basılı tutarak ve çizelge üzerinde kaydırarak\n"
|
||||
"ilgili zaman aralığını seçin. Bu, ani hareketlenmenin sebebini bulmanızda "
|
||||
"yardımcı olan istatistikleri günlükten\n"
|
||||
"<b>İzleyici kullanımı:</b><br/> Tamam, ilerlemeye hazırsınız! Bir kere "
|
||||
"'İzlemeyi başlat'a tıkladığınızda tarayıcınız tüm görüntülenen çizelgeleri "
|
||||
"düzenli aralıklarla yenileyecek. 'Ayarlar' altında çizelgeleri ekleyebilir "
|
||||
"ve yenileme oranını değiştirebilirsiniz veya her çizelgenin kendi dişli çark "
|
||||
"simgesini kullanarak herhangi bir çizelgeyi kaldırabilirsiniz. <p>Ani "
|
||||
"hareketlilik gördüğünüzde, herhangi bir çizlgede sol fare tuşunu basılı "
|
||||
"tutarak ve çizelge üzerinde kaydırarak ilgili zaman aralığını seçin. Bu, ani "
|
||||
"hareketlenmenin sebebini bulmanızda yardımcı olan istatistikleri günlükten "
|
||||
"yükleyecek.</p>"
|
||||
|
||||
#: server_status.php:1375
|
||||
@ -9965,14 +9956,11 @@ msgid ""
|
||||
"disable the general_log and empty its table once monitoring is not required "
|
||||
"any more."
|
||||
msgstr ""
|
||||
"<b>Lütfen unutmayın:</b>\n"
|
||||
" general_log'u etkinleştirmek sunucu yükünü %5-15 arttırabilir. Aynı "
|
||||
"zamanda günlükten oluşturulan istatistiklerin yoğun görev yükü olduğundan "
|
||||
"haberiniz olsun\n"
|
||||
" bu yüzden sadece küçük zaman aralıkları seçmek ve general_log'u "
|
||||
"etkisizleştirmek tavsiye edilir ve tablolarını bir defa boşaltmak daha fazla "
|
||||
"izlemeyi gerektirmez.\n"
|
||||
" "
|
||||
"<b>Lütfen unutmayın:</b> general_log'u etkinleştirmek sunucu yükünü %5-15 "
|
||||
"arttırabilir. Aynı zamanda günlükten oluşturulan istatistiklerin yoğun görev "
|
||||
"yükü olduğundan haberiniz olsun bu yüzden sadece küçük zaman aralıkları "
|
||||
"seçmek ve general_log'u etkisizleştirmek tavsiye edilir ve tablolarını bir "
|
||||
"defa boşaltmak daha fazla izlemeyi gerektirmez."
|
||||
|
||||
#: server_status.php:1385
|
||||
msgid "CPU Usage"
|
||||
|
||||
@ -49,7 +49,7 @@ require_once './libraries/mysql_charsets.lib.php';
|
||||
* Outputs the result
|
||||
*/
|
||||
echo '<div id="div_mysql_charset_collations">' . "\n"
|
||||
. '<table class="data">' . "\n"
|
||||
. '<table class="data noclick">' . "\n"
|
||||
. '<tr><th>' . __('Collation') . '</th>' . "\n"
|
||||
. ' <th>' . __('Description') . '</th>' . "\n"
|
||||
. '</tr>' . "\n";
|
||||
@ -61,7 +61,7 @@ foreach ($mysql_charsets as $current_charset) {
|
||||
if ($i >= $table_row_count / 2) {
|
||||
$i = 0;
|
||||
echo '</table>' . "\n"
|
||||
. '<table class="data">' . "\n"
|
||||
. '<table class="data noclick">' . "\n"
|
||||
. '<tr><th>' . __('Collation') . '</th>' . "\n"
|
||||
. ' <th>' . __('Description') . '</th>' . "\n"
|
||||
. '</tr>' . "\n";
|
||||
@ -78,7 +78,7 @@ foreach ($mysql_charsets as $current_charset) {
|
||||
$odd_row = true;
|
||||
foreach ($mysql_collations[$current_charset] as $current_collation) {
|
||||
$i++;
|
||||
echo '<tr class="noclick '
|
||||
echo '<tr class="'
|
||||
. ($odd_row ? 'odd' : 'even')
|
||||
. ($mysql_default_collations[$current_charset] == $current_collation
|
||||
? ' marked'
|
||||
|
||||
@ -50,7 +50,7 @@ if (empty($_REQUEST['engine'])
|
||||
/**
|
||||
* Displays the table header
|
||||
*/
|
||||
echo '<table>' . "\n"
|
||||
echo '<table class="noclick">' . "\n"
|
||||
. '<thead>' . "\n"
|
||||
. '<tr><th>' . __('Storage Engine') . '</th>' . "\n"
|
||||
. ' <th>' . __('Description') . '</th>' . "\n"
|
||||
@ -64,7 +64,7 @@ if (empty($_REQUEST['engine'])
|
||||
*/
|
||||
$odd_row = true;
|
||||
foreach (PMA_StorageEngine::getStorageEngines() as $engine => $details) {
|
||||
echo '<tr class="noclick '
|
||||
echo '<tr class="'
|
||||
. ($odd_row ? 'odd' : 'even')
|
||||
. ($details['Support'] == 'NO' || $details['Support'] == 'DISABLED'
|
||||
? ' disabled'
|
||||
@ -82,7 +82,7 @@ if (empty($_REQUEST['engine'])
|
||||
$PMA_Config = $GLOBALS['PMA_Config'];
|
||||
if ($PMA_Config->get('BLOBSTREAMING_PLUGINS_EXIST')) {
|
||||
// Special case for PBMS daemon which is not listed as an engine
|
||||
echo '<tr class="noclick '
|
||||
echo '<tr class="'
|
||||
. ($odd_row ? 'odd' : 'even')
|
||||
. '">' . "\n"
|
||||
. ' <td><a href="./server_engines.php'
|
||||
|
||||
@ -802,7 +802,7 @@ function printQueryStatistics() {
|
||||
|
||||
?>
|
||||
|
||||
<table id="serverstatusqueriesdetails" class="data sortable">
|
||||
<table id="serverstatusqueriesdetails" class="data sortable noclick">
|
||||
<col class="namecol" />
|
||||
<col class="valuecol" span="3" />
|
||||
<thead>
|
||||
@ -834,7 +834,7 @@ function printQueryStatistics() {
|
||||
$other_sum += $value;
|
||||
else $chart_json[$name] = $value;
|
||||
?>
|
||||
<tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; ?>">
|
||||
<tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
|
||||
<th class="name"><?php echo htmlspecialchars($name); ?></th>
|
||||
<td class="value"><?php echo PMA_formatNumber($value, 5, 0, true); ?></td>
|
||||
<td class="value"><?php echo
|
||||
@ -923,7 +923,7 @@ function printServerTraffic() {
|
||||
}
|
||||
?>
|
||||
|
||||
<table id="serverstatustraffic" class="data">
|
||||
<table id="serverstatustraffic" class="data noclick">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2"><?php echo __('Traffic') . ' ' . PMA_showHint(__('On a busy server, the byte counters may overrun, so those statistics as reported by the MySQL server may be incorrect.')); ?></th>
|
||||
@ -931,7 +931,7 @@ function printServerTraffic() {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="noclick odd">
|
||||
<tr class="odd">
|
||||
<th class="name"><?php echo __('Received'); ?></th>
|
||||
<td class="value"><?php echo
|
||||
implode(' ',
|
||||
@ -941,7 +941,7 @@ function printServerTraffic() {
|
||||
PMA_formatByteDown(
|
||||
$server_status['Bytes_received'] * $hour_factor, 3, 1)); ?></td>
|
||||
</tr>
|
||||
<tr class="noclick even">
|
||||
<tr class="even">
|
||||
<th class="name"><?php echo __('Sent'); ?></th>
|
||||
<td class="value"><?php echo
|
||||
implode(' ',
|
||||
@ -951,7 +951,7 @@ function printServerTraffic() {
|
||||
PMA_formatByteDown(
|
||||
$server_status['Bytes_sent'] * $hour_factor, 3, 1)); ?></td>
|
||||
</tr>
|
||||
<tr class="noclick odd">
|
||||
<tr class="odd">
|
||||
<th class="name"><?php echo __('Total'); ?></th>
|
||||
<td class="value"><?php echo
|
||||
implode(' ',
|
||||
@ -968,7 +968,7 @@ function printServerTraffic() {
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<table id="serverstatusconnections" class="data">
|
||||
<table id="serverstatusconnections" class="data noclick">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2"><?php echo __('Connections'); ?></th>
|
||||
@ -977,14 +977,14 @@ function printServerTraffic() {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="noclick odd">
|
||||
<tr class="odd">
|
||||
<th class="name"><?php echo __('max. concurrent connections'); ?></th>
|
||||
<td class="value"><?php echo
|
||||
PMA_formatNumber($server_status['Max_used_connections'], 0); ?> </td>
|
||||
<td class="value">--- </td>
|
||||
<td class="value">--- </td>
|
||||
</tr>
|
||||
<tr class="noclick even">
|
||||
<tr class="even">
|
||||
<th class="name"><?php echo __('Failed attempts'); ?></th>
|
||||
<td class="value"><?php echo
|
||||
PMA_formatNumber($server_status['Aborted_connects'], 4, 1, true); ?></td>
|
||||
@ -998,7 +998,7 @@ function printServerTraffic() {
|
||||
0, 2, true) . '%'
|
||||
: '--- '; ?></td>
|
||||
</tr>
|
||||
<tr class="noclick odd">
|
||||
<tr class="odd">
|
||||
<th class="name"><?php echo __('Aborted'); ?></th>
|
||||
<td class="value"><?php echo
|
||||
PMA_formatNumber($server_status['Aborted_clients'], 4, 1, true); ?></td>
|
||||
@ -1012,7 +1012,7 @@ function printServerTraffic() {
|
||||
0, 2, true) . '%'
|
||||
: '--- '; ?></td>
|
||||
</tr>
|
||||
<tr class="noclick even">
|
||||
<tr class="even">
|
||||
<th class="name"><?php echo __('Total'); ?></th>
|
||||
<td class="value"><?php echo
|
||||
PMA_formatNumber($server_status['Connections'], 4, 0); ?></td>
|
||||
@ -1058,7 +1058,7 @@ function printServerTraffic() {
|
||||
* Displays the page
|
||||
*/
|
||||
?>
|
||||
<table id="tableprocesslist" class="data clearfloat">
|
||||
<table id="tableprocesslist" class="data clearfloat noclick">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php echo __('Processes'); ?></th>
|
||||
@ -1085,7 +1085,7 @@ function printServerTraffic() {
|
||||
$url_params['kill'] = $process['Id'];
|
||||
$kill_process = 'server_status.php' . PMA_generate_common_url($url_params);
|
||||
?>
|
||||
<tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; ?>">
|
||||
<tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
|
||||
<td><a href="<?php echo $kill_process ; ?>"><?php echo __('Kill'); ?></a></td>
|
||||
<td class="value"><?php echo $process['Id']; ?></td>
|
||||
<td><?php echo $process['User']; ?></td>
|
||||
@ -1290,7 +1290,7 @@ function printVariablesTable() {
|
||||
);
|
||||
|
||||
?>
|
||||
<table class="data sortable" id="serverstatusvariables">
|
||||
<table class="data sortable noclick" id="serverstatusvariables">
|
||||
<col class="namecol" />
|
||||
<col class="valuecol" />
|
||||
<col class="descrcol" />
|
||||
@ -1308,7 +1308,7 @@ function printVariablesTable() {
|
||||
foreach ($server_status as $name => $value) {
|
||||
$odd_row = !$odd_row;
|
||||
?>
|
||||
<tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; echo isset($allocationMap[$name])?' s_'.$allocationMap[$name]:''; ?>">
|
||||
<tr class="<?php echo $odd_row ? 'odd' : 'even'; echo isset($allocationMap[$name])?' s_'.$allocationMap[$name]:''; ?>">
|
||||
<th class="name"><?php echo htmlspecialchars(str_replace('_',' ',$name)) . PMA_showMySQLDocu('server-status-variables', 'server-status-variables', false, 'statvar_' . $name); ?>
|
||||
</th>
|
||||
<td class="value"><?php
|
||||
|
||||
@ -251,33 +251,32 @@ if ((isset($_REQUEST['submit_connect']))) {
|
||||
/**
|
||||
* Displays the sub-heading and icons showing Structure Synchronization and Data Synchronization
|
||||
*/
|
||||
echo '<form name="synchronize_form" id="synchronize_form" method="post" action="server_synchronize.php">'
|
||||
. PMA_generate_common_hidden_inputs('', '');
|
||||
echo '<table id="serverstatustraffic" class="data" width = "40%">
|
||||
?>
|
||||
<form name="synchronize_form" id="synchronize_form" method="post" action="server_synchronize.php">
|
||||
<?php PMA_generate_common_hidden_inputs('', ''); ?>
|
||||
<table width="40%">
|
||||
<tr>
|
||||
<td>'
|
||||
. '<img class="icon" src="' . $pmaThemeImage . 'new_struct.jpg" width="32"'
|
||||
. ' height="32" alt="" />'
|
||||
. __('Structure Synchronization')
|
||||
.'</td>';
|
||||
echo '<td>'
|
||||
. '<img class="icon" src="' . $pmaThemeImage . 'new_data.jpg" width="32"'
|
||||
. ' height="32" alt="" />'
|
||||
. __('Data Synchronization')
|
||||
. '</td>';
|
||||
echo '</tr>
|
||||
</table>';
|
||||
|
||||
<td>
|
||||
<img class="icon" src="<?php echo $pmaThemeImage; ?>new_struct.png" width="16" height="16" alt="" />
|
||||
<?php echo __('Structure Synchronization'); ?>
|
||||
</td>
|
||||
<td>
|
||||
<img class="icon" src="<?php echo $pmaThemeImage; ?>new_data.png" width="16" height="16" alt="" />
|
||||
<?php echo __('Data Synchronization'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
/**
|
||||
* Displays the tables containing the source tables names, their difference with the target tables and target tables names
|
||||
*/
|
||||
PMA_syncDisplayHeaderSource($src_db);
|
||||
$odd_row = false;
|
||||
PMA_syncDisplayHeaderCompare($src_db, $trg_db);
|
||||
$rows = array();
|
||||
|
||||
/**
|
||||
* Display the matching tables' names and difference, first
|
||||
*/
|
||||
for($i = 0; $i < count($matching_tables); $i++) {
|
||||
for ($i = 0; $i < count($matching_tables); $i++) {
|
||||
/**
|
||||
* Calculating the number of updates for each matching table
|
||||
*/
|
||||
@ -296,12 +295,7 @@ if ((isset($_REQUEST['submit_connect']))) {
|
||||
} else {
|
||||
$num_of_insertions = 0;
|
||||
}
|
||||
/**
|
||||
* Displays the name of the matching table
|
||||
*/
|
||||
$odd_row = PMA_syncDisplayBeginTableRow($odd_row);
|
||||
echo '<td>' . htmlspecialchars($matching_tables[$i]) . '</td>
|
||||
<td align="center">';
|
||||
|
||||
/**
|
||||
* Calculating the number of alter columns, number of columns to be added, number of columns to be removed,
|
||||
* number of index to be added and removed.
|
||||
@ -331,86 +325,70 @@ if ((isset($_REQUEST['submit_connect']))) {
|
||||
$num_add_index += sizeof($alter_indexes_array[$i]);
|
||||
$num_remove_index += sizeof($alter_indexes_array[$i]);
|
||||
}
|
||||
|
||||
$btn_structure_params = null;
|
||||
$btn_data_params = null;
|
||||
|
||||
/**
|
||||
* Display the red button of structure synchronization if there exists any structure difference or index difference.
|
||||
*/
|
||||
if (($num_alter_cols > 0) || ($num_insert_cols > 0) || ($num_remove_cols > 0) || ($num_add_index > 0) || ($num_remove_index > 0)) {
|
||||
|
||||
echo '<img class="icon struct_img" src="' . $pmaThemeImage . 'new_struct.jpg" width="29" height="29"
|
||||
alt="' . __('Click to select') . '"
|
||||
onclick="showDetails(' . "'MS" . $i . "','" . $num_alter_cols . "','" .$num_insert_cols .
|
||||
"','" . $num_remove_cols . "','" . $num_add_index . "','" . $num_remove_index . "'"
|
||||
. ', this ,' . "'" . htmlspecialchars($matching_tables[$i]) . "'" . ')"/>';
|
||||
$btn_structure_params = array($i, $num_alter_cols, $num_insert_cols,
|
||||
$num_remove_cols, $num_add_index, $num_remove_index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the green button of data synchronization if there exists any data difference.
|
||||
*/
|
||||
if (isset($update_array[$i]) || isset($insert_array[$i])) {
|
||||
if (isset($update_array[$i][0][$matching_tables_keys[$i][0]]) || isset($insert_array[$i][0][$matching_tables_keys[$i][0]])) {
|
||||
|
||||
echo '<img class="icon data_img" src="' . $pmaThemeImage . 'new_data.jpg" width="29" height="29"
|
||||
alt="' . __('Click to select') . '"
|
||||
onclick="showDetails('. "'MD" . $i . "','" . $num_of_updates . "','" . $num_of_insertions .
|
||||
"','" . null . "','" . null . "','" . null . "'" . ', this ,' . "'" . htmlspecialchars($matching_tables[$i]) . "'" . ')" />';
|
||||
$btn_data_params = array($i, $num_of_updates, $num_of_insertions, null, null, null);
|
||||
}
|
||||
}
|
||||
echo '</td>
|
||||
</tr>';
|
||||
|
||||
$rows[] = array(
|
||||
'src_table_name' => $matching_tables[$i],
|
||||
'dst_table_name' => $matching_tables[$i],
|
||||
'btn_type' => 'M',
|
||||
'btn_structure' => $btn_structure_params,
|
||||
'btn_data' => $btn_data_params
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Displays the tables' names present in source but missing from target
|
||||
*/
|
||||
for ($j = 0; $j < count($source_tables_uncommon); $j++) {
|
||||
$odd_row = PMA_syncDisplayBeginTableRow($odd_row);
|
||||
echo '<td> + ' . htmlspecialchars($source_tables_uncommon[$j]) . '</td> ';
|
||||
|
||||
echo '<td align="center"><img class="icon struct_img" src="' . $pmaThemeImage . 'new_struct.jpg" width="29" height="29"
|
||||
alt="' . __('Click to select') . '"
|
||||
onclick="showDetails(' . "'US" . $j . "','" . null . "','" . null . "','" . null . "','" . null . "','" . null . "'" . ', this ,'
|
||||
. "'" . htmlspecialchars($source_tables_uncommon[$j]) . "'" . ')"/>';
|
||||
|
||||
if ($row_count[$j] > 0)
|
||||
{
|
||||
echo '<img class="icon data_img" src="' . $pmaThemeImage . 'new_data.jpg" width="29" height="29"
|
||||
alt="' . __('Click to select') . '"
|
||||
onclick="showDetails(' . "'UD" . $j . "','" . null . "','" . $row_count[$j] . "','" . null .
|
||||
"','" . null . "','" . null . "'" . ', this ,' . "'" . htmlspecialchars($source_tables_uncommon[$j]) . "'" . ')" />';
|
||||
$row = array(
|
||||
'src_table_name' => '+ ' . $source_tables_uncommon[$j],
|
||||
'dst_table_name' => $source_tables_uncommon[$j] . ' (' . __('not present') . ')',
|
||||
'btn_type' => 'U',
|
||||
'btn_structure' => array($j, null, null, null, null, null),
|
||||
'btn_data' => null
|
||||
);
|
||||
if ($row_count[$j] > 0) {
|
||||
$row['btn_data'] = array($j, null, $row_count[$j], null, null, null);
|
||||
}
|
||||
echo '</td>
|
||||
</tr>';
|
||||
$rows[] = $row;
|
||||
}
|
||||
foreach ($target_tables_uncommon as $tbl_nc_name) {
|
||||
$odd_row = PMA_syncDisplayBeginTableRow($odd_row);
|
||||
echo '<td height="32"> </td><td></td>';
|
||||
echo '</tr>';
|
||||
$rows[] = array(
|
||||
'src_table_name' => '',
|
||||
'dst_table_name' => $tbl_nc_name);
|
||||
}
|
||||
/**
|
||||
* Displays the target tables names
|
||||
*/
|
||||
echo '</table>';
|
||||
|
||||
$odd_row = PMA_syncDisplayHeaderTargetAndMatchingTables($trg_db, $matching_tables);
|
||||
foreach ($source_tables_uncommon as $tbl_nc_name) {
|
||||
$odd_row = PMA_syncDisplayBeginTableRow($odd_row);
|
||||
echo '<td height="32">' . htmlspecialchars($tbl_nc_name) . ' (' . __('not present') . ')</td>
|
||||
</tr>';
|
||||
}
|
||||
foreach ($target_tables_uncommon as $tbl_nc_name) {
|
||||
$odd_row = PMA_syncDisplayBeginTableRow($odd_row);
|
||||
echo '<td> - ' . htmlspecialchars($tbl_nc_name) . '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
echo '</div>';
|
||||
PMA_syncDisplayDataCompare($rows);
|
||||
echo '</table>
|
||||
</div>
|
||||
</fieldset>';
|
||||
|
||||
/**
|
||||
* This "list" div will contain a table and each row will depict information about structure/data diffrence in tables.
|
||||
* Rows will be generated dynamically as soon as the colored buttons "D" or "S" are clicked.
|
||||
*/
|
||||
|
||||
echo '<div id="list" style = "overflow: auto; width: 1020px; height: 140px;
|
||||
border-left: 1px gray solid; border-bottom: 1px gray solid;
|
||||
padding:0px; margin: 0px">
|
||||
echo '<fieldset style="padding:0"><div id="list" style="overflow:auto; height:140px; padding:1em">
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
@ -433,7 +411,7 @@ if ((isset($_REQUEST['submit_connect']))) {
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>';
|
||||
</div></fieldset>';
|
||||
/**
|
||||
* This fieldset displays the checkbox to confirm deletion of previous rows from target tables
|
||||
*/
|
||||
@ -700,13 +678,9 @@ if (isset($_REQUEST['Table_ids'])) {
|
||||
echo '<form name="applied_difference" id="synchronize_form" method="post" action="server_synchronize.php">'
|
||||
. PMA_generate_common_hidden_inputs('', '');
|
||||
|
||||
PMA_syncDisplayHeaderSource($src_db);
|
||||
$odd_row = false;
|
||||
PMA_syncDisplayHeaderCompare($src_db, $trg_db);
|
||||
$rows = array();
|
||||
for($i = 0; $i < count($matching_tables); $i++) {
|
||||
$odd_row = PMA_syncDisplayBeginTableRow($odd_row);
|
||||
echo '<td align="center">' . htmlspecialchars($matching_tables[$i]) . '</td>
|
||||
<td align="center">';
|
||||
|
||||
$num_alter_cols = 0;
|
||||
$num_insert_cols = 0;
|
||||
$num_remove_cols = 0;
|
||||
@ -729,11 +703,12 @@ if (isset($_REQUEST['Table_ids'])) {
|
||||
$num_remove_index = sizeof($remove_indexes_array[$i]);
|
||||
}
|
||||
|
||||
$btn_structure_params = null;
|
||||
$btn_data_params = null;
|
||||
|
||||
if (($num_alter_cols > 0) || ($num_insert_cols > 0) || ($num_remove_cols > 0) || ($num_add_index > 0) || ($num_remove_index > 0)) {
|
||||
echo '<img class="icon struct_img" src="' . $pmaThemeImage . 'new_struct.jpg" width="29" height="29"
|
||||
alt="' . __('Click to select') . '"
|
||||
onclick="showDetails(' . "'MS" . $i . "','" . $num_alter_cols . "','" . $num_insert_cols . "','" . $num_remove_cols . "','" . $num_add_index . "','" . $num_remove_index . "'" .',
|
||||
this ,' . "'" . htmlspecialchars($matching_tables[$i]) . "'" . ')"/>';
|
||||
$btn_structure_params = array($i, $num_alter_cols, $num_insert_cols,
|
||||
$num_remove_cols, $num_add_index, $num_remove_index);
|
||||
}
|
||||
if (!(in_array($i, $matching_table_data_diff))) {
|
||||
|
||||
@ -757,18 +732,20 @@ if (isset($_REQUEST['Table_ids'])) {
|
||||
}
|
||||
|
||||
if ((isset($matching_tables_keys[$i][0]) && isset($update_array[$i][0][$matching_tables_keys[$i][0]]))
|
||||
|| (isset($matching_tables_keys[$i][0]) && isset($insert_array[$i][0][$matching_tables_keys[$i][0]]))) {
|
||||
echo '<img class="icon data_img" src="' . $pmaThemeImage . 'new_data.jpg" width="29" height="29"
|
||||
alt="' . __('Click to select') . '"
|
||||
onclick="showDetails(' . "'MD" . $i . "','" . $num_of_updates . "','" . $num_of_insertions .
|
||||
"','" . null . "','" . null . "','" . null . "'" .', this ,' . "'" . htmlspecialchars($matching_tables[$i]) . "'" . ')" />';
|
||||
|| (isset($matching_tables_keys[$i][0]) && isset($insert_array[$i][0][$matching_tables_keys[$i][0]]))) {
|
||||
$btn_data_params = array($i, $num_of_updates, $num_of_insertions,
|
||||
null, null, null);
|
||||
}
|
||||
} else {
|
||||
unset($update_array[$i]);
|
||||
unset($insert_array[$i]);
|
||||
}
|
||||
echo '</td>
|
||||
</tr>';
|
||||
$rows[] = array(
|
||||
'src_table_name' => $matching_tables[$i],
|
||||
'btn_type' => 'M',
|
||||
'btn_structure' => $btn_structure_params,
|
||||
'btn_data' => $btn_data_params
|
||||
);
|
||||
}
|
||||
/**
|
||||
* placing updated value of arrays in session
|
||||
@ -778,37 +755,39 @@ if (isset($_REQUEST['Table_ids'])) {
|
||||
$_SESSION['insert_array'] = $insert_array;
|
||||
|
||||
for ($j = 0; $j < count($source_tables_uncommon); $j++) {
|
||||
$odd_row = PMA_syncDisplayBeginTableRow($odd_row);
|
||||
echo '<td align="center"> + ' . htmlspecialchars($source_tables_uncommon[$j]) . '</td>
|
||||
<td align="center">';
|
||||
$btn_structure_params = null;
|
||||
$btn_data_params = null;
|
||||
|
||||
/**
|
||||
* Display the difference only when it has not been applied
|
||||
*/
|
||||
if (!(in_array($j, $uncommon_table_structure_diff))) {
|
||||
if (isset($uncommon_tables[$j])) {
|
||||
echo '<img class="icon struct_img" src="' . $pmaThemeImage . 'new_struct.jpg" width="29" height="29"
|
||||
alt="' . __('Click to select') . '"
|
||||
onclick="showDetails(' . "'US" . $j . "','" . null . "','" . null . "','" . null . "','" . null . "','" . null . "'" . ', this ,' . "'" . htmlspecialchars($source_tables_uncommon[$j]) . "'" . ')"/>' .' ';
|
||||
$btn_structure_params = array($j, null, null, null, null, null);
|
||||
}
|
||||
$dst_table_name = $source_tables_uncommon[$j] . ' (' . __('not present') . ')';
|
||||
} else {
|
||||
unset($uncommon_tables[$j]);
|
||||
$dst_table_name = $source_tables_uncommon[$j];
|
||||
}
|
||||
/**
|
||||
* Display the difference only when it has not been applied
|
||||
*/
|
||||
if (!(in_array($j, $uncommon_table_data_diff))) {
|
||||
if (isset($row_count[$j]) && ($row_count > 0)) {
|
||||
echo '<img class="icon data_img" src="' . $pmaThemeImage . 'new_data.jpg" width="29" height="29"
|
||||
alt="' . __('Click to select') . '"
|
||||
onclick="showDetails(' . "'UD" . $j . "','" . null ."','" . $row_count[$j] ."','"
|
||||
. null . "','" . null . "','" . null . "'" . ', this ,' . "'". htmlspecialchars($source_tables_uncommon[$j]) . "'" . ')" />';
|
||||
if (isset($row_count[$j]) && ($row_count[$j] > 0)) {
|
||||
$btn_data_params = array($j, null, $row_count[$j], null, null, null);
|
||||
}
|
||||
} else {
|
||||
unset($row_count[$j]);
|
||||
}
|
||||
|
||||
echo '</td>
|
||||
</tr>';
|
||||
$rows[] = array(
|
||||
'src_table_name' => $source_tables_uncommon[$j],
|
||||
'dst_table_name' => $dst_table_name,
|
||||
'btn_type' => 'U',
|
||||
'btn_structure' => $btn_structure_params,
|
||||
'btn_data' => $btn_data_params
|
||||
);
|
||||
}
|
||||
/**
|
||||
* placing the latest values of arrays in session
|
||||
@ -822,39 +801,21 @@ if (isset($_REQUEST['Table_ids'])) {
|
||||
* Displaying the target database tables
|
||||
*/
|
||||
foreach ($target_tables_uncommon as $tbl_nc_name) {
|
||||
$odd_row = PMA_syncDisplayBeginTableRow($odd_row);
|
||||
echo '<td> </td><td></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
$odd_row = PMA_syncDisplayHeaderTargetAndMatchingTables($trg_db, $matching_tables);
|
||||
foreach ($source_tables_uncommon as $tbl_nc_name) {
|
||||
$odd_row = PMA_syncDisplayBeginTableRow($odd_row);
|
||||
if (in_array($tbl_nc_name, $uncommon_tables)) {
|
||||
echo '<td>' . htmlspecialchars($tbl_nc_name) . ' (' . __('not present') . ')</td>';
|
||||
} else {
|
||||
echo '<td>' . htmlspecialchars($tbl_nc_name) . '</td>';
|
||||
}
|
||||
echo '
|
||||
</tr>';
|
||||
}
|
||||
foreach ($target_tables_uncommon as $tbl_nc_name) {
|
||||
$odd_row = PMA_syncDisplayBeginTableRow($odd_row);
|
||||
echo '<td> - ' . htmlspecialchars($tbl_nc_name) . '</td>';
|
||||
echo '</tr>';
|
||||
$rows[] = array(
|
||||
'src_table_name' => '',
|
||||
'dst_table_name' => $tbl_nc_name);
|
||||
}
|
||||
PMA_syncDisplayDataCompare($rows);
|
||||
echo '</table>
|
||||
</div>';
|
||||
</div>
|
||||
</fieldset>';
|
||||
|
||||
/**
|
||||
* This "list" div will contain a table and each row will depict information about structure/data diffrence in tables.
|
||||
* Rows will be generated dynamically as soon as the colored buttons "D" or "S" are clicked.
|
||||
*/
|
||||
|
||||
echo '<div id="list" style = "overflow: auto; width: 1020px; height: 140px;
|
||||
border-left: 1px gray solid; border-bottom: 1px gray solid;
|
||||
padding:0px; margin: 0px">';
|
||||
|
||||
echo '<fieldset style="padding:0"><div id="list" style = "overflow:auto; height:140px; padding:1em">';
|
||||
echo '<table>
|
||||
<thead>
|
||||
<tr style="width: 100%;">
|
||||
@ -876,7 +837,7 @@ if (isset($_REQUEST['Table_ids'])) {
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>';
|
||||
</div></fieldset>';
|
||||
|
||||
/**
|
||||
* This fieldset displays the checkbox to confirm deletion of previous rows from target tables
|
||||
@ -938,40 +899,28 @@ if (isset($_REQUEST['synchronize_db'])) {
|
||||
/**
|
||||
* Displaying all the tables of source and target database and now no difference is there.
|
||||
*/
|
||||
PMA_syncDisplayHeaderSource($src_db);
|
||||
|
||||
$odd_row = false;
|
||||
for($i = 0; $i < count($matching_tables); $i++)
|
||||
{
|
||||
$odd_row = PMA_syncDisplayBeginTableRow($odd_row);
|
||||
echo '<td>' . htmlspecialchars($matching_tables[$i]) . '</td>
|
||||
<td></td>
|
||||
</tr>';
|
||||
}
|
||||
for ($j = 0; $j < count($source_tables_uncommon); $j++) {
|
||||
$odd_row = PMA_syncDisplayBeginTableRow($odd_row);
|
||||
echo '<td> + ' . htmlspecialchars($source_tables_uncommon[$j]) . '</td> ';
|
||||
echo '<td></td>
|
||||
</tr>';
|
||||
}
|
||||
foreach ($target_tables_uncommon as $tbl_nc_name) {
|
||||
$odd_row = PMA_syncDisplayBeginTableRow($odd_row);
|
||||
echo '<td> </td><td></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
$odd_row = PMA_syncDisplayHeaderTargetAndMatchingTables($trg_db, $matching_tables);
|
||||
foreach ($source_tables_uncommon as $tbl_nc_name) {
|
||||
$odd_row = PMA_syncDisplayBeginTableRow($odd_row);
|
||||
echo '<td>' . htmlspecialchars($tbl_nc_name) . ' </td>
|
||||
</tr>';
|
||||
}
|
||||
foreach ($target_tables_uncommon as $tbl_nc_name) {
|
||||
$odd_row = PMA_syncDisplayBeginTableRow($odd_row);
|
||||
echo '<td> ' . htmlspecialchars($tbl_nc_name) . '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</table> </div>';
|
||||
PMA_syncDisplayHeaderCompare($src_db, $trg_db);
|
||||
$rows = array();
|
||||
for ($i = 0; $i < count($matching_tables); $i++)
|
||||
{
|
||||
$rows[] = array(
|
||||
'src_table_name' => $matching_tables[$i],
|
||||
'dst_table_name' => $matching_tables[$i]);
|
||||
}
|
||||
foreach ($source_tables_uncommon as $tbl_nc_name) {
|
||||
$rows[] = array(
|
||||
'src_table_name' => '+ ' + $tbl_nc_name,
|
||||
'dst_table_name' => $tbl_nc_name);
|
||||
}
|
||||
foreach ($target_tables_uncommon as $tbl_nc_name) {
|
||||
$rows[] = array(
|
||||
'src_table_name' => '',
|
||||
'dst_table_name' => $tbl_nc_name);
|
||||
}
|
||||
PMA_syncDisplayDataCompare($rows);
|
||||
echo '</table>
|
||||
</div>
|
||||
</fieldset>';
|
||||
|
||||
/**
|
||||
* connecting the source and target servers
|
||||
@ -1114,7 +1063,7 @@ if (isset($_REQUEST['synchronize_db'])) {
|
||||
|
||||
$database_header .= PMA_showHint(PMA_sanitize(sprintf('%sAllowArbitraryServer%s', '[a@./Documentation.html#AllowArbitraryServer@_blank]', '[/a]')));
|
||||
?>
|
||||
<table id="serverconnection_<?php echo $type; ?>_remote" class="data">
|
||||
<table id="serverconnection_<?php echo $type; ?>_remote" class="data noclick">
|
||||
<caption class="tblHeaders"><?php echo $database_header; ?></caption>
|
||||
<tr class="odd">
|
||||
<td colspan="2" style="text-align: center">
|
||||
|
||||
@ -102,7 +102,7 @@ isSuperuser = <?php echo PMA_isSuperuser()?'true':'false'; ?>;
|
||||
<input name="filterText" type="text" id="filterText" style="vertical-align: baseline;" />
|
||||
</div>
|
||||
</fieldset>
|
||||
<table id="serverVariables" class="data filteredData">
|
||||
<table id="serverVariables" class="data filteredData noclick">
|
||||
<thead>
|
||||
<tr><th><?php echo __('Variable'); ?></th>
|
||||
<th class="valueHeader">
|
||||
@ -118,7 +118,7 @@ echo __('Session value') . ' / ' . __('Global value');
|
||||
$odd_row = true;
|
||||
foreach ($serverVars as $name => $value) {
|
||||
?>
|
||||
<tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; ?>">
|
||||
<tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
|
||||
<th nowrap="nowrap"><?php echo htmlspecialchars(str_replace('_', ' ', $name)); ?></th>
|
||||
<td class="value"><?php echo formatVariable($name,$value); ?></td>
|
||||
<td class="value"><?php
|
||||
@ -129,7 +129,7 @@ foreach ($serverVars as $name => $value) {
|
||||
if (isset($serverVarsSession[$name]) && $serverVarsSession[$name] != $value) {
|
||||
?>
|
||||
</tr>
|
||||
<tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; ?> ">
|
||||
<tr class="<?php echo $odd_row ? 'odd' : 'even'; ?> ">
|
||||
<td>(<?php echo __('Session value'); ?>)</td>
|
||||
<td class="value"><?php echo formatVariable($name,$serverVarsSession[$name]); ?></td>
|
||||
<td class="value"></td>
|
||||
|
||||
@ -115,14 +115,20 @@ function PMA_version_check()
|
||||
$data = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
} else {
|
||||
messages_set('error', $message_id, __('Version check'),
|
||||
messages_set(
|
||||
'error',
|
||||
$message_id,
|
||||
__('Version check'),
|
||||
__('Neither URL wrapper nor CURL is available. Version check is not possible.'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($data)) {
|
||||
messages_set('error', $message_id, __('Version check'),
|
||||
messages_set(
|
||||
'error',
|
||||
$message_id,
|
||||
__('Version check'),
|
||||
__('Reading of version failed. Maybe you\'re offline or the upgrade server does not respond.'));
|
||||
return;
|
||||
}
|
||||
@ -139,14 +145,20 @@ function PMA_version_check()
|
||||
|
||||
$version_upstream = version_to_int($version);
|
||||
if ($version_upstream === false) {
|
||||
messages_set('error', $message_id, __('Version check'),
|
||||
messages_set(
|
||||
'error',
|
||||
$message_id,
|
||||
__('Version check'),
|
||||
__('Got invalid version string from server'));
|
||||
return;
|
||||
}
|
||||
|
||||
$version_local = version_to_int($GLOBALS['PMA_Config']->get('PMA_VERSION'));
|
||||
if ($version_local === false) {
|
||||
messages_set('error', $message_id, __('Version check'),
|
||||
messages_set(
|
||||
'error',
|
||||
$message_id,
|
||||
__('Version check'),
|
||||
__('Unparsable version string'));
|
||||
return;
|
||||
}
|
||||
@ -154,14 +166,23 @@ function PMA_version_check()
|
||||
if ($version_upstream > $version_local) {
|
||||
$version = htmlspecialchars($version);
|
||||
$date = htmlspecialchars($date);
|
||||
messages_set('notice', $message_id, __('Version check'),
|
||||
messages_set(
|
||||
'notice',
|
||||
$message_id,
|
||||
__('Version check'),
|
||||
sprintf(__('A newer version of phpMyAdmin is available and you should consider upgrading. The newest version is %s, released on %s.'), $version, $date));
|
||||
} else {
|
||||
if ($version_local % 100 == 0) {
|
||||
messages_set('notice', $message_id, __('Version check'),
|
||||
messages_set(
|
||||
'notice',
|
||||
$message_id,
|
||||
__('Version check'),
|
||||
PMA_sanitize(sprintf(__('You are using Git version, run [kbd]git pull[/kbd] :-)[br]The latest stable version is %s, released on %s.'), $version, $date)));
|
||||
} else {
|
||||
messages_set('notice', $message_id, __('Version check'),
|
||||
messages_set(
|
||||
'notice',
|
||||
$message_id,
|
||||
__('Version check'),
|
||||
__('No newer stable version is available'));
|
||||
}
|
||||
}
|
||||
@ -197,7 +218,10 @@ function version_to_int($version)
|
||||
$added = 0;
|
||||
break;
|
||||
default:
|
||||
messages_set('notice', 'version_match', __('Version check'),
|
||||
messages_set(
|
||||
'notice',
|
||||
'version_match',
|
||||
__('Version check'),
|
||||
'Unknown version part: ' . htmlspecialchars($matches[6]));
|
||||
$added = 0;
|
||||
break;
|
||||
@ -292,7 +316,10 @@ function perform_config_checks()
|
||||
//
|
||||
if (!$cf->getValue("Servers/$i/ssl")) {
|
||||
$title = PMA_lang(PMA_lang_name('Servers/1/ssl')) . " ($server_name)";
|
||||
messages_set('notice', "Servers/$i/ssl", $title,
|
||||
messages_set(
|
||||
'notice',
|
||||
"Servers/$i/ssl",
|
||||
$title,
|
||||
__('You should use SSL connections if your web server supports it.'));
|
||||
}
|
||||
|
||||
@ -302,7 +329,10 @@ function perform_config_checks()
|
||||
//
|
||||
if ($cf->getValue("Servers/$i/extension") == 'mysql') {
|
||||
$title = PMA_lang(PMA_lang_name('Servers/1/extension')) . " ($server_name)";
|
||||
messages_set('notice', "Servers/$i/extension", $title,
|
||||
messages_set(
|
||||
'notice',
|
||||
"Servers/$i/extension",
|
||||
$title,
|
||||
__('You should use mysqli for performance reasons.'));
|
||||
}
|
||||
|
||||
@ -314,9 +344,12 @@ function perform_config_checks()
|
||||
&& $cf->getValue("Servers/$i/user") != ''
|
||||
&& $cf->getValue("Servers/$i/password") != '') {
|
||||
$title = PMA_lang(PMA_lang_name('Servers/1/auth_type')) . " ($server_name)";
|
||||
messages_set('notice', "Servers/$i/auth_type", $title,
|
||||
PMA_lang($strServerAuthConfigMsg, $i) . ' ' .
|
||||
PMA_lang($strSecurityInfoMsg, $i));
|
||||
messages_set(
|
||||
'notice',
|
||||
"Servers/$i/auth_type",
|
||||
$title,
|
||||
PMA_lang($strServerAuthConfigMsg, $i) . ' ' .
|
||||
PMA_lang($strSecurityInfoMsg, $i));
|
||||
}
|
||||
|
||||
//
|
||||
@ -327,9 +360,12 @@ function perform_config_checks()
|
||||
if ($cf->getValue("Servers/$i/AllowRoot")
|
||||
&& $cf->getValue("Servers/$i/AllowNoPassword")) {
|
||||
$title = PMA_lang(PMA_lang_name('Servers/1/AllowNoPassword')) . " ($server_name)";
|
||||
messages_set('notice', "Servers/$i/AllowNoPassword", $title,
|
||||
__('You allow for connecting to the server without a password.') . ' ' .
|
||||
PMA_lang($strSecurityInfoMsg, $i));
|
||||
messages_set(
|
||||
'notice',
|
||||
"Servers/$i/AllowNoPassword",
|
||||
$title,
|
||||
__('You allow for connecting to the server without a password.') . ' ' .
|
||||
PMA_lang($strSecurityInfoMsg, $i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -340,7 +376,9 @@ function perform_config_checks()
|
||||
if ($cookie_auth_used) {
|
||||
if ($blowfish_secret_set) {
|
||||
// 'cookie' auth used, blowfish_secret was generated
|
||||
messages_set('notice', 'blowfish_secret_created',
|
||||
messages_set(
|
||||
'notice',
|
||||
'blowfish_secret_created',
|
||||
PMA_lang(PMA_lang_name('blowfish_secret')),
|
||||
$strBlowfishSecretMsg);
|
||||
} else {
|
||||
@ -358,7 +396,9 @@ function perform_config_checks()
|
||||
$blowfish_warnings[] = PMA_lang(__('Key should contain letters, numbers [em]and[/em] special characters.'));
|
||||
}
|
||||
if (!empty($blowfish_warnings)) {
|
||||
messages_set('error', 'blowfish_warnings' . count($blowfish_warnings),
|
||||
messages_set(
|
||||
'error',
|
||||
'blowfish_warnings' . count($blowfish_warnings),
|
||||
PMA_lang(PMA_lang_name('blowfish_secret')),
|
||||
implode('<br />', $blowfish_warnings));
|
||||
}
|
||||
@ -370,7 +410,9 @@ function perform_config_checks()
|
||||
// should be enabled if possible
|
||||
//
|
||||
if (!$cf->getValue('ForceSSL')) {
|
||||
messages_set('notice', 'ForceSSL',
|
||||
messages_set(
|
||||
'notice',
|
||||
'ForceSSL',
|
||||
PMA_lang(PMA_lang_name('ForceSSL')),
|
||||
PMA_lang($strForceSSLNotice));
|
||||
}
|
||||
@ -380,7 +422,9 @@ function perform_config_checks()
|
||||
// should be disabled
|
||||
//
|
||||
if ($cf->getValue('AllowArbitraryServer')) {
|
||||
messages_set('notice', 'AllowArbitraryServer',
|
||||
messages_set(
|
||||
'notice',
|
||||
'AllowArbitraryServer',
|
||||
PMA_lang(PMA_lang_name('AllowArbitraryServer')),
|
||||
PMA_lang($strAllowArbitraryServerWarning));
|
||||
}
|
||||
@ -394,7 +438,9 @@ function perform_config_checks()
|
||||
$message_type = $cf->getValue('LoginCookieValidity') > ini_get('session.gc_maxlifetime')
|
||||
? 'error'
|
||||
: 'notice';
|
||||
messages_set($message_type, 'LoginCookieValidity',
|
||||
messages_set(
|
||||
$message_type,
|
||||
'LoginCookieValidity',
|
||||
PMA_lang(PMA_lang_name('LoginCookieValidity')),
|
||||
PMA_lang($strLoginCookieValidityWarning));
|
||||
}
|
||||
@ -404,7 +450,9 @@ function perform_config_checks()
|
||||
// should be at most 1800 (30 min)
|
||||
//
|
||||
if ($cf->getValue('LoginCookieValidity') > 1800) {
|
||||
messages_set('notice', 'LoginCookieValidity',
|
||||
messages_set(
|
||||
'notice',
|
||||
'LoginCookieValidity',
|
||||
PMA_lang(PMA_lang_name('LoginCookieValidity')),
|
||||
PMA_lang($strLoginCookieValidityWarning2));
|
||||
}
|
||||
@ -415,7 +463,9 @@ function perform_config_checks()
|
||||
// LoginCookieValidity must be less or equal to LoginCookieStore
|
||||
//
|
||||
if ($cf->getValue('LoginCookieStore') != 0 && $cf->getValue('LoginCookieValidity') > $cf->getValue('LoginCookieStore')) {
|
||||
messages_set('error', 'LoginCookieValidity',
|
||||
messages_set(
|
||||
'error',
|
||||
'LoginCookieValidity',
|
||||
PMA_lang(PMA_lang_name('LoginCookieValidity')),
|
||||
PMA_lang($strLoginCookieValidityWarning3));
|
||||
}
|
||||
@ -425,7 +475,9 @@ function perform_config_checks()
|
||||
// should not be world-accessible
|
||||
//
|
||||
if ($cf->getValue('SaveDir') != '') {
|
||||
messages_set('notice', 'SaveDir',
|
||||
messages_set(
|
||||
'notice',
|
||||
'SaveDir',
|
||||
PMA_lang(PMA_lang_name('SaveDir')),
|
||||
PMA_lang($strDirectoryNotice));
|
||||
}
|
||||
@ -435,7 +487,9 @@ function perform_config_checks()
|
||||
// should not be world-accessible
|
||||
//
|
||||
if ($cf->getValue('TempDir') != '') {
|
||||
messages_set('notice', 'TempDir',
|
||||
messages_set(
|
||||
'notice',
|
||||
'TempDir',
|
||||
PMA_lang(PMA_lang_name('TempDir')),
|
||||
PMA_lang($strDirectoryNotice));
|
||||
}
|
||||
@ -446,7 +500,9 @@ function perform_config_checks()
|
||||
//
|
||||
if ($cf->getValue('GZipDump')
|
||||
&& (@!function_exists('gzopen') || @!function_exists('gzencode'))) {
|
||||
messages_set('error', 'GZipDump',
|
||||
messages_set(
|
||||
'error',
|
||||
'GZipDump',
|
||||
PMA_lang(PMA_lang_name('GZipDump')),
|
||||
PMA_lang($strGZipDumpWarning, 'gzencode'));
|
||||
}
|
||||
@ -463,7 +519,9 @@ function perform_config_checks()
|
||||
$functions .= @function_exists('bzcompress')
|
||||
? ''
|
||||
: ($functions ? ', ' : '') . 'bzcompress';
|
||||
messages_set('error', 'BZipDump',
|
||||
messages_set(
|
||||
'error',
|
||||
'BZipDump',
|
||||
PMA_lang(PMA_lang_name('BZipDump')),
|
||||
PMA_lang($strBZipDumpWarning, $functions));
|
||||
}
|
||||
@ -473,7 +531,9 @@ function perform_config_checks()
|
||||
// requires zip_open in import
|
||||
//
|
||||
if ($cf->getValue('ZipDump') && !@function_exists('zip_open')) {
|
||||
messages_set('error', 'ZipDump_import',
|
||||
messages_set(
|
||||
'error',
|
||||
'ZipDump_import',
|
||||
PMA_lang(PMA_lang_name('ZipDump')),
|
||||
PMA_lang($strZipDumpImportWarning, 'zip_open'));
|
||||
}
|
||||
@ -483,7 +543,9 @@ function perform_config_checks()
|
||||
// requires gzcompress in export
|
||||
//
|
||||
if ($cf->getValue('ZipDump') && !@function_exists('gzcompress')) {
|
||||
messages_set('error', 'ZipDump_export',
|
||||
messages_set(
|
||||
'error',
|
||||
'ZipDump_export',
|
||||
PMA_lang(PMA_lang_name('ZipDump')),
|
||||
PMA_lang($strZipDumpExportWarning, 'gzcompress'));
|
||||
}
|
||||
|
||||
@ -130,9 +130,9 @@ if (isset($_REQUEST['do_save_data'])) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( $GLOBALS['is_ajax_request'] == true) {
|
||||
if ( $_REQUEST['ajax_request'] == true) {
|
||||
$extra_data['sql_query'] = PMA_showMessage(NULL, $sql_query);
|
||||
PMA_ajaxResponse($message, $message->isSuccess(),$extra_data);
|
||||
PMA_ajaxResponse($message, $message->isSuccess(), $extra_data);
|
||||
}
|
||||
|
||||
$active_page = 'tbl_structure.php';
|
||||
|
||||
@ -65,6 +65,13 @@ if (PMA_isValid($_REQUEST['new_name'])) {
|
||||
$db = $_REQUEST['target_db'];
|
||||
$table = $_REQUEST['new_name'];
|
||||
}
|
||||
|
||||
if ( $_REQUEST['ajax_request'] == true) {
|
||||
$extra_data['sql_query'] = PMA_showMessage(NULL, $sql_query);
|
||||
$extra_data['db'] = $GLOBALS['db'];
|
||||
PMA_ajaxResponse($message, $message->isSuccess(), $extra_data);
|
||||
}
|
||||
|
||||
$reload = 1;
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -229,7 +229,7 @@ if (isset($result) && empty($message_to_show)) {
|
||||
$_message = $result ? $message = PMA_Message::success(__('Your SQL query has been executed successfully')) : PMA_Message::error(__('Error'));
|
||||
// $result should exist, regardless of $_message
|
||||
$_type = $result ? 'success' : 'error';
|
||||
if ( $GLOBALS['is_ajax_request'] == true) {
|
||||
if ( $_REQUEST['ajax_request'] == true) {
|
||||
$extra_data['sql_query'] = PMA_showMessage(NULL, $sql_query);
|
||||
PMA_ajaxResponse($_message,$_message->isSuccess() ,$extra_data);
|
||||
}
|
||||
@ -238,7 +238,7 @@ if (isset($result) && empty($message_to_show)) {
|
||||
$_message = new PMA_Message;
|
||||
$_message->addMessages($warning_messages);
|
||||
$_message->isError(true);
|
||||
if ( $GLOBALS['is_ajax_request'] == true) {
|
||||
if ( $_REQUEST['ajax_request'] == true) {
|
||||
PMA_ajaxResponse($_message, false);
|
||||
}
|
||||
unset($warning_messages);
|
||||
@ -532,7 +532,7 @@ if (isset($possible_row_formats[$tbl_type])) {
|
||||
|
||||
<!-- Copy table -->
|
||||
<div class="operations_half_width">
|
||||
<form method="post" action="tbl_operations.php"
|
||||
<form method="post" action="tbl_operations.php" name="copyTable" id="copyTable" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : '');?>
|
||||
onsubmit="return emptyFormElements(this, 'new_name')">
|
||||
<?php echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?>
|
||||
<input type="hidden" name="reload" value="1" />
|
||||
|
||||
|
Before Width: | Height: | Size: 1.9 KiB |
BIN
themes/original/img/new_data.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
BIN
themes/original/img/new_data_hovered.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
BIN
themes/original/img/new_data_selected.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
BIN
themes/original/img/new_data_selected_hovered.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
BIN
themes/original/img/new_struct.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
BIN
themes/original/img/new_struct_hovered.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
BIN
themes/original/img/new_struct_selected.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
BIN
themes/original/img/new_struct_selected_hovered.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
BIN
themes/pmahomme/img/new_data.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
BIN
themes/pmahomme/img/new_data_hovered.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
BIN
themes/pmahomme/img/new_data_selected.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
BIN
themes/pmahomme/img/new_data_selected_hovered.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
BIN
themes/pmahomme/img/new_struct.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
BIN
themes/pmahomme/img/new_struct_hovered.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
BIN
themes/pmahomme/img/new_struct_selected.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
BIN
themes/pmahomme/img/new_struct_selected_hovered.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |