Merge branch 'master' of https://github.com/phpmyadmin/phpmyadmin into 0706_UT_serverview

This commit is contained in:
xmujay 2013-07-10 22:17:05 +08:00
commit 92f1116ca3
53 changed files with 1852 additions and 1221 deletions

View File

@ -32,6 +32,7 @@ phpMyAdmin - ChangeLog
- bug #3989 Reloading privileges does not update the interface
- bug #3960 NavigationBarIconic config not honored
- bug #3985 Call to undefined function mb_detect_encoding
- bug #4007 Analyze option not shown for InnoDB tables
4.0.4.1 (2013-06-30)
- [security] Global variables scope injection vulnerability (see PMASA-2013-7)

View File

@ -28,32 +28,6 @@ require_once 'libraries/sql_query_form.lib.php';
$goto = 'db_sql.php';
$back = 'db_sql.php';
/**
* Sets globals from $_GET
*/
$get_params = array(
'db_query_force'
);
foreach ($get_params as $one_get_param) {
if (isset($_GET[$one_get_param])) {
$GLOBALS[$one_get_param] = $_GET[$one_get_param];
}
}
/**
* Gets informations about the database and, if it is empty, move to the
* "db_structure.php" script where table can be created
*/
require 'libraries/db_info.inc.php';
if ($num_tables == 0 && empty($db_query_force)) {
$sub_part = '';
$is_info = true;
include 'db_structure.php';
exit();
}
/**
* Query box, bookmark, insert data from textfile
*/

View File

@ -271,7 +271,7 @@ function PMA_gzencodeNeeded()
if (@function_exists('gzencode')
&& ! @ini_get('zlib.output_compression')
&& ! (function_exists('apache_get_modules')
&& in_array('mod_deflate', apache_get_modules()))
&& in_array('mod_deflate', apache_get_modules()))
&& ! PMA_isGzHandlerEnabled()
) {
return true;

View File

@ -534,11 +534,10 @@ if (isset($GLOBALS['dbi']) && !PMA_DRIZZLE) {
}
/**
* Warning about Suhosin
* Warning about Suhosin only if its simulation mode is not enabled
*/
if ($cfg['SuhosinDisableWarning'] == false
&& @ini_get('suhosin.request.max_value_length')
// warn about Suhosin only if its simulation mode is not enabled
&& @ini_get('suhosin.simulation') == '0'
) {
trigger_error(

View File

@ -1219,8 +1219,7 @@ class PMA_DbQbe
$from_clause = '';
if (isset($_POST['criteriaColumn']) && count($_POST['criteriaColumn']) > 0) {
// Initialize some variables
$all_tables = $all_columns = $known_tables = $remaining_tables = array();
$left_join = '';
$all_tables = $all_columns = array();
// We only start this if we have fields, otherwise it would be dumb
foreach ($_POST['criteriaColumn'] as $value) {

View File

@ -379,7 +379,7 @@ class PMA_DisplayResults
* 2.2.1
* @todo defines edit/delete links depending on show statement
*/
$tmp = preg_match(
preg_match(
'@^SHOW[[:space:]]+(VARIABLES|(FULL[[:space:]]+)?'
. 'PROCESSLIST|STATUS|TABLE|GRANTS|CREATE|LOGS|DATABASES|FIELDS'
. ')@i',
@ -1484,17 +1484,10 @@ class PMA_DisplayResults
$highlight_columns = array();
if (isset($analyzed_sql) && isset($analyzed_sql[0])
&& isset($analyzed_sql[0]['where_clause_identifiers'])
&& is_array($analyzed_sql[0]['where_clause_identifiers'])
) {
$wi = 0;
if (isset($analyzed_sql[0]['where_clause_identifiers'])
&& is_array($analyzed_sql[0]['where_clause_identifiers'])
) {
foreach ($analyzed_sql[0]['where_clause_identifiers']
as $wci_nr => $wci
) {
$highlight_columns[$wci] = 'true';
}
foreach ($analyzed_sql[0]['where_clause_identifiers'] as $wci) {
$highlight_columns[$wci] = 'true';
}
}
@ -4592,11 +4585,7 @@ class PMA_DisplayResults
}
$tabs = '(\'' . join('\',\'', $target) . '\')';
if (! strlen($this->__get('table'))) {
$exist_rel = false;
} else {
if (strlen($this->__get('table'))) {
// This method set the values for $map array
$this->_setParamForLinkForeignKeyRelatedTables($map);
} // end if
@ -4609,7 +4598,6 @@ class PMA_DisplayResults
)
. '<tbody>' . "\n";
$url_query = '';
$table_html .= $this->_getTableBody(
$dt_result, $is_display, $map, $analyzed_sql, $is_limited_display
);
@ -5036,13 +5024,6 @@ class PMA_DisplayResults
$url_query = $this->__get('url_query');
$delete_text = ($del_link == self::DELETE_ROW) ? __('Delete') : __('Kill');
$_url_params = array(
'db' => $this->__get('db'),
'table' => $this->__get('table'),
'sql_query' => $this->__get('sql_query'),
'goto' => $this->__get('goto'),
);
if ($_SESSION['tmp_user_values']['disp_direction'] != self::DISP_DIR_VERTICAL) {
$links_html .= '<img class="selectallarrow" width="38" height="22"'

View File

@ -327,8 +327,9 @@ class PMA_File
* @access public
* @static
*/
public function fetchUploadedFromTblChangeRequestMultiple($file, $rownumber, $key)
{
public function fetchUploadedFromTblChangeRequestMultiple(
$file, $rownumber, $key
) {
$new_file = array(
'name' => $file['name']['multi_edit'][$rownumber][$key],
'type' => $file['type']['multi_edit'][$rownumber][$key],

View File

@ -144,7 +144,7 @@ class PMA_Menu
$GLOBALS['cfg']['TabsMode'],
array('icons', 'both')
)
) {
) {
$retval .= PMA_Util::getImage(
's_host.png',
'',
@ -165,7 +165,7 @@ class PMA_Menu
$GLOBALS['cfg']['TabsMode'],
array('icons', 'both')
)
) {
) {
$retval .= PMA_Util::getImage(
's_db.png',
'',
@ -191,7 +191,7 @@ class PMA_Menu
$GLOBALS['cfg']['TabsMode'],
array('icons', 'both')
)
) {
) {
$icon = $tbl_is_view ? 'b_views.png' : 's_tbl.png';
$retval .= PMA_Util::getImage(
$icon,
@ -259,7 +259,6 @@ class PMA_Menu
{
$db_is_information_schema = $GLOBALS['dbi']->isSystemSchema($this->_db);
$tbl_is_view = PMA_Table::isView($this->_db, $this->_table);
$table_info_num_rows = PMA_Table::countRecords($this->_db, $this->_table);
$tabs = array();
@ -358,7 +357,6 @@ class PMA_Menu
$tabs['structure']['icon'] = 'b_props.png';
$tabs['sql']['link'] = 'db_sql.php';
$tabs['sql']['args']['db_query_force'] = 1;
$tabs['sql']['text'] = __('SQL');
$tabs['sql']['icon'] = 'b_sql.png';
@ -447,7 +445,7 @@ class PMA_Menu
$is_superuser = isset($GLOBALS['dbi']) && $GLOBALS['dbi']->isSuperuser();
$binary_logs = null;
if (isset($GLOBALS['dbi'])
&& (! defined('PMA_DRIZZLE')
&& (! defined('PMA_DRIZZLE')
|| (defined('PMA_DRIZZLE') && ! PMA_DRIZZLE)
)
) {

View File

@ -41,9 +41,12 @@ class PMA_PDF extends TCPDF
* @access public
*/
public function __construct($orientation = 'P', $unit = 'mm', $format = 'A4',
$unicode = true, $encoding = 'UTF-8', $diskcache = false
$unicode = true, $encoding = 'UTF-8', $diskcache = false, $pdfa=false
) {
parent::__construct();
parent::__construct(
$orientation, $unit, $format, $unicode,
$encoding, $diskcache, $pdfa
);
$this->SetAuthor('phpMyAdmin ' . PMA_VERSION);
$this->AddFont('DejaVuSans', '', 'dejavusans.php');
$this->AddFont('DejaVuSans', 'B', 'dejavusansb.php');

View File

@ -721,8 +721,8 @@ class PMA_Table
. PMA_Util::backquote($GLOBALS['cfgRelation'][$pma_table]) . '
WHERE ' . implode(' AND ', $where_parts);
// must use PMA_DatabaseInterface::QUERY_STORE here, since we execute another
// query inside the loop
// must use PMA_DatabaseInterface::QUERY_STORE here, since we execute
// another query inside the loop
$table_copy_rs = PMA_queryAsControlUser(
$table_copy_query, true, PMA_DatabaseInterface::QUERY_STORE
);
@ -809,7 +809,8 @@ class PMA_Table
return false;
}
$source = PMA_Util::backquote($source_db) . '.' . PMA_Util::backquote($source_table);
$source = PMA_Util::backquote($source_db)
. '.' . PMA_Util::backquote($source_table);
if (! isset($target_db) || ! strlen($target_db)) {
$target_db = $source_db;
}
@ -818,7 +819,8 @@ class PMA_Table
// when moving table from replicated one to not replicated one
$GLOBALS['dbi']->selectDb($target_db);
$target = PMA_Util::backquote($target_db) . '.' . PMA_Util::backquote($target_table);
$target = PMA_Util::backquote($target_db)
. '.' . PMA_Util::backquote($target_table);
// do not create the table if dataonly
if ($what != 'dataonly') {
@ -830,7 +832,7 @@ class PMA_Table
'libraries/plugins/export/',
array(
'export_type' => 'table',
'single_table' => isset($single_table)
'single_table' => false,
)
);
@ -1028,13 +1030,16 @@ class PMA_Table
if ($what != 'dataonly' && ! isset($maintain_relations)) {
if ($GLOBALS['cfgRelation']['commwork']) {
// Get all comments and MIME-Types for current table
$comments_copy_query = 'SELECT
column_name, comment' . ($GLOBALS['cfgRelation']['mimework'] ? ', mimetype, transformation, transformation_options' : '') . '
FROM ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_Util::backquote($GLOBALS['cfgRelation']['column_info']) . '
WHERE
db_name = \'' . PMA_Util::sqlAddSlashes($source_db) . '\' AND
table_name = \'' . PMA_Util::sqlAddSlashes($source_table) . '\'';
$comments_copy_rs = PMA_queryAsControlUser($comments_copy_query);
$comments_copy_rs = PMA_queryAsControlUser(
'SELECT column_name, comment'
. ($GLOBALS['cfgRelation']['mimework'] ? ', mimetype, transformation, transformation_options' : '')
. ' FROM ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db'])
. '.' . PMA_Util::backquote($GLOBALS['cfgRelation']['column_info'])
. ' WHERE '
. ' db_name = \'' . PMA_Util::sqlAddSlashes($source_db) . '\''
. ' AND '
. ' table_name = \'' . PMA_Util::sqlAddSlashes($source_table) . '\''
);
// Write every comment as new copied entry. [MIME]
while ($comments_copy_row = $GLOBALS['dbi']->fetchAssoc($comments_copy_rs)) {
@ -1249,11 +1254,14 @@ class PMA_Table
}
// If the table is moved to a different database drop its triggers first
$triggers = $GLOBALS['dbi']->getTriggers($this->getDbName(), $this->getName(), '');
$triggers = $GLOBALS['dbi']->getTriggers(
$this->getDbName(), $this->getName(), ''
);
$handle_triggers = $this->getDbName() != $new_db && $triggers;
if ($handle_triggers) {
foreach ($triggers as $trigger) {
$sql = 'DROP TRIGGER IF EXISTS ' . PMA_Util::backquote($this->getDbName())
$sql = 'DROP TRIGGER IF EXISTS '
. PMA_Util::backquote($this->getDbName())
. '.' . PMA_Util::backquote($trigger['name']) . ';';
$GLOBALS['dbi']->query($sql);
}
@ -1439,10 +1447,14 @@ class PMA_Table
$success = $GLOBALS['dbi']->tryQuery($sql_query, $GLOBALS['controllink']);
if (!$success) {
$message = PMA_Message::error(__('Could not save table UI preferences'));
$message = PMA_Message::error(
__('Could not save table UI preferences')
);
$message->addMessage('<br /><br />');
$message->addMessage(
PMA_Message::rawError($GLOBALS['dbi']->getError($GLOBALS['controllink']))
PMA_Message::rawError(
$GLOBALS['dbi']->getError($GLOBALS['controllink'])
)
);
return $message;
}
@ -1458,7 +1470,9 @@ class PMA_Table
= ' DELETE FROM ' . $pma_table .
' ORDER BY last_update ASC' .
' LIMIT ' . $num_rows_to_delete;
$success = $GLOBALS['dbi']->tryQuery($sql_query, $GLOBALS['controllink']);
$success = $GLOBALS['dbi']->tryQuery(
$sql_query, $GLOBALS['controllink']
);
if (!$success) {
$message = PMA_Message::error(
@ -1469,7 +1483,9 @@ class PMA_Table
);
$message->addMessage('<br /><br />');
$message->addMessage(
PMA_Message::rawError($GLOBALS['dbi']->getError($GLOBALS['controllink']))
PMA_Message::rawError(
$GLOBALS['dbi']->getError($GLOBALS['controllink'])
)
);
print_r($message);
return $message;
@ -1650,7 +1666,7 @@ class PMA_Table
*/
public function getReservedColumnNames()
{
$columns = $this->getColumns($backquoted = false);
$columns = $this->getColumns(false);
$return = array();
foreach ($columns as $column) {
$temp = explode('.', $column);

View File

@ -123,7 +123,9 @@ class PMA_TableSearch
private function _loadTableInfo()
{
// Gets the list and number of columns
$columns = $GLOBALS['dbi']->getColumns($this->_db, $this->_table, null, true);
$columns = $GLOBALS['dbi']->getColumns(
$this->_db, $this->_table, null, true
);
// Get details about the geometry fucntions
$geom_types = PMA_Util::getGISDatatypes();
@ -664,7 +666,8 @@ EOT;
return ' WHERE ' . $_POST['customWhereClause'];
}
// If there are no search criteria set or no unary criteria operators, return
// If there are no search criteria set or no unary criteria operators,
// return
if (! isset($_POST['criteriaValues'])
&& ! isset($_POST['criteriaColumnOperators'])
) {
@ -729,7 +732,9 @@ EOT;
$html_output .= '<select class="geom_func" name="geom_func['
. $column_index . ']">';
// get the relevant list of GIS functions
$funcs = PMA_Util::getGISFunctions($this->_columnTypes[$column_index], true, true);
$funcs = PMA_Util::getGISFunctions(
$this->_columnTypes[$column_index], true, true
);
/**
* For each function in the list of functions,
* add an option to select list
@ -890,7 +895,9 @@ EOT;
? $_POST['criteriaColumnOperators'][$search_index] : '');
$entered_value = (isset($_POST['criteriaValues'])
? $_POST['criteriaValues'] : '');
$titles['Browse'] = PMA_Util::getIcon('b_browse.png', __('Browse foreign values'));
$titles['Browse'] = PMA_Util::getIcon(
'b_browse.png', __('Browse foreign values')
);
//Gets column's type and collation
$type = $this->_columnTypes[$column_index];
$collation = $this->_columnCollations[$column_index];
@ -976,7 +983,8 @@ EOT;
//Displays column rows for search criteria input
for ($i = 0; $i < 4; $i++) {
//After X-Axis and Y-Axis column rows, display additional criteria option
//After X-Axis and Y-Axis column rows, display additional criteria
// option
if ($i == 2) {
$html_output .= '<tr><td>';
$html_output .= __("Additional search criteria");
@ -1345,7 +1353,6 @@ EOT;
$val = $row[0];
$replaced = $row[1];
$count = $row[2];
$valMd5 = md5($val);
$htmlOutput .= '<tr class="' . ($odd ? 'odd' : 'even') . '">';
$htmlOutput .= '<td class="right">' . htmlspecialchars($count) . '</td>';

View File

@ -265,7 +265,7 @@ class PMA_Tracker
'libraries/plugins/export/',
array(
'export_type' => $export_type,
'single_table' => isset($single_table)
'single_table' => false,
)
);
@ -620,7 +620,7 @@ class PMA_Tracker
}
$date_from = $ddl_date_from;
$date_to = $ddl_date_to = $date;
$ddl_date_to = $date;
$dml_date_from = $date_from;

View File

@ -12,7 +12,7 @@ if (! defined('PHPMYADMIN')) {
/**
* Transforms the radio button field_key into 4 arrays
*
*
* @return array An array of arrays which represents column keys for each index type
*/
function PMA_getIndexedColumns()
@ -40,24 +40,25 @@ function PMA_getIndexedColumns()
}
} // end if
} // end for
return array(
return array(
$field_cnt, $field_primary, $field_index, $field_unique, $field_fulltext );
}
/**
* Initiate the column creation statement according to the table creation or
* add columns to a existing table
*
*
* @param int $field_cnt number of columns
* @param boolean $is_create_tbl true if requirement is to get the statement
* @param boolean $is_create_tbl true if requirement is to get the statement
* for table creation
*
* @return array $definitions An array of initial sql statements
*
* @return array $definitions An array of initial sql statements
* according to the request
*/
function PMA_buildColumnCreationStatement($field_cnt ,$is_create_tbl = true)
{
function PMA_buildColumnCreationStatement(
$field_cnt, $field_primary, $is_create_tbl = true
) {
$definitions = array();
for ($i = 0; $i < $field_cnt; ++$i) {
// '0' is also empty for php :-(
@ -67,7 +68,7 @@ function PMA_buildColumnCreationStatement($field_cnt ,$is_create_tbl = true)
continue;
}
$definition = PMA_getStatementPrefix($is_create_tbl) .
$definition = PMA_getStatementPrefix($is_create_tbl) .
PMA_Table::generateFieldSpec(
$_REQUEST['field_name'][$i],
$_REQUEST['field_type'][$i],
@ -91,21 +92,21 @@ function PMA_buildColumnCreationStatement($field_cnt ,$is_create_tbl = true)
$field_primary
);
$definition .= PMA_setColumnCreationStatementSuffix($i, $is_create_tbl);
$definitions[] = $definition;
} // end for
return $definitions;
}
/**
* Set column creation suffix according to requested position of the new column
*
*
* @param int $current_field_num current column number
* @param boolean $is_create_tbl true if requirement is to get the statement
* @param boolean $is_create_tbl true if requirement is to get the statement
* for table creation
*
*
* @return string $sql_suffix suffix
*/
function PMA_setColumnCreationStatementSuffix($current_field_num ,$is_create_tbl = true)
@ -135,14 +136,14 @@ function PMA_setColumnCreationStatementSuffix($current_field_num ,$is_create_tbl
/**
* Create relevent index statements
*
*
* @param array $indexed_fields an array of index columns
* @param string $index_type index type that which represents
* @param string $index_type index type that which represents
* the index type of $indexed_fields
* @param boolean $is_create_tbl true if requirement is to get the statement
* @param boolean $is_create_tbl true if requirement is to get the statement
* for table creation
*
* @return array an array of sql statements for indexes
*
* @return array an array of sql statements for indexes
*/
function PMA_buildIndexStatements($indexed_fields, $index_type, $is_create_tbl = true)
{
@ -156,16 +157,16 @@ function PMA_buildIndexStatements($indexed_fields, $index_type, $is_create_tbl
.' '.$index_type.' (' . implode(', ', $fields) . ') ';
unset($fields);
}
return $statement;
}
/**
* Statement prefix for the PMA_buildColumnCreationStatement()
*
* @param boolean $is_create_tbl true if requirement is to get the statement
*
* @param boolean $is_create_tbl true if requirement is to get the statement
* for table creation
*
*
* @return string $sql_prefix prefix
*/
function PMA_getStatementPrefix($is_create_tbl = true)
@ -179,51 +180,51 @@ function PMA_getStatementPrefix($is_create_tbl = true)
/**
* Returns sql statement according to the column and index specifications as requested
*
* @param boolean $is_create_tbl true if requirement is to get the statement
*
* @param boolean $is_create_tbl true if requirement is to get the statement
* for table creation
*
* @return string sql statement
*
* @return string sql statement
*/
function PMA_getColumnCreationStatements($is_create_tbl = true)
{
$definitions = array();
$sql_statement = "";
list($field_cnt, $field_primary, $field_index,
list($field_cnt, $field_primary, $field_index,
$field_unique, $field_fulltext
) = PMA_getIndexedColumns();
$definitions = PMA_buildColumnCreationStatement($field_cnt, $is_create_tbl);
// Builds the primary keys statements
$definitions = PMA_buildColumnCreationStatement($field_cnt, $field_primary, $is_create_tbl);
// Builds the primary keys statements
$primary_key_statements = PMA_buildIndexStatements(
$field_primary, " PRIMARY KEY ", $is_create_tbl
);
$definitions = array_merge($definitions, $primary_key_statements);
// Builds the indexes statements
$index_statements = PMA_buildIndexStatements(
$field_index, " INDEX ", $is_create_tbl
);
$definitions = array_merge($definitions, $index_statements);
// Builds the uniques statements
$unique_statements = PMA_buildIndexStatements(
$field_unique, " UNIQUE ", $is_create_tbl
);
$definitions = array_merge($definitions, $unique_statements);
// Builds the fulltext statements
$fulltext_statements = PMA_buildIndexStatements(
$field_fulltext, " FULLTEXT ", $is_create_tbl
);
$definitions = array_merge($definitions, $fulltext_statements);
if (count($definitions)) {
$sql_statement = implode(', ', $definitions);
}
$sql_statement = preg_replace('@, $@', '', $sql_statement);
return $sql_statement;
}
?>

View File

@ -152,12 +152,16 @@ function PMA_ipv4MaskTest($testRange, $ipToTest)
* Modified for phpMyAdmin
*
* Matches:
* xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx (exact)
* xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:[yyyy-zzzz] (range, only at end of IP - no subnets)
* xxxx:xxxx:xxxx:xxxx/nn (CIDR)
* xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx
* (exact)
* xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:[yyyy-zzzz]
* (range, only at end of IP - no subnets)
* xxxx:xxxx:xxxx:xxxx/nn
* (CIDR)
*
* Does not match:
* xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xx[yyy-zzz] (range, partial octets not supported)
* xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xx[yyy-zzz]
* (range, partial octets not supported)
*
* @param string $test_range string of IP range to match
* @param string $ip_to_test string of IP to test against range
@ -186,7 +190,10 @@ function PMA_ipv6MaskTest($test_range, $ip_to_test)
} elseif ($is_range) {
// what range do we operate on?
$range_match = array();
if (preg_match('/\[([0-9a-f]+)\-([0-9a-f]+)\]/', $test_range, $range_match)) {
$match = preg_match(
'/\[([0-9a-f]+)\-([0-9a-f]+)\]/', $test_range, $range_match
);
if ($match) {
$range_start = $range_match[1];
$range_end = $range_match[2];

View File

@ -398,11 +398,13 @@ function PMA_getSqlQueryAndCreateDbBeforeCopy()
function PMA_getSqlConstraintsQueryForFullDb(
$tables_full, $export_sql_plugin, $move, $db
) {
global $sql_constraints, $sql_drop_foreign_keys;
$sql_constraints_query_full_db = array();
foreach ($tables_full as $each_table => $tmp) {
/* Following globals are set in getTableDef */
$sql_constraints = '';
$sql_drop_foreign_keys = '';
$sql_structure = $export_sql_plugin->getTableDef(
$export_sql_plugin->getTableDef(
$db, $each_table, "\n", '', false, false
);
if ($move && ! empty($sql_drop_foreign_keys)) {
@ -1159,7 +1161,7 @@ function PMA_getListofMaintainActionLink($is_myisam_or_aria,
'Table_types'
);
}
if ($is_myisam_or_aria || $is_berkeleydb) {
if ($is_innodb || $is_myisam_or_aria || $is_berkeleydb) {
$params = array(
'sql_query' => 'ANALYZE TABLE '
. PMA_Util::backquote($GLOBALS['table']),

View File

@ -463,7 +463,6 @@ function PMA_pluginGetOneOption(
function PMA_pluginGetOptions($section, &$list)
{
$ret = '';
$default = PMA_pluginGetDefault('Export', 'format');
// Options for plugins that support them
foreach ($list as $plugin) {
$properties = $plugin->getProperties();

View File

@ -128,8 +128,6 @@ class AuthenticationCookie extends AuthenticationPlugin
$autocomplete = ' autocomplete="off"';
}
$cell_align = ($GLOBALS['text_dir'] == 'ltr') ? 'left' : 'right';
$response->getFooter()->setMinimal();
$header = $response->getHeader();
$header->setBodyId('loginform');

View File

@ -106,7 +106,7 @@ class AuthenticationSignon extends AuthenticationPlugin
include $script_name;
list ($PHP_AUTH_USER, $PHP_AUTH_PW)
= get_login_credentials($cfg['Server']['user']);
= get_login_credentials($GLOBALS['cfg']['Server']['user']);
} elseif (isset($_COOKIE[$session_name])) { /* Does session exist? */
/* End current session */
@ -234,8 +234,6 @@ class AuthenticationSignon extends AuthenticationPlugin
/* Does session exist? */
if (isset($_COOKIE[$session_name])) {
/* End current session */
$old_session = session_name();
$old_id = session_id();
session_write_close();
/* Load single signon session */
@ -281,4 +279,4 @@ class AuthenticationSignon extends AuthenticationPlugin
public function update (SplSubject $subject)
{
}
}
}

View File

@ -21,34 +21,6 @@ require_once 'libraries/plugins/ExportPlugin.class.php';
*/
class ExportCsv extends ExportPlugin
{
/**
* The string used to end lines
*
* @var string
*/
private $_csvTerminated;
/**
* The string used to separate columns
*
* @var string
*/
private $_csvSeparator;
/**
* The string used to enclose columns
*
* @var string
*/
private $_csvEnclosed;
/**
* The string used to escape columns
*
* @var string
*/
private $_csvEscaped;
/**
* Constructor
*/

View File

@ -163,9 +163,6 @@ class ExportJson extends ExportPlugin
);
$columns_cnt = $GLOBALS['dbi']->numFields($result);
// Get field information
$fields_meta = $GLOBALS['dbi']->getFieldsMeta($result);
for ($i = 0; $i < $columns_cnt; $i++) {
$columns[$i] = stripslashes($GLOBALS['dbi']->fieldName($result, $i));
}

View File

@ -250,7 +250,7 @@ class ImportCsv extends AbstractImportCsv
$data = PMA_importGetNextChunk();
if ($data === false) {
// subtract data we didn't handle yet and stop processing
$offset -= strlen($buffer);
$GLOBALS['offset'] -= strlen($buffer);
break;
} elseif ($data === true) {
// Handle rest of buffer

View File

@ -97,7 +97,7 @@ class ImportLdi extends AbstractImportCsv
*/
public function doImport()
{
global $finished, $error, $import_file, $compression, $charset_conversion, $table;
global $finished, $import_file, $compression, $charset_conversion, $table;
global $ldi_local_option, $ldi_replace, $ldi_ignore, $ldi_terminated, $ldi_enclosed,
$ldi_escaped, $ldi_new_line, $skip_queries, $ldi_columns;
@ -106,10 +106,10 @@ class ImportLdi extends AbstractImportCsv
|| $charset_conversion
) {
// We handle only some kind of data!
$message = PMA_Message::error(
$GLOBALS['message'] = PMA_Message::error(
__('This plugin does not support compressed imports!')
);
$error = true;
$GLOBALS['error'] = true;
return;
}

View File

@ -136,7 +136,7 @@ class ImportOds extends ImportPlugin
$data = PMA_importGetNextChunk();
if ($data === false) {
/* subtract data we didn't handle yet and stop processing */
$offset -= strlen($buffer);
$GLOBALS['offset'] -= strlen($buffer);
break;
} elseif ($data === true) {
/* Handle rest of buffer */
@ -167,21 +167,21 @@ class ImportOds extends ImportPlugin
if ($xml === false) {
$sheets = array();
$message = PMA_Message::error(
$GLOBALS['message'] = PMA_Message::error(
__(
'The XML file specified was either malformed or incomplete.'
. ' Please correct the issue and try again.'
)
);
$error = true;
$GLOBALS['error'] = true;
} else {
$root = $xml->children('office', true)->{'body'}->{'spreadsheet'};
if (empty($root)) {
$sheets = array();
$message = PMA_Message::error(
$GLOBALS['message'] = PMA_Message::error(
__('Could not parse OpenDocument Spreadsheet!')
);
$error = true;
$GLOBALS['error'] = true;
} else {
$sheets = $root->children('table', true);
}
@ -191,7 +191,6 @@ class ImportOds extends ImportPlugin
$max_cols = 0;
$row_count = 0;
$col_count = 0;
$col_names = array();

View File

@ -79,7 +79,7 @@ class ImportShp extends ImportPlugin
public function doImport()
{
global $db, $error, $finished, $compression,
$import_file, $local_import_file;
$import_file, $local_import_file, $message;
if ((int) ini_get('memory_limit') < 512) {
@ini_set('memory_limit', '512M');
@ -87,9 +87,6 @@ class ImportShp extends ImportPlugin
@set_time_limit(300);
$GLOBALS['finished'] = false;
$buffer = '';
$eof = false;
$shp = new PMA_ShapeFile(1);
// If the zip archive has more than one file,
@ -339,4 +336,4 @@ class ImportShp extends ImportPlugin
$buffer = substr($buffer, $length);
return $result;
}
}
}

View File

@ -172,7 +172,7 @@ class ImportSql extends ImportPlugin
$data = PMA_importGetNextChunk();
if ($data === false) {
// subtract data we didn't handle yet and stop processing
$offset -= strlen($buffer);
$GLOBALS['offset'] -= strlen($buffer);
break;
} elseif ($data === true) {
// Handle rest of buffer

View File

@ -93,7 +93,7 @@ class ImportXml extends ImportPlugin
$data = PMA_importGetNextChunk();
if ($data === false) {
/* subtract data we didn't handle yet and stop processing */
$offset -= strlen($buffer);
$GLOBALS['offset'] -= strlen($buffer);
break;
} elseif ($data === true) {
/* Handle rest of buffer */
@ -210,8 +210,8 @@ class ImportXml extends ImportPlugin
$create = array();
foreach ($struct as $tier1 => $val1) {
foreach ($val1 as $tier2 => $val2) {
foreach ($struct as $val1) {
foreach ($val1 as $val2) {
// Need to select the correct database for the creation of
// tables, views, triggers, etc.
/**
@ -253,7 +253,7 @@ class ImportXml extends ImportPlugin
/**
* Process all database content
*/
foreach ($xml as $k1 => $v1) {
foreach ($xml as $v1) {
$tbl_attr = $v1->attributes();
$isInTables = false;
@ -268,7 +268,7 @@ class ImportXml extends ImportPlugin
$tables[] = array((string)$tbl_attr['name']);
}
foreach ($v1 as $k2 => $v2) {
foreach ($v1 as $v2) {
$row_attr = $v2->attributes();
if (! array_search((string)$row_attr['name'], $tempRow)) {
$tempRow[] = (string)$row_attr['name'];
@ -315,7 +315,6 @@ class ImportXml extends ImportPlugin
}
unset($xml);
unset($tempRows);
unset($tempCells);
unset($rows);
@ -376,4 +375,4 @@ class ImportXml extends ImportPlugin
/* Commit any possible data in buffers */
PMA_importRunQuery();
}
}
}

View File

@ -128,7 +128,7 @@ class Import[Name] extends ImportPlugin
$data = PMA_importGetNextChunk();
if ($data === false) {
// subtract data we didn't handle yet and stop processing
$offset -= strlen($buffer);
$GLOBALS['offset'] -= strlen($buffer);
break;
} elseif ($data === true) {
// Handle rest of buffer
@ -170,4 +170,4 @@ class Import[Name] extends ImportPlugin
$this->_myOptionalVariable = $my_optional_variable;
}
}
?>
?>

View File

@ -214,9 +214,6 @@ function get_all_keys($unique_only = false)
*/
function get_script_tabs()
{
$script_tabs = 'var j_tabs = new Array();' . "\n"
. 'var h_tabs = new Array();' . "\n" ;
$retval = array(
'j_tabs' => array(),
'h_tabs' => array()
@ -255,17 +252,17 @@ function get_tab_pos()
FROM " . PMA_Util::backquote($cfgRelation['db'])
. "." . PMA_Util::backquote($cfgRelation['designer_coords']);
$tab_pos = $GLOBALS['dbi']->fetchResult(
$query,
'name',
null,
$GLOBALS['controllink'],
$query,
'name',
null,
$GLOBALS['controllink'],
PMA_DatabaseInterface::QUERY_STORE
);
return count($tab_pos) ? $tab_pos : null;
}
/**
* Prepares XML output for js/pmd/ajax.js to display a message
* Prepares XML output for js/pmd/ajax.js to display a message
*
*/
function PMD_return_upd($b, $ret)

View File

@ -60,7 +60,7 @@ function PMA_getHtmlForMasterReplication()
$_url_params['repl_clear_scr'] = true;
$html .= ' <li><a href="server_replication.php';
$html .= PMA_generate_common_url($_url_params)
$html .= PMA_generate_common_url($_url_params)
. '" id="master_addslaveuser_href">';
$html .= __('Add slave replication user') . '</a></li>';
}
@ -72,7 +72,7 @@ function PMA_getHtmlForMasterReplication()
$html .= "</ul>";
$html .= "</fieldset>";
}
return $html;
}
@ -86,16 +86,16 @@ function PMA_getHtmlForMasterConfiguration()
$html = '<fieldset>';
$html .= '<legend>' . __('Master configuration') . '</legend>';
$html .= __(
'This server is not configured as master server in a '
. 'replication process. You can choose from either replicating '
. 'all databases and ignoring certain (useful if you want to replicate '
. 'majority of databases) or you can choose to ignore all databases by '
. 'default and allow only certain databases to be replicated. '
'This server is not configured as master server in a '
. 'replication process. You can choose from either replicating '
. 'all databases and ignoring certain (useful if you want to replicate '
. 'majority of databases) or you can choose to ignore all databases by '
. 'default and allow only certain databases to be replicated. '
. 'Please select the mode:'
) . '<br /><br />';
$html .= '<select name="db_type" id="db_type">';
$html .= '<option value="all">' . __('Replicate all databases; Ignore:');
$html .= '<option value="all">' . __('Replicate all databases; Ignore:');
$html .= '</option>';
$html .= '<option value="ign">' . __('Ignore all databases; Replicate:');
$html .= '</option>';
@ -105,13 +105,13 @@ function PMA_getHtmlForMasterConfiguration()
$html .= PMA_getHtmlForReplicationDbMultibox();
$html .= '<br /><br />';
$html .= __(
'Now, add the following lines at the end of [mysqld] section'
'Now, add the following lines at the end of [mysqld] section'
. ' in your my.cnf and please restart the MySQL server afterwards.'
). '<br />';
$html .= '<pre id="rep"></pre>';
$html .= __(
'Once you restarted MySQL server, please click on Go button. '
. 'Afterwards, you should see a message informing you, that this server'
'Once you restarted MySQL server, please click on Go button. '
. 'Afterwards, you should see a message informing you, that this server'
. ' <b>is</b> configured as master.'
);
$html .= '</fieldset>';
@ -121,7 +121,7 @@ function PMA_getHtmlForMasterConfiguration()
$html .= ' <input type="submit" value="' . __('Go') . '" id="goButton" />';
$html .= ' </form>';
$html .= '</fieldset>';
return $html;
}
@ -151,7 +151,7 @@ function PMA_getHtmlForSlaveConfiguration($server_slave_status, $server_slave_re
}
$_url_params['sr_slave_control_parm'] = 'IO_THREAD';
$slave_control_io_link = 'server_replication.php'
$slave_control_io_link = 'server_replication.php'
. PMA_generate_common_url($_url_params);
if ($server_slave_replication[0]['Slave_SQL_Running'] == 'No') {
@ -161,7 +161,7 @@ function PMA_getHtmlForSlaveConfiguration($server_slave_status, $server_slave_re
}
$_url_params['sr_slave_control_parm'] = 'SQL_THREAD';
$slave_control_sql_link = 'server_replication.php'
$slave_control_sql_link = 'server_replication.php'
. PMA_generate_common_url($_url_params);
if ($server_slave_replication[0]['Slave_IO_Running'] == 'No'
@ -173,16 +173,16 @@ function PMA_getHtmlForSlaveConfiguration($server_slave_status, $server_slave_re
}
$_url_params['sr_slave_control_parm'] = null;
$slave_control_full_link = 'server_replication.php'
$slave_control_full_link = 'server_replication.php'
. PMA_generate_common_url($_url_params);
$_url_params['sr_slave_action'] = 'reset';
$slave_control_reset_link = 'server_replication.php'
$slave_control_reset_link = 'server_replication.php'
. PMA_generate_common_url($_url_params);
$_url_params = $GLOBALS['url_params'];
$_url_params['sr_slave_skip_error'] = true;
$slave_skip_error_link = 'server_replication.php'
$slave_skip_error_link = 'server_replication.php'
. PMA_generate_common_url($_url_params);
if ($server_slave_replication[0]['Slave_SQL_Running'] == 'No') {
@ -200,7 +200,7 @@ function PMA_getHtmlForSlaveConfiguration($server_slave_status, $server_slave_re
$_url_params['sl_configure'] = true;
$_url_params['repl_clear_scr'] = true;
$reconfiguremaster_link = 'server_replication.php'
$reconfiguremaster_link = 'server_replication.php'
. PMA_generate_common_url($_url_params);
$html .= __('Server is configured as slave in a replication process. Would you like to:');
@ -216,9 +216,9 @@ function PMA_getHtmlForSlaveConfiguration($server_slave_status, $server_slave_re
$html .= ' <div id="slave_control_gui" style="display: none">';
$html .= ' <ul>';
$html .= ' <li><a href="'. $slave_control_full_link . '">';
$html .= (($server_slave_replication[0]['Slave_IO_Running'] == 'No' ||
$server_slave_replication[0]['Slave_SQL_Running'] == 'No')
? __('Full start')
$html .= (($server_slave_replication[0]['Slave_IO_Running'] == 'No' ||
$server_slave_replication[0]['Slave_SQL_Running'] == 'No')
? __('Full start')
: __('Full stop')) . ' </a></li>';
$html .= ' <li><a href="'. $slave_control_reset_link . '">';
$html .= __('Reset slave') . '</a></li>';
@ -239,7 +239,7 @@ function PMA_getHtmlForSlaveConfiguration($server_slave_status, $server_slave_re
$html .= ' </ul>';
$html .= ' </div>';
$html .= ' </li>';
$html .= ' <li>';
$html .= ' <li>';
$html .= PMA_getHtmlForSlaveErrorManagement($slave_skip_error_link);
$html .= ' </li>';
$html .= ' <li><a href="' . $reconfiguremaster_link . '">';
@ -254,14 +254,14 @@ function PMA_getHtmlForSlaveConfiguration($server_slave_status, $server_slave_re
$html .= sprintf(
__(
'This server is not configured as slave in a replication process. '
'This server is not configured as slave in a replication process. '
. 'Would you like to <a href="%s">configure</a> it?'
),
),
'server_replication.php' . PMA_generate_common_url($_url_params)
);
}
$html .= '</fieldset>';
return $html;
}
@ -286,7 +286,7 @@ function PMA_getHtmlForSlaveErrorManagement($slave_skip_error_link)
$html .= ' <li>' . __('Skip next');
$html .= ' <form method="post" action="server_replication.php">';
$html .= PMA_generate_common_hidden_inputs('', '');
$html .= ' <input type="text" name="sr_skip_errors_count" value="1" ';
$html .= ' <input type="text" name="sr_skip_errors_count" value="1" ';
$html .= 'style="width: 30px" />' . __('errors.');
$html .= ' <input type="submit" name="sr_slave_skip_error" ';
$html .= 'value="' . __('Go') . '" />';
@ -295,8 +295,8 @@ function PMA_getHtmlForSlaveErrorManagement($slave_skip_error_link)
$html .= ' </ul>';
$html .= ' </div>';
return $html;
}
}
/**
* returns HTML for not configure for a server replication
*
@ -311,9 +311,9 @@ function PMA_getHtmlForNotServerReplication()
$html .= '<legend>' . __('Master replication') . '</legend>';
$html .= sprintf(
__(
'This server is not configured as master in a replication process. '
'This server is not configured as master in a replication process. '
. 'Would you like to <a href="%s">configure</a> it?'
),
),
'server_replication.php' . PMA_generate_common_url($_url_params)
);
$html .= '</fieldset>';
@ -328,13 +328,14 @@ function PMA_getHtmlForNotServerReplication()
function PMA_getHtmlForReplicationDbMultibox()
{
$multi_values = '';
$multi_values .= '<select name="db_select[]" '
$multi_values .= '<select name="db_select[]" '
. 'size="6" multiple="multiple" id="db_select">';
foreach ($GLOBALS['pma']->databases as $current_db) {
if ($GLOBALS['dbi']->isSystemSchema($current_db)) {
continue;
}
/* TODO: where $selectall should come from? */
if (! empty($selectall) || (isset($tmp_select) && strpos(' ' . $tmp_select, '|' . $current_db . '|'))) {
$is_selected = ' selected="selected"';
} else {
@ -347,7 +348,7 @@ function PMA_getHtmlForReplicationDbMultibox()
} // end while
$multi_values .= '</select>';
$multi_values .= '<br /><a href="#" id="db_reset_href">';
$multi_values .= '<br /><a href="#" id="db_reset_href">';
$multi_values .= __('Uncheck All') . '</a>';
return $multi_values;
@ -364,7 +365,7 @@ function PMA_getHtmlForReplicationDbMultibox()
function PMA_getHtmlForReplicationChangeMaster($submitname)
{
$html = '';
list($username_length, $hostname_length)
list($username_length, $hostname_length)
= PMA_replicationGetUsernameHostnameLength();
$html .= '<form method="post" action="server_replication.php">';
@ -373,55 +374,55 @@ function PMA_getHtmlForReplicationChangeMaster($submitname)
$html .= ' <legend>' . __('Slave configuration');
$html .= ' - ' . __('Change or reconfigure master server') . '</legend>';
$html .= __(
'Make sure, you have unique server-id in your configuration file (my.cnf). '
'Make sure, you have unique server-id in your configuration file (my.cnf). '
. 'If not, please add the following line into [mysqld] section:'
);
);
$html .= '<br />';
$html .= '<pre>server-id=' . time() . '</pre>';
$html .= PMA_getHtmlForAddUserInputDiv(
array('text'=>__('User name:'), 'for'=>"text_username"),
array('text'=>__('User name:'), 'for'=>"text_username"),
array(
'type'=>'text',
'name'=>'username',
'id'=>'text_username',
'type'=>'text',
'name'=>'username',
'id'=>'text_username',
'maxlength'=>$username_length,
'title'=>__('User name')
)
);
$html .= PMA_getHtmlForAddUserInputDiv(
array('text'=>__('Password:'), 'for'=>"text_pma_pw"),
array(
'type'=>'password',
'name'=>'pma_pw',
'id'=>'text_pma_pw',
'title'=>__('Password')
'title'=>__('User name')
)
);
$html .= PMA_getHtmlForAddUserInputDiv(
array('text'=>__('Host:'), 'for'=>"text_hostname"),
array('text'=>__('Password:'), 'for'=>"text_pma_pw"),
array(
'type'=>'text',
'name'=>'hostname',
'id'=>'text_hostname',
'maxlength'=>$hostname_length,
'value'=>''
'type'=>'password',
'name'=>'pma_pw',
'id'=>'text_pma_pw',
'title'=>__('Password')
)
);
$html .= PMA_getHtmlForAddUserInputDiv(
array('text'=>__('Port:'), 'for'=>"text_port"),
array('text'=>__('Host:'), 'for'=>"text_hostname"),
array(
'type'=>'text',
'name'=>'text_port',
'id'=>'text_port',
'maxlength'=>6,
'value'=>'3306'
'type'=>'text',
'name'=>'hostname',
'id'=>'text_hostname',
'maxlength'=>$hostname_length,
'value'=>''
)
);
$html .= PMA_getHtmlForAddUserInputDiv(
array('text'=>__('Port:'), 'for'=>"text_port"),
array(
'type'=>'text',
'name'=>'text_port',
'id'=>'text_port',
'maxlength'=>6,
'value'=>'3306'
)
);
$html .= ' </fieldset>';
$html .= ' <fieldset id="fieldset_user_privtable_footer" class="tblFooters">';
$html .= ' <input type="hidden" name="sr_take_action" value="true" />';
@ -430,9 +431,9 @@ function PMA_getHtmlForReplicationChangeMaster($submitname)
$html .= __('Go') . '" />';
$html .= ' </fieldset>';
$html .= '</form>';
return $html;
}
}
/**
* returns HTML code for Add user input div
@ -443,15 +444,15 @@ function PMA_getHtmlForReplicationChangeMaster($submitname)
* @return String HTML code
*/
function PMA_getHtmlForAddUserInputDiv($label_array, $input_array)
{
{
$html = ' <div class="item">';
$html .= ' <label for="' . $label_array['for'] . '">';
$html .= $label_array['text'] . '</label>';
$html .= $label_array['text'] . '</label>';
$html .= ' <input ';
foreach ($input_array as $key=>$value) {
$html .= ' ' . $key . '="' . $value. '" ';
}
$html .= ' ' . $key . '="' . $value. '" ';
}
$html .= ' />';
$html .= ' </div>';
return $html;
@ -473,15 +474,15 @@ function PMA_getHtmlForReplicationStatusTable($type, $hidden = false, $title = t
global ${"{$type}_variables_oks"};
global ${"server_{$type}_replication"};
global ${"strReplicationStatus_{$type}"};
$html = '';
// TODO check the Masters server id?
// seems to default to '1' when queried via SHOW VARIABLES ,
// seems to default to '1' when queried via SHOW VARIABLES ,
// but resulted in error on the master when slave connects
// [ERROR] Error reading packet from server: Misconfigured master
// [ERROR] Error reading packet from server: Misconfigured master
// - server id was not set ( server_errno=1236)
// [ERROR] Got fatal error 1236: 'Misconfigured master
// [ERROR] Got fatal error 1236: 'Misconfigured master
// - server id was not set' from master when reading data from binary log
//
//$server_id = $GLOBALS['dbi']->fetchValue("SHOW VARIABLES LIKE 'server_id'", 0, 1);
@ -526,7 +527,7 @@ function PMA_getHtmlForReplicationStatusTable($type, $hidden = false, $title = t
$html .= '<span class="attention">';
} elseif (isset(${"{$type}_variables_oks"}[$variable])
&& ${"{$type}_variables_oks"}[$variable]
&& ${"{$type}_variables_oks"}[$variable]
== ${"server_{$type}_replication"}[0][$variable]
) {
$html .= '<span class="allfine">';
@ -541,7 +542,7 @@ function PMA_getHtmlForReplicationStatusTable($type, $hidden = false, $title = t
if (in_array($variable, $variables_wrap)) {
$html .= str_replace(
',',
', ',
', ',
${"server_{$type}_replication"}[0][$variable]
);
} else {
@ -559,14 +560,14 @@ function PMA_getHtmlForReplicationStatusTable($type, $hidden = false, $title = t
$html .= ' </table>';
$html .= ' <br />';
$html .= '</div>';
return $html;
}
/**
* returns html code for table with slave users connected to this master
*
* @param boolean $hidden - if true, then default style is set to hidden,
* @param boolean $hidden - if true, then default style is set to hidden,
* - default value false
*
* @return void
@ -604,13 +605,13 @@ function PMA_getHtmlForReplicationSlavesTable($hidden = false)
$html .= ' <br />';
$html .= PMA_Message::notice(
__(
'Only slaves started with the '
'Only slaves started with the '
. '--report-host=host_name option are visible in this list.'
)
)->getDisplay();
$html .= ' <br />';
$html .= ' </div>';
return $html;
}
@ -651,7 +652,7 @@ function PMA_replicationGetUsernameHostnameLength()
function PMA_getHtmlForReplicationMasterAddSlaveuser()
{
$html = '';
list($username_length, $hostname_length)
list($username_length, $hostname_length)
= PMA_replicationGetUsernameHostnameLength();
if (isset($_REQUEST['username']) && strlen($_REQUEST['username']) === 0) {
@ -659,7 +660,7 @@ function PMA_getHtmlForReplicationMasterAddSlaveuser()
}
$html .= '<div id="master_addslaveuser_gui">';
$html .= '<form autocomplete="off" method="post" ';
$html .= 'action="server_privileges.php"';
$html .= 'action="server_privileges.php"';
$html .= ' onsubmit="return checkAddUser(this);">';
$html .= PMA_generate_common_hidden_inputs('', '');
$html .= '<fieldset id="fieldset_add_user_login">'
@ -670,30 +671,30 @@ function PMA_getHtmlForReplicationMasterAddSlaveuser()
. ' ' . __('Host:')
. '</label>'
. '<span class="options">'
. ' <select name="pred_hostname" id="select_pred_hostname" title="'
. ' <select name="pred_hostname" id="select_pred_hostname" title="'
. __('Host') . '"';
$_current_user = $GLOBALS['dbi']->fetchValue('SELECT USER();');
if (! empty($_current_user)) {
$thishost = str_replace(
"'",
'',
"'",
'',
substr($_current_user, (strrpos($_current_user, '@') + 1))
);
if ($thishost == 'localhost' || $thishost == '127.0.0.1') {
unset($thishost);
}
}
$html .= ' onchange="if (this.value == \'any\') { hostname.value = \'%\'; } '
. 'else if (this.value == \'localhost\') '
$html .= ' onchange="if (this.value == \'any\') { hostname.value = \'%\'; } '
. 'else if (this.value == \'localhost\') '
. '{ hostname.value = \'localhost\'; } '
. (empty($thishost)
? ''
: 'else if (this.value == \'thishost\') { hostname.value = \''
. (empty($thishost)
? ''
: 'else if (this.value == \'thishost\') { hostname.value = \''
. addslashes(htmlspecialchars($thishost)) . '\'; } ')
. 'else if (this.value == \'hosttable\') { hostname.value = \'\'; } '
. 'else if (this.value == \'userdefined\') '
. '{ hostname.focus(); hostname.select(); }">'
. 'else if (this.value == \'hosttable\') { hostname.value = \'\'; } '
. 'else if (this.value == \'userdefined\') '
. '{ hostname.focus(); hostname.select(); }">'
. "\n";
unset($_current_user);
@ -717,24 +718,24 @@ function PMA_getHtmlForReplicationMasterAddSlaveuser()
? ' selected="selected"' : '') . '>' . __('Any host')
. '</option>'
. ' <option value="localhost"'
. ((isset($GLOBALS['pred_hostname'])
. ((isset($GLOBALS['pred_hostname'])
&& $GLOBALS['pred_hostname'] == 'localhost')
? ' selected="selected"' : '') . '>' . __('Local')
. '</option>';
if (!empty($thishost)) {
$html .= ' <option value="thishost"'
. ((isset($GLOBALS['pred_hostname'])
. ((isset($GLOBALS['pred_hostname'])
&& $GLOBALS['pred_hostname'] == 'thishost')
? ' selected="selected"' : '') . '>' . __('This Host')
. '</option>';
}
unset($thishost);
$html .= PMA_getHtmlForTableInfoForm($hostname_length);
$html .= PMA_getHtmlForTableInfoForm($hostname_length);
$html .= '</form>';
$html .= '</div>';
return $html;
}
/**
@ -748,11 +749,11 @@ function PMA_getHtmlForAddUserLoginForm($username_length)
{
$html = '<input type="hidden" name="grant_count" value="25" />'
. '<input type="hidden" name="createdb" id="createdb_0" value="0" />'
. '<input id="checkbox_Repl_slave_priv" type="hidden"'
. ' title="Needed for the replication slaves." '
. '<input id="checkbox_Repl_slave_priv" type="hidden"'
. ' title="Needed for the replication slaves." '
. 'value="Y" name="Repl_slave_priv"/>'
. '<input id="checkbox_Repl_client_priv" type="hidden" '
. 'title="Needed for the replication slaves."'
. '<input id="checkbox_Repl_client_priv" type="hidden" '
. 'title="Needed for the replication slaves."'
. ' value="Y" name="Repl_client_priv"/> '
. '<input type="hidden" name="sr_take_action" value="true" />'
. '<div class="item">'
@ -760,32 +761,32 @@ function PMA_getHtmlForAddUserLoginForm($username_length)
. ' ' . __('User name:')
. '</label>'
. '<span class="options">'
. ' <select name="pred_username" id="select_pred_username" '
. ' <select name="pred_username" id="select_pred_username" '
. 'title="' . __('User name') . '"'
. ' onchange="if (this.value == \'any\') { username.value = \'\'; } '
. 'else if (this.value == \'userdefined\') { '
. ' onchange="if (this.value == \'any\') { username.value = \'\'; } '
. 'else if (this.value == \'userdefined\') { '
. ' username.focus(); username.select(); }">'
. ' <option value="any"'
. ((isset($GLOBALS['pred_username'])
&& $GLOBALS['pred_username'] == 'any') ? ' selected="selected"' : '')
. ' <option value="any"'
. ((isset($GLOBALS['pred_username'])
&& $GLOBALS['pred_username'] == 'any') ? ' selected="selected"' : '')
. '>' . __('Any user') . '</option>'
. ' <option value="userdefined"'
. ((! isset($GLOBALS['pred_username'])
|| $GLOBALS['pred_username'] == 'userdefined')
? ' selected="selected"' : '')
. ' <option value="userdefined"'
. ((! isset($GLOBALS['pred_username'])
|| $GLOBALS['pred_username'] == 'userdefined')
? ' selected="selected"' : '')
. '>' . __('Use text field:') . '</option>'
. ' </select>'
. '</span>'
. '<input type="text" name="username" maxlength="'
. $username_length . '" title="' . __('User name') . '"'
. (empty($_REQUEST['username']) ? '' : ' value="'
. (isset($GLOBALS['new_username'])
? $GLOBALS['new_username']
. (empty($_REQUEST['username']) ? '' : ' value="'
. (isset($GLOBALS['new_username'])
? $GLOBALS['new_username']
: $_REQUEST['username']) . '"')
. ' onchange="pred_username.value = \'userdefined\';" />'
. '</div>';
return $html;
return $html;
}
/**
@ -798,12 +799,12 @@ function PMA_getHtmlForAddUserLoginForm($username_length)
function PMA_getHtmlForTableInfoForm($hostname_length)
{
$html = ' <option value="hosttable"'
. ((isset($GLOBALS['pred_hostname'])
. ((isset($GLOBALS['pred_hostname'])
&& $GLOBALS['pred_hostname'] == 'hosttable')
? ' selected="selected"' : '') . '>' . __('Use Host Table')
. '</option>'
. ' <option value="userdefined"'
. ((isset($GLOBALS['pred_hostname'])
. ((isset($GLOBALS['pred_hostname'])
&& $GLOBALS['pred_hostname'] == 'userdefined')
? ' selected="selected"' : '')
. '>' . __('Use text field:') . '</option>'
@ -816,7 +817,7 @@ function PMA_getHtmlForTableInfoForm($hostname_length)
. '" onchange="pred_hostname.value = \'userdefined\';" />'
. PMA_Util::showHint(
__(
'When Host table is used, this field is ignored '
'When Host table is used, this field is ignored '
. 'and values stored in Host table are used instead.'
)
)
@ -828,21 +829,21 @@ function PMA_getHtmlForTableInfoForm($hostname_length)
. '<span class="options">'
. ' <select name="pred_password" id="select_pred_password" title="'
. __('Password') . '"'
. ' onchange="if (this.value == \'none\') '
. '{ pma_pw.value = \'\'; pma_pw2.value = \'\'; } '
. 'else if (this.value == \'userdefined\') '
. ' onchange="if (this.value == \'none\') '
. '{ pma_pw.value = \'\'; pma_pw2.value = \'\'; } '
. 'else if (this.value == \'userdefined\') '
. '{ pma_pw.focus(); pma_pw.select(); }">'
. ' <option value="none"';
if (isset($_REQUEST['username'])) {
$html .= ' selected="selected"';
}
$html .= '>' . __('No Password') . '</option>'
. ' <option value="userdefined"'
. (isset($_REQUEST['username']) ? '' : ' selected="selected"')
. ' <option value="userdefined"'
. (isset($_REQUEST['username']) ? '' : ' selected="selected"')
. '>' . __('Use text field:') . '</option>'
. ' </select>'
. '</span>'
. '<input type="password" id="text_pma_pw" name="pma_pw" title="'
. '<input type="password" id="text_pma_pw" name="pma_pw" title="'
. __('Password') . '" onchange="pred_password.value = \'userdefined\';" />'
. '</div>'
. '<div class="item">'
@ -850,7 +851,7 @@ function PMA_getHtmlForTableInfoForm($hostname_length)
. ' ' . __('Re-type:')
. '</label>'
. '<span class="options">&nbsp;</span>'
. '<input type="password" name="pma_pw2" id="text_pma_pw2" title="'
. '<input type="password" name="pma_pw2" id="text_pma_pw2" title="'
. __('Re-type') . '" onchange="pred_password.value = \'userdefined\';" />'
. '</div>'
. '<div class="item">'
@ -858,7 +859,7 @@ function PMA_getHtmlForTableInfoForm($hostname_length)
. ' ' . __('Generate Password:')
. '</label>'
. '<span class="options">'
. ' <input type="button" class="button" '
. ' <input type="button" class="button" '
. 'id="button_generate_password" value="' . __('Generate')
. '" onclick="suggestPassword(this.form)" />'
. '</span>'
@ -885,13 +886,14 @@ function PMA_handleControlRequest()
PMA_handleRequestForSlaveChangeMaster();
} elseif (isset($_REQUEST['sr_slave_server_control'])) {
PMA_handleRequestForSlaveServerControl();
$refresh = true;
} elseif (isset($_REQUEST['sr_slave_skip_error'])) {
PMA_handleRequestForSlaveSkipError();
}
if ($refresh) {
Header(
"Location: server_replication.php"
"Location: server_replication.php"
. PMA_generate_common_url($GLOBALS['url_params'])
);
}
@ -905,13 +907,13 @@ function PMA_handleControlRequest()
*/
function PMA_handleRequestForSlaveChangeMaster()
{
$_SESSION['replication']['m_username'] = $sr['username']
$_SESSION['replication']['m_username'] = $sr['username']
= PMA_Util::sqlAddSlashes($_REQUEST['username']);
$_SESSION['replication']['m_password'] = $sr['pma_pw']
$_SESSION['replication']['m_password'] = $sr['pma_pw']
= PMA_Util::sqlAddSlashes($_REQUEST['pma_pw']);
$_SESSION['replication']['m_hostname'] = $sr['hostname']
$_SESSION['replication']['m_hostname'] = $sr['hostname']
= PMA_Util::sqlAddSlashes($_REQUEST['hostname']);
$_SESSION['replication']['m_port'] = $sr['port']
$_SESSION['replication']['m_port'] = $sr['port']
= PMA_Util::sqlAddSlashes($_REQUEST['port']);
$_SESSION['replication']['m_correct'] = '';
$_SESSION['replication']['sr_action_status'] = 'error';
@ -934,26 +936,26 @@ function PMA_handleRequestForSlaveChangeMaster()
if (empty($position)) {
$_SESSION['replication']['sr_action_status'] = 'error';
$_SESSION['replication']['sr_action_info']
$_SESSION['replication']['sr_action_info']
= __(
'Unable to read master log position. '
'Unable to read master log position. '
. 'Possible privilege problem on master.'
);
} else {
$_SESSION['replication']['m_correct'] = true;
if (! PMA_Replication_Slave_changeMaster(
$sr['username'],
$sr['pma_pw'],
$sr['hostname'],
$sr['port'],
$position,
true,
$sr['username'],
$sr['pma_pw'],
$sr['hostname'],
$sr['port'],
$position,
true,
false
)
) {
$_SESSION['replication']['sr_action_status'] = 'error';
$_SESSION['replication']['sr_action_info']
$_SESSION['replication']['sr_action_info']
= __('Unable to change master');
} else {
$_SESSION['replication']['sr_action_status'] = 'success';
@ -983,7 +985,6 @@ function PMA_handleRequestForSlaveServerControl()
$_REQUEST['sr_slave_control_parm']
);
}
$refresh = true;
}
/**

View File

@ -194,10 +194,10 @@ class PMA_DIA extends XMLWriter
* and helps in drawing/generating the Tables in dia XML document.
*
* @package PhpMyAdmin
* @name Table_Stats
* @name Table_Stats_Dia
* @see PMA_DIA
*/
class Table_Stats
class Table_Stats_Dia
{
/**
* Defines properties
@ -210,7 +210,7 @@ class Table_Stats
public $tableColor;
/**
* The "Table_Stats" constructor
* The "Table_Stats_Dia" constructor
*
* @param string $tableName The table name
* @param integer $pageNumber The current page number (from the
@ -475,10 +475,10 @@ class Table_Stats
* in dia XML document.
*
* @package PhpMyAdmin
* @name Relation_Stats
* @name Relation_Stats_Dia
* @see PMA_DIA
*/
class Relation_Stats
class Relation_Stats_Dia
{
/**
* Defines properties
@ -494,7 +494,7 @@ class Relation_Stats
public $referenceColor;
/**
* The "Relation_Stats" constructor
* The "Relation_Stats_Dia" constructor
*
* @param string $master_table The master table name
* @param string $master_field The relation field in the master table
@ -503,7 +503,7 @@ class Relation_Stats
*
* @return void
*
* @see Relation_Stats::_getXy
* @see Relation_Stats_Dia::_getXy
*/
function __construct($master_table, $master_field, $foreign_table,
$foreign_field
@ -708,7 +708,7 @@ class PMA_Dia_Relation_Schema extends PMA_Export_Relation_Schema
* that user can download
*
* @return void
* @see PMA_DIA,Table_Stats,Relation_Stats
* @see PMA_DIA,Table_Stats_Dia,Relation_Stats_Dia
*/
function __construct()
{
@ -730,7 +730,7 @@ class PMA_Dia_Relation_Schema extends PMA_Export_Relation_Schema
$alltables = $this->getAllTables($db, $this->pageNumber);
foreach ($alltables as $table) {
if (! isset($this->tables[$table])) {
$this->_tables[$table] = new Table_Stats(
$this->_tables[$table] = new Table_Stats_Dia(
$table, $this->pageNumber, $this->showKeys
);
}
@ -762,8 +762,18 @@ class PMA_Dia_Relation_Schema extends PMA_Export_Relation_Schema
$this->_drawRelations($this->showColor);
}
$dia->endDiaDoc();
}
/**
* Output Dia Document for download
*
* @return void
* @access public
*/
function showOutput()
{
global $dia, $db;
$dia->showOutput($db . '-' . $this->pageNumber);
exit();
}
/**
@ -778,22 +788,22 @@ class PMA_Dia_Relation_Schema extends PMA_Export_Relation_Schema
* @return void
*
* @access private
* @see Table_Stats::__construct(),Relation_Stats::__construct()
* @see Table_Stats_Dia::__construct(),Relation_Stats_Dia::__construct()
*/
private function _addRelation($masterTable, $masterField, $foreignTable,
$foreignField, $showKeys
) {
if (! isset($this->_tables[$masterTable])) {
$this->_tables[$masterTable] = new Table_Stats(
$this->_tables[$masterTable] = new Table_Stats_Dia(
$masterTable, $this->pageNumber, $showKeys
);
}
if (! isset($this->_tables[$foreignTable])) {
$this->_tables[$foreignTable] = new Table_Stats(
$this->_tables[$foreignTable] = new Table_Stats_Dia(
$foreignTable, $this->pageNumber, $showKeys
);
}
$this->_relations[] = new Relation_Stats(
$this->_relations[] = new Relation_Stats_Dia(
$this->_tables[$masterTable], $masterField,
$this->_tables[$foreignTable], $foreignField
);
@ -811,7 +821,7 @@ class PMA_Dia_Relation_Schema extends PMA_Export_Relation_Schema
* @return void
*
* @access private
* @see Relation_Stats::relationDraw()
* @see Relation_Stats_Dia::relationDraw()
*/
private function _drawRelations($changeColor)
{
@ -831,7 +841,7 @@ class PMA_Dia_Relation_Schema extends PMA_Export_Relation_Schema
* @return void
*
* @access private
* @see Table_Stats::tableDraw()
* @see Table_Stats_Dia::tableDraw()
*/
private function _drawTables($changeColor)
{

View File

@ -371,10 +371,10 @@ class PMA_EPS
* and helps in drawing/generating the Tables in EPS.
*
* @package PhpMyAdmin
* @name Table_Stats
* @name Table_Stats_Eps
* @see PMA_EPS
*/
class Table_Stats
class Table_Stats_Eps
{
/**
* Defines properties
@ -392,7 +392,7 @@ class Table_Stats
public $primary = array();
/**
* The "Table_Stats" constructor
* The "Table_Stats_Eps" constructor
*
* @param string $tableName The table name
* @param string $font The font name
@ -409,8 +409,8 @@ class Table_Stats
* @global string The current db name
*
* @access private
* @see PMA_EPS, Table_Stats::Table_Stats_setWidth,
* Table_Stats::Table_Stats_setHeight
* @see PMA_EPS, Table_Stats_Eps::Table_Stats_setWidth,
* Table_Stats_Eps::Table_Stats_setHeight
*/
function __construct(
$tableName, $font, $fontSize, $pageNumber, &$same_wide_width,
@ -609,10 +609,10 @@ class Table_Stats
* in EPS document.
*
* @package PhpMyAdmin
* @name Relation_Stats
* @name Relation_Stats_Eps
* @see PMA_EPS
*/
class Relation_Stats
class Relation_Stats_Eps
{
/**
* Defines properties
@ -624,14 +624,14 @@ class Relation_Stats
public $wTick = 10;
/**
* The "Relation_Stats" constructor
* The "Relation_Stats_Eps" constructor
*
* @param string $master_table The master table name
* @param string $master_field The relation field in the master table
* @param string $foreign_table The foreign table name
* @param string $foreign_field The relation field in the foreign table
*
* @see Relation_Stats::_getXy
* @see Relation_Stats_Eps::_getXy
*/
function __construct($master_table, $master_field, $foreign_table, $foreign_field)
{
@ -787,7 +787,7 @@ class Relation_Stats
}
}
/*
* end of the "Relation_Stats" class
* end of the "Relation_Stats_Eps" class
*/
/**
@ -847,7 +847,7 @@ class PMA_Eps_Relation_Schema extends PMA_Export_Relation_Schema
foreach ($alltables as $table) {
if (! isset($this->_tables[$table])) {
$this->_tables[$table] = new Table_Stats(
$this->_tables[$table] = new Table_Stats_Eps(
$table, $eps->getFont(), $eps->getFontSize(), $this->pageNumber,
$this->_tablewidth, $this->showKeys, $this->tableDimension
);
@ -885,10 +885,20 @@ class PMA_Eps_Relation_Schema extends PMA_Export_Relation_Schema
$this->_drawTables($this->showColor);
$eps->endEpsDoc();
$eps->showOutput($db.'-'.$this->pageNumber);
exit();
}
/**
* Output Eps Document for download
*
* @return void
* @access public
*/
function showOutput()
{
global $eps,$db;
$eps->showOutput($db . '-' . $this->pageNumber);
}
/**
* Defines relation objects
*
@ -903,25 +913,25 @@ class PMA_Eps_Relation_Schema extends PMA_Export_Relation_Schema
* @return void
*
* @access private
* @see _setMinMax,Table_Stats::__construct(),Relation_Stats::__construct()
* @see _setMinMax,Table_Stats_Eps::__construct(),Relation_Stats_Eps::__construct()
*/
private function _addRelation(
$masterTable, $font, $fontSize, $masterField,
$foreignTable, $foreignField, $showInfo
) {
if (! isset($this->_tables[$masterTable])) {
$this->_tables[$masterTable] = new Table_Stats(
$this->_tables[$masterTable] = new Table_Stats_Eps(
$masterTable, $font, $fontSize, $this->pageNumber,
$this->_tablewidth, false, $showInfo
);
}
if (! isset($this->_tables[$foreignTable])) {
$this->_tables[$foreignTable] = new Table_Stats(
$this->_tables[$foreignTable] = new Table_Stats_Eps(
$foreignTable, $font, $fontSize, $this->pageNumber,
$this->_tablewidth, false, $showInfo
);
}
$this->_relations[] = new Relation_Stats(
$this->_relations[] = new Relation_Stats_Eps(
$this->_tables[$masterTable], $masterField,
$this->_tables[$foreignTable], $foreignField
);
@ -936,7 +946,7 @@ class PMA_Eps_Relation_Schema extends PMA_Export_Relation_Schema
* @return void
*
* @access private
* @see Relation_Stats::relationDraw()
* @see Relation_Stats_Eps::relationDraw()
*/
private function _drawRelations($changeColor)
{
@ -953,7 +963,7 @@ class PMA_Eps_Relation_Schema extends PMA_Export_Relation_Schema
* @return void
*
* @access private
* @see Table_Stats::Table_Stats_tableDraw()
* @see Table_Stats_Eps::Table_Stats_tableDraw()
*/
private function _drawTables($changeColor)
{

View File

@ -207,6 +207,8 @@ class PMA_Export_Relation_Schema
if (! $tab_rs || ! $GLOBALS['dbi']->numRows($tab_rs) > 0) {
$this->dieSchema('', __('This page does not contain any tables!'));
}
//Fix undefined error
$alltables = array();
while ($curr_table = @$GLOBALS['dbi']->fetchAssoc($tab_rs)) {
$alltables[] = PMA_Util::sqlAddSlashes($curr_table['table_name']);
}

View File

@ -357,11 +357,11 @@ class PMA_Schema_PDF extends PMA_PDF
* This class preserves the table co-ordinates,fields
* and helps in drawing/generating the Tables in PDF document.
*
* @name Table_Stats
* @name Table_Stats_Pdf
* @package PhpMyAdmin
* @see PMA_Schema_PDF
*/
class Table_Stats
class Table_Stats_Pdf
{
/**
* Defines properties
@ -379,7 +379,7 @@ class Table_Stats
private $_ff = PMA_PDF_FONT;
/**
* The "Table_Stats" constructor
* The "Table_Stats_Pdf" constructor
*
* @param string $tableName The table name
* @param integer $fontSize The font size
@ -395,8 +395,8 @@ class Table_Stats
*
* @return void
*
* @see PMA_Schema_PDF, Table_Stats::Table_Stats_setWidth,
* Table_Stats::Table_Stats_setHeight
* @see PMA_Schema_PDF, Table_Stats_Pdf::Table_Stats_setWidth,
* Table_Stats_Pdf::Table_Stats_setHeight
*/
function __construct($tableName, $fontSize, $pageNumber, &$sameWideWidth,
$showKeys = false, $showInfo = false
@ -623,12 +623,12 @@ class Table_Stats
* master table's master field to foreign table's foreign key
* in PDF document.
*
* @name Relation_Stats
* @name Relation_Stats_Pdf
* @package PhpMyAdmin
* @see PMA_Schema_PDF::SetDrawColor, PMA_Schema_PDF::setLineWidthScale,
* PMA_Schema_PDF::lineScale
*/
class Relation_Stats
class Relation_Stats_Pdf
{
/**
* Defines properties
@ -640,7 +640,7 @@ class Relation_Stats
public $wTick = 5;
/**
* The "Relation_Stats" constructor
* The "Relation_Stats_Pdf" constructor
*
* @param string $master_table The master table name
* @param string $master_field The relation field in the master table
@ -649,7 +649,7 @@ class Relation_Stats
*
* @return void
*
* @see Relation_Stats::_getXy
* @see Relation_Stats_Pdf::_getXy
*/
function __construct($master_table, $master_field, $foreign_table,
$foreign_field
@ -897,7 +897,7 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
/* snip */
foreach ($alltables as $table) {
if (! isset($this->_tables[$table])) {
$this->_tables[$table] = new Table_Stats(
$this->_tables[$table] = new Table_Stats_Pdf(
$table,
null,
$this->pageNumber,
@ -967,10 +967,19 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
$this->_drawRelations($this->showColor);
}
$this->_drawTables($this->showColor);
$this->_showOutput($this->pageNumber);
exit();
}
/**
* Output Pdf Document for download
*
* @return void
* @access public
*/
function showOutput()
{
$this->_showOutput($this->pageNumber);
}
/**
* Sets X and Y minimum and maximum for a table cell
*
@ -1007,20 +1016,20 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
$foreignField, $showInfo
) {
if (! isset($this->_tables[$masterTable])) {
$this->_tables[$masterTable] = new Table_Stats(
$this->_tables[$masterTable] = new Table_Stats_Pdf(
$masterTable, null, $this->pageNumber,
$this->_tablewidth, false, $showInfo
);
$this->_setMinMax($this->_tables[$masterTable]);
}
if (! isset($this->_tables[$foreignTable])) {
$this->_tables[$foreignTable] = new Table_Stats(
$this->_tables[$foreignTable] = new Table_Stats_Pdf(
$foreignTable, null, $this->pageNumber,
$this->_tablewidth, false, $showInfo
);
$this->_setMinMax($this->_tables[$foreignTable]);
}
$this->relations[] = new Relation_Stats(
$this->relations[] = new Relation_Stats_Pdf(
$this->_tables[$masterTable], $masterField,
$this->_tables[$foreignTable], $foreignField
);
@ -1099,7 +1108,7 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
*
* @return void
*
* @see Relation_Stats::relationdraw()
* @see Relation_Stats_Pdf::relationdraw()
*/
private function _drawRelations($changeColor)
{
@ -1119,7 +1128,7 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
*
* @return void
*
* @see Table_Stats::tableDraw()
* @see Table_Stats_Pdf::tableDraw()
*/
private function _drawTables($changeColor = 0)
{

View File

@ -336,10 +336,10 @@ class PMA_SVG extends XMLWriter
* and helps in drawing/generating the Tables in SVG XML document.
*
* @package PhpMyAdmin
* @name Table_Stats
* @name Table_Stats_Svg
* @see PMA_SVG
*/
class Table_Stats
class Table_Stats_Svg
{
/**
* Defines properties
@ -357,7 +357,7 @@ class Table_Stats
public $primary = array();
/**
* The "Table_Stats" constructor
* The "Table_Stats_Svg" constructor
*
* @param string $tableName The table name
* @param string $font Font face
@ -375,8 +375,8 @@ class Table_Stats
*
* @access private
*
* @see PMA_SVG, Table_Stats::Table_Stats_setWidth,
* Table_Stats::Table_Stats_setHeight
* @see PMA_SVG, Table_Stats_Svg::Table_Stats_setWidth,
* Table_Stats_Svg::Table_Stats_setHeight
*/
function __construct(
$tableName, $font, $fontSize, $pageNumber,
@ -591,10 +591,10 @@ class Table_Stats
* in SVG XML document.
*
* @package PhpMyAdmin
* @name Relation_Stats
* @name Relation_Stats_Svg
* @see PMA_SVG::printElementLine
*/
class Relation_Stats
class Relation_Stats_Svg
{
/**
* Defines properties
@ -606,7 +606,7 @@ class Relation_Stats
public $wTick = 10;
/**
* The "Relation_Stats" constructor
* The "Relation_Stats_Svg" constructor
*
* @param string $master_table The master table name
* @param string $master_field The relation field in the master table
@ -615,7 +615,7 @@ class Relation_Stats
*
* @return void
*
* @see Relation_Stats::_getXy
* @see Relation_Stats_Svg::_getXy
*/
function __construct($master_table, $master_field, $foreign_table, $foreign_field)
{
@ -757,7 +757,7 @@ class Relation_Stats
}
}
/*
* end of the "Relation_Stats" class
* end of the "Relation_Stats_Svg" class
*/
/**
@ -822,7 +822,7 @@ class PMA_Svg_Relation_Schema extends PMA_Export_Relation_Schema
foreach ($alltables as $table) {
if (! isset($this->_tables[$table])) {
$this->_tables[$table] = new Table_Stats(
$this->_tables[$table] = new Table_Stats_Svg(
$table, $svg->getFont(), $svg->getFontSize(), $this->pageNumber,
$this->_tablewidth, $this->showKeys, $this->tableDimension
);
@ -860,10 +860,21 @@ class PMA_Svg_Relation_Schema extends PMA_Export_Relation_Schema
$this->_drawTables($this->showColor);
$svg->endSvgDoc();
$svg->showOutput($db.'-'.$this->pageNumber);
exit();
}
/**
* Output Svg Document for download
*
* @return void
* @access public
*/
function showOutput()
{
global $svg,$db;
$svg->showOutput($db.'-'.$this->pageNumber);
}
/**
* Sets X and Y minimum and maximum for a table cell
*
@ -894,27 +905,27 @@ class PMA_Svg_Relation_Schema extends PMA_Export_Relation_Schema
* @access private
* @return void
*
* @see _setMinMax,Table_Stats::__construct(),Relation_Stats::__construct()
* @see _setMinMax,Table_Stats_Svg::__construct(),Relation_Stats_Svg::__construct()
*/
private function _addRelation(
$masterTable,$font,$fontSize, $masterField,
$foreignTable, $foreignField, $showInfo
) {
if (! isset($this->_tables[$masterTable])) {
$this->_tables[$masterTable] = new Table_Stats(
$this->_tables[$masterTable] = new Table_Stats_Svg(
$masterTable, $font, $fontSize, $this->pageNumber,
$this->_tablewidth, false, $showInfo
);
$this->_setMinMax($this->_tables[$masterTable]);
}
if (! isset($this->_tables[$foreignTable])) {
$this->_tables[$foreignTable] = new Table_Stats(
$this->_tables[$foreignTable] = new Table_Stats_Svg(
$foreignTable, $font, $fontSize, $this->pageNumber,
$this->_tablewidth, false, $showInfo
);
$this->_setMinMax($this->_tables[$foreignTable]);
}
$this->_relations[] = new Relation_Stats(
$this->_relations[] = new Relation_Stats_Svg(
$this->_tables[$masterTable], $masterField,
$this->_tables[$foreignTable], $foreignField
);
@ -930,7 +941,7 @@ class PMA_Svg_Relation_Schema extends PMA_Export_Relation_Schema
* @return void
* @access private
*
* @see Relation_Stats::relationDraw()
* @see Relation_Stats_Svg::relationDraw()
*/
private function _drawRelations($changeColor)
{
@ -947,7 +958,7 @@ class PMA_Svg_Relation_Schema extends PMA_Export_Relation_Schema
* @return void
* @access private
*
* @see Table_Stats::Table_Stats_tableDraw()
* @see Table_Stats_Svg::Table_Stats_tableDraw()
*/
private function _drawTables($changeColor)
{

View File

@ -645,7 +645,8 @@ class PMA_User_Schema
include "libraries/schema/" . ucfirst($export_type)
. "_Relation_Schema.class.php";
eval("new PMA_" . ucfirst($export_type) . "_Relation_Schema();");
$obj_schema = eval("new PMA_" . ucfirst($export_type) . "_Relation_Schema();");
$obj_schema->showOutput();
}
/**

View File

@ -12,7 +12,7 @@ if (! defined('PHPMYADMIN')) {
/**
* Returns language name
*
* @param string $tmplang
* @param string $tmplang Language code
*
* @return string
*/
@ -119,7 +119,10 @@ function PMA_langSet(&$lang)
/* Partial backward compatibility with 3.3 and older branches */
$lang = str_replace('-utf-8', '', $lang);
if (!is_string($lang) || empty($lang) || empty($GLOBALS['available_languages'][$lang])) {
if (!is_string($lang)
|| empty($lang)
|| empty($GLOBALS['available_languages'][$lang])
) {
return false;
}
$GLOBALS['lang'] = $lang;
@ -343,8 +346,8 @@ function PMA_langDetails($lang)
// only TW and HK use traditional Chinese while others (CN, SG, MY)
// use simplified Chinese
return array(
'zh(?![-_](tw|hk))([-_][[:alpha:]]{2,3})?|chinese simplified',
'zh',
'zh(?![-_](tw|hk))([-_][[:alpha:]]{2,3})?|chinese simplified',
'zh',
'&#20013;&#25991;'
);
}
@ -389,7 +392,8 @@ function PMA_langList()
}
/**
* @global string path to the translations directory; may be absent if the kit is English-only
* @global string path to the translations directory;
* may be absent if the kit is English-only
*/
$GLOBALS['lang_path'] = './locale/';
@ -483,7 +487,10 @@ if (! PMA_langCheck()) {
);
// stop execution
// and tell the user that his chosen language is invalid
PMA_fatalError('Could not load any language, please check your language settings and folder.');
PMA_fatalError(
'Could not load any language, '
. 'please check your language settings and folder.'
);
}
}

View File

@ -5,7 +5,7 @@
* functions for displaying server databases
*
* @usedby server_databases.php
*
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
@ -23,15 +23,15 @@ if (! defined('PHPMYADMIN')) {
* @param string $sort_order sort order string
* @param bool $is_superuser User status
* @param Array $cfg configuration
* @param string $replication_types replication types
* @param string $replication_types replication types
* @param string $replication_info replication info
* @param string $url_query url query
*
* @return string
*/
function PMA_getHtmlForDatabase(
$databases, $databases_count, $pos, $dbstats,
$sort_by, $sort_order, $is_superuser, $cfg,
$databases, $databases_count, $pos, $dbstats,
$sort_by, $sort_order, $is_superuser, $cfg,
$replication_types, $replication_info, $url_query
) {
$html = '<div id="tableslistcontainer">';
@ -60,67 +60,67 @@ function PMA_getHtmlForDatabase(
$html .= PMA_generate_common_hidden_inputs($_url_params);
$_url_params['sort_by'] = 'SCHEMA_NAME';
$_url_params['sort_order']
$_url_params['sort_order']
= ($sort_by == 'SCHEMA_NAME' && $sort_order == 'asc') ? 'desc' : 'asc';
$html .= '<table id="tabledatabases" class="data">' . "\n"
. '<thead>' . "\n"
. '<tr>' . "\n";
$html .= PMA_getHtmlForColumnOrderWithSort(
$is_superuser,
$cfg['AllowUserDropDatabase'],
$_url_params,
$sort_by,
$sort_order,
$column_order,
$is_superuser,
$cfg['AllowUserDropDatabase'],
$_url_params,
$sort_by,
$sort_order,
$column_order,
$first_database
);
);
$html .= PMA_getHtmlForReplicationType(
$is_superuser,
$replication_types,
$is_superuser,
$replication_types,
$cfg['ActionLinksMode']
);
);
$html .= '</tr>' . "\n"
. '</thead>' . "\n";
$html .= PMA_getHtmlForDatabaseList(
$databases,
$is_superuser,
$url_query,
$column_order,
$replication_types,
$databases,
$is_superuser,
$url_query,
$column_order,
$replication_types,
$replication_info
);
$html .= PMA_getHtmlForTableFooter(
$cfg['AllowUserDropDatabase'],
$is_superuser,
$databases_count,
$column_order,
$replication_types,
$cfg['AllowUserDropDatabase'],
$is_superuser,
$databases_count,
$column_order,
$replication_types,
$first_database
);
$html .= '</table>' . "\n";
$html .= PMA_getHtmlForTableFooterButtons(
$cfg['AllowUserDropDatabase'],
$is_superuser,
$sort_by,
$sort_order,
$cfg['AllowUserDropDatabase'],
$is_superuser,
$sort_by,
$sort_order,
$dbstats
);
if (empty($dbstats)) {
//we should put notice above database list
$html = PMA_getHtmlForNoticeEnableStatistics($url_query, $html);
}
$html .= '</form>';
$html .= '</div>';
return $html;
}
@ -136,22 +136,15 @@ function PMA_getHtmlForDatabase(
* @return string
*/
function PMA_getHtmlForTableFooterButtons(
$is_allowUserDropDatabase, $is_superuser,
$is_allowUserDropDatabase, $is_superuser,
$sort_by, $sort_order, $dbstats
) {
$html = "";
if ($is_superuser || $is_allowUserDropDatabase) {
$common_url_query = PMA_generate_common_url(
array(
'sort_by' => $sort_by,
'sort_order' => $sort_order,
'dbstats' => $dbstats
)
);
$html .= '<img class="selectallarrow" src="'
$html .= '<img class="selectallarrow" src="'
. $GLOBALS['pmaThemeImage'] . 'arrow_' . $GLOBALS['text_dir'] . '.png"'
. ' width="38" height="22" alt="' . __('With selected:') . '" />' . "\n"
. '<input type="checkbox" id="dbStatsForm_checkall" '
. '<input type="checkbox" id="dbStatsForm_checkall" '
. 'class="checkall_box" title="' . __('Check All') . '" /> '
. '<label for="dbStatsForm_checkall">' . __('Check All') . '</label> '
. '<i style="margin-left: 2em">' . __('With selected:') . '</i>' . "\n";
@ -178,19 +171,19 @@ function PMA_getHtmlForTableFooterButtons(
* @return string
*/
function PMA_getHtmlForTableFooter(
$is_allowUserDropDatabase, $is_superuser,
$databases_count, $column_order,
$is_allowUserDropDatabase, $is_superuser,
$databases_count, $column_order,
$replication_types, $first_database
) {
$html = '<tfoot><tr>' . "\n";
if ($is_superuser || $is_allowUserDropDatabase) {
$html .= ' <th></th>' . "\n";
}
$html .= ' <th>' . __('Total') . ': <span id="databases_count">'
$html .= ' <th>' . __('Total') . ': <span id="databases_count">'
. $databases_count . '</span></th>' . "\n";
$html .= PMA_getHtmlForColumnOrder($column_order, $first_database);
$html .= PMA_getHtmlForColumnOrder($column_order, $first_database);
foreach ($replication_types as $type) {
if ($GLOBALS["server_" . $type. "_status"]) {
$html .= ' <th></th>' . "\n";
@ -204,7 +197,7 @@ function PMA_getHtmlForTableFooter(
$html .= '</tfoot>' . "\n";
return $html;
}
/**
* Returns the html for Database List with Column order
*
@ -218,7 +211,7 @@ function PMA_getHtmlForTableFooter(
* @return string
*/
function PMA_getHtmlForDatabaseList(
$databases, $is_superuser, $url_query,
$databases, $is_superuser, $url_query,
$column_order, $replication_types, $replication_info
) {
$odd_row = true;
@ -264,7 +257,7 @@ function PMA_getHtmlForColumnOrder($column_order, $first_database)
foreach ($column_order as $stat_name => $stat) {
if (array_key_exists($stat_name, $first_database)) {
if ($stat['format'] === 'byte') {
list($value, $unit)
list($value, $unit)
= PMA_Util::formatByteDown($stat['footer'], 3, 1);
} elseif ($stat['format'] === 'number') {
$value = PMA_Util::formatNumber($stat['footer'], 0);
@ -273,7 +266,7 @@ function PMA_getHtmlForColumnOrder($column_order, $first_database)
}
$html .= ' <th class="value">';
if (isset($stat['description_function'])) {
$html .= '<dfn title="'
$html .= '<dfn title="'
. $stat['description_function']($stat['footer']) . '">';
}
$html .= $value;
@ -286,7 +279,7 @@ function PMA_getHtmlForColumnOrder($column_order, $first_database)
}
}
}
return $html;
}
@ -305,21 +298,21 @@ function PMA_getHtmlForColumnOrder($column_order, $first_database)
* @return string
*/
function PMA_getHtmlForColumnOrderWithSort(
$is_superuser, $is_allowUserDropDatabase,
$_url_params, $sort_by, $sort_order,
$is_superuser, $is_allowUserDropDatabase,
$_url_params, $sort_by, $sort_order,
$column_order, $first_database
) {
$html = ($is_superuser || $is_allowUserDropDatabase
? ' <th></th>' . "\n"
$html = ($is_superuser || $is_allowUserDropDatabase
? ' <th></th>' . "\n"
: '')
. ' <th><a href="server_databases.php'
. ' <th><a href="server_databases.php'
. PMA_generate_common_url($_url_params) . '">' . "\n"
. ' ' . __('Database') . "\n"
. ($sort_by == 'SCHEMA_NAME'
. ($sort_by == 'SCHEMA_NAME'
? ' ' . PMA_Util::getImage(
's_' . $sort_order . '.png',
's_' . $sort_order . '.png',
($sort_order == 'asc' ? __('Ascending') : __('Descending'))
) . "\n"
) . "\n"
: ''
)
. ' </a></th>' . "\n";
@ -334,17 +327,17 @@ function PMA_getHtmlForColumnOrderWithSort(
$colspan = '';
}
$_url_params['sort_by'] = $stat_name;
$_url_params['sort_order']
$_url_params['sort_order']
= ($sort_by == $stat_name && $sort_order == 'desc') ? 'asc' : 'desc';
$html .= ' <th' . $colspan . '>'
. '<a href="server_databases.php'
. '<a href="server_databases.php'
. PMA_generate_common_url($_url_params) . '">' . "\n"
. ' ' . $stat['disp_name'] . "\n"
. ($sort_by == $stat_name
. ($sort_by == $stat_name
? ' ' . PMA_Util::getImage(
's_' . $sort_order . '.png',
's_' . $sort_order . '.png',
($sort_order == 'asc' ? __('Ascending') : __('Descending'))
) . "\n"
) . "\n"
: ''
)
. ' </a></th>' . "\n";
@ -353,7 +346,7 @@ function PMA_getHtmlForColumnOrderWithSort(
return $html;
}
/**
* Returns the html for Enable Statistics
*
@ -366,7 +359,7 @@ function PMA_getHtmlForNoticeEnableStatistics($url_query, $html)
{
$notice = PMA_Message::notice(
__(
'Note: Enabling the database statistics here might cause '
'Note: Enabling the database statistics here might cause '
. 'heavy traffic between the web server and the MySQL server.'
)
)->getDisplay();
@ -378,10 +371,10 @@ function PMA_getHtmlForNoticeEnableStatistics($url_query, $html)
. ' ' . __('Enable Statistics');
$html .= '</a></strong><br />' . "\n";
$html .= '</li>' . "\n" . '</ul>' . "\n";
return $html;
return $html;
}
/**
* Returns the html for database replication types
*

View File

@ -164,121 +164,150 @@ function PMA_getGrantsArray()
array(
'Select_priv',
'SELECT',
__('Allows reading data.')),
__('Allows reading data.')
),
array(
'Insert_priv',
'INSERT',
__('Allows inserting and replacing data.')),
__('Allows inserting and replacing data.')
),
array(
'Update_priv',
'UPDATE',
__('Allows changing data.')),
__('Allows changing data.')
),
array(
'Delete_priv',
'DELETE',
__('Allows deleting data.')),
__('Allows deleting data.')
),
array(
'Create_priv',
'CREATE',
__('Allows creating new databases and tables.')),
__('Allows creating new databases and tables.')
),
array(
'Drop_priv',
'DROP',
__('Allows dropping databases and tables.')),
__('Allows dropping databases and tables.')
),
array(
'Reload_priv',
'RELOAD',
__('Allows reloading server settings and flushing the server\'s caches.')),
__('Allows reloading server settings and flushing the server\'s caches.')
),
array(
'Shutdown_priv',
'SHUTDOWN',
__('Allows shutting down the server.')),
__('Allows shutting down the server.')
),
array(
'Process_priv',
'PROCESS',
__('Allows viewing processes of all users')),
__('Allows viewing processes of all users')
),
array(
'File_priv',
'FILE',
__('Allows importing data from and exporting data into files.')),
__('Allows importing data from and exporting data into files.')
),
array(
'References_priv',
'REFERENCES',
__('Has no effect in this MySQL version.')),
__('Has no effect in this MySQL version.')
),
array(
'Index_priv',
'INDEX',
__('Allows creating and dropping indexes.')),
__('Allows creating and dropping indexes.')
),
array(
'Alter_priv',
'ALTER',
__('Allows altering the structure of existing tables.')),
__('Allows altering the structure of existing tables.')
),
array(
'Show_db_priv',
'SHOW DATABASES',
__('Gives access to the complete list of databases.')),
__('Gives access to the complete list of databases.')
),
array(
'Super_priv',
'SUPER',
__('Allows connecting, even if maximum number of connections is reached; required for most administrative operations like setting global variables or killing threads of other users.')),
__('Allows connecting, even if maximum number of connections is reached; required for most administrative operations like setting global variables or killing threads of other users.')
),
array(
'Create_tmp_table_priv',
'CREATE TEMPORARY TABLES',
__('Allows creating temporary tables.')),
__('Allows creating temporary tables.')
),
array(
'Lock_tables_priv',
'LOCK TABLES',
__('Allows locking tables for the current thread.')),
__('Allows locking tables for the current thread.')
),
array(
'Repl_slave_priv',
'REPLICATION SLAVE',
__('Needed for the replication slaves.')),
__('Needed for the replication slaves.')
),
array(
'Repl_client_priv',
'REPLICATION CLIENT',
__('Allows the user to ask where the slaves / masters are.')),
__('Allows the user to ask where the slaves / masters are.')
),
array(
'Create_view_priv',
'CREATE VIEW',
__('Allows creating new views.')),
__('Allows creating new views.')
),
array(
'Event_priv',
'EVENT',
__('Allows to set up events for the event scheduler')),
__('Allows to set up events for the event scheduler')
),
array(
'Trigger_priv',
'TRIGGER',
__('Allows creating and dropping triggers')),
__('Allows creating and dropping triggers')
),
// for table privs:
array(
'Create View_priv',
'CREATE VIEW',
__('Allows creating new views.')),
__('Allows creating new views.')
),
array(
'Show_view_priv',
'SHOW VIEW',
__('Allows performing SHOW CREATE VIEW queries.')),
__('Allows performing SHOW CREATE VIEW queries.')
),
// for table privs:
array(
'Show view_priv',
'SHOW VIEW',
__('Allows performing SHOW CREATE VIEW queries.')),
__('Allows performing SHOW CREATE VIEW queries.')
),
array(
'Create_routine_priv',
'CREATE ROUTINE',
__('Allows creating stored routines.')),
__('Allows creating stored routines.')
),
array(
'Alter_routine_priv',
'ALTER ROUTINE',
__('Allows altering and dropping stored routines.')),
__('Allows altering and dropping stored routines.')
),
array(
'Create_user_priv',
'CREATE USER',
__('Allows creating, dropping and renaming user accounts.')),
__('Allows creating, dropping and renaming user accounts.')
),
array(
'Execute_priv',
'EXECUTE',
__('Allows executing stored routines.')),
__('Allows executing stored routines.')
),
);
}
@ -562,12 +591,12 @@ function PMA_getHtmlForDisplayResourceLimits($row)
* @param string $db the database
* @param string $table the table
* @param boolean $columns columns array
* @param $row
* @param $row current privileges row
*
* @return string $html_output
*/
function PMA_getHtmlForTableSpecificPrivileges($username, $hostname, $db,
$table, $columns, $row
function PMA_getHtmlForTableSpecificPrivileges(
$username, $hostname, $db, $table, $columns, $row
) {
$res = $GLOBALS['dbi']->query(
'SELECT `Column_name`, `Column_priv`'

View File

@ -132,7 +132,7 @@ function getTableHtmlForMultipleQueries(
$unlim_num_rows = PMA_Table::countRecords($db, $table, true);
$showtable = PMA_Table::sGetStatusInfo($db, $table, null, true);
$url_query = PMA_generate_common_url($db, $table);
// Handle remembered sorting order, only for single table query
if ($GLOBALS['cfg']['RememberSorting']
&& ! ($is_count || $is_export || $is_func || $is_analyse)
@ -659,7 +659,7 @@ function PMA_getHtmlForOptionsList($values, $selected_values)
* @param string $goto goto page url
* @param string $bkm_sql_query the query to be bookmarked
* @param string $bkm_user the user creating the bookmark
*
*
* @return void
*/
function PMA_getHtmlForBookmark($db, $goto, $bkm_sql_query, $bkm_user)
@ -708,17 +708,17 @@ function PMA_getHtmlForBookmark($db, $goto, $bkm_sql_query, $bkm_user)
/**
* Function to check whether to remember the sorting order or not
*
*
* @param array $analyzed_sql_results the analyzed query and other varibles set
* after analyzing the query
*
*
* @return boolean
*/
function PMA_isRememberSortingOrder($analyzed_sql_results)
{
$select_from = isset(
$analyzed_sql_results['analyzed_sql'][0]['queryflags']['select_from']
);
);
if ($GLOBALS['cfg']['RememberSorting']
&& ! ($analyzed_sql_results['is_count']
|| $analyzed_sql_results['is_export']
@ -737,17 +737,17 @@ function PMA_isRememberSortingOrder($analyzed_sql_results)
/**
* Function to check whether the LIMIT clause should be appended or not
*
*
* @param array $analyzed_sql_results the analyzed query and other varibles set
* after analyzing the query
*
*
* @return boolean
*/
function PMA_isAppendLimitClause($analyzed_sql_results)
{
$select_from = isset(
$analyzed_sql_results['analyzed_sql'][0]['queryflags']['select_from']
);
);
if (($_SESSION['tmp_user_values']['max_rows'] != 'all')
&& ! ($analyzed_sql_results['is_count']
|| $analyzed_sql_results['is_export']
@ -765,11 +765,11 @@ function PMA_isAppendLimitClause($analyzed_sql_results)
/**
* Function to check whether this query is for just browsing
*
*
* @param array $analyzed_sql_results the analyzed query and other varibles set
* after analyzing the query
* @param boolean $find_real_end whether the real end should be found
*
*
* @return boolean
*/
function PMA_isJustBrowsing($analyzed_sql_results, $find_real_end)
@ -777,7 +777,7 @@ function PMA_isJustBrowsing($analyzed_sql_results, $find_real_end)
$distinct = isset(
$analyzed_sql_results['analyzed_sql'][0]['queryflags']['distinct']
);
$table_name = isset(
$analyzed_sql_results['analyzed_sql'][0]['table_ref'][1]['table_name']
);
@ -797,10 +797,10 @@ function PMA_isJustBrowsing($analyzed_sql_results, $find_real_end)
/**
* Function to check whether the reated transformation information shoul be deleted
*
*
* @param array $analyzed_sql_results the analyzed query and other varibles set
* after analyzing the query
*
* after analyzing the query
*
* @return boolean
*/
function PMA_isDeleteTransformationInfo($analyzed_sql_results)
@ -817,12 +817,12 @@ function PMA_isDeleteTransformationInfo($analyzed_sql_results)
/**
* Function to check whether the user has rights to drop the database
*
*
* @param array $analyzed_sql_results the analyzed query and other varibles set
* after analyzing the query
* @param boolean $allowUserDropDatabase whether the user is allowed to drop db
* @param boolean $is_superuser whether this user is a superuser
*
* @param boolean $is_superuser whether this user is a superuser
*
* @return boolean
*/
function PMA_hasNoRightsToDropDatabase($analyzed_sql_results,
@ -842,9 +842,9 @@ function PMA_hasNoRightsToDropDatabase($analyzed_sql_results,
/**
* Function to set the column order
*
*
* @param PMA_Table $pmatable PMA_Table instance
*
*
* @return boolean $retval
*/
function PMA_setColumnOrder($pmatable)
@ -861,15 +861,15 @@ function PMA_setColumnOrder($pmatable)
$response->addJSON('message', $retval->getString());
exit;
}
return $retval;
}
/**
* Function to set the column visibility
*
*
* @param PMA_Table $pmatable PMA_Table instance
*
*
* @return boolean $retval
*/
function PMA_setColumnVisibility($pmatable)
@ -890,10 +890,10 @@ function PMA_setColumnVisibility($pmatable)
/**
* Function to check the request for setting the column order or visibility
*
*
* @param String $table the current table
* @param String $db the current database
*
*
* @return void
*/
function PMA_setColumnOrderOrVisibility($table, $db)
@ -918,10 +918,10 @@ function PMA_setColumnOrderOrVisibility($table, $db)
/**
* Function to add a bookmark
*
*
* @param String $pmaAbsoluteUri absolute URI
* @param String $goto goto page URL
*
*
* @return void
*/
function PMA_addBookmark($pmaAbsoluteUri, $goto)
@ -955,10 +955,10 @@ function PMA_addBookmark($pmaAbsoluteUri, $goto)
/**
* Function to find the real end of rows
*
*
* @param String $db the current database
* @param String $table the current table
*
*
* @return mixed the number of rows if "retain" param is true, otherwise true
*/
function PMA_findRealEndOfRows($db, $table)
@ -967,18 +967,18 @@ function PMA_findRealEndOfRows($db, $table)
$_SESSION['tmp_user_values']['pos'] = @((ceil(
$unlim_num_rows / $_SESSION['tmp_user_values']['max_rows']
) - 1) * $_SESSION['tmp_user_values']['max_rows']);
return $unlim_num_rows;
}
/**
* Function to get values for the relational columns
*
* @param String $db the current database
*
* @param String $db the current database
* @param String $table the current table
* @param String $display_field display field
*
* @return void
*
* @return void
*/
function PMA_getRelationalValues($db, $table, $display_field)
{
@ -1003,11 +1003,11 @@ function PMA_getRelationalValues($db, $table, $display_field)
/**
* Function to get values for Enum or Set Columns
*
*
* @param String $db the current database
* @param String $table the current table
* @param String $columnType whether enum or set
*
*
* @return void
*/
function PMA_getEnumOrSetValues($db, $table, $columnType)
@ -1028,12 +1028,12 @@ function PMA_getEnumOrSetValues($db, $table, $columnType)
}
/**
* Function to append the limit clause
*
* Function to append the limit clause
*
* @param String $full_sql_query full sql query
* @param array $analyzed_sql analyzed sql query
* @param String $display_query display query
*
*
* @return array
*/
function PMA_appendLimitClause($full_sql_query, $analyzed_sql, $display_query)
@ -1065,7 +1065,7 @@ function PMA_appendLimitClause($full_sql_query, $analyzed_sql, $display_query)
. $analyzed_display_query[0]['section_after_limit'];
}
}
return array($sql_limit_to_append, $full_sql_query, isset(
$analyzed_display_query)
? $analyzed_display_query : null,
@ -1075,10 +1075,10 @@ function PMA_appendLimitClause($full_sql_query, $analyzed_sql, $display_query)
/**
* Function to get the default sql query for browsing page
*
*
* @param String $db the current database
* @param String $table the current table
*
*
* @return String $sql_query the default $sql_query for browse page
*/
function PMA_getDefaultSqlQueryForBrowse($db, $table)
@ -1105,37 +1105,38 @@ function PMA_getDefaultSqlQueryForBrowse($db, $table)
$sql_query = 'SELECT * FROM ' . PMA_Util::backquote($table);
}
unset($book_sql_query);
return $sql_query;
}
/**
* Responds an error when an error happens when executing the query
*
* Responds an error when an error happens when executing the query
*
* @param boolean $is_gotofile whether goto file or not
* @param String $error error after executing the query
*
* @return void
*
* @return void
*/
function PMA_handleQueryExecuteError($is_gotofile, $error) {
function PMA_handleQueryExecuteError($is_gotofile, $error)
{
if ($is_gotofile) {
$message = PMA_Message::rawError($error);
$response = PMA_Response::getInstance();
$response->isSuccess(false);
$response->addJSON('message', $message);
exit;
}
exit;
}
}
/**
* Function to store the query as a bookmark
*
*
* @param String $db the current database
* @param String $bkm_user the bookmarking user
* @param String $import_text import text
* @param String $bkm_label bookmark label
* @param boolean $bkm_replace whether to replace existing bookmarks
*
*
* @return void
*/
function PMA_storeTheQueryAsBookmark($db, $bkm_user, $import_text,
@ -1165,9 +1166,9 @@ function PMA_storeTheQueryAsBookmark($db, $bkm_user, $import_text,
/**
* Function to execute the SQL query and set the execution time
*
*
* @param String $full_sql_query the full sql query
*
*
* @return mixed $result the results after running the query
*/
function PMA_executeQueryAndStoreResults($full_sql_query)
@ -1191,16 +1192,16 @@ function PMA_executeQueryAndStoreResults($full_sql_query)
}
} while ($GLOBALS['dbi']->nextResult());
return $result;
return $result;
}
/**
* Function to get the affected or changed number of rows after executing a query
*
*
* @param boolean $is_affected whether the query affected a table
* @param mixed $result results of executing the query
* @param int $num_rows number of rows affected or changed
*
*
* @return int $num_rows number of rows affected or changed
*/
function PMA_getNumberOfRowsAffectedOrChanged($is_affected, $result, $num_rows)
@ -1210,16 +1211,16 @@ function PMA_getNumberOfRowsAffectedOrChanged($is_affected, $result, $num_rows)
} elseif (! isset($num_rows)) {
$num_rows = @$GLOBALS['dbi']->affectedRows();
}
return $num_rows;
}
/**
* Checks if the current database has changed
* This could happen if the user sends a query like "USE `database`;"
*
*
* @param String $db the database in the query
*
*
* @return int $reload whether to reload the navigation(1) or not(0)
*/
function PMA_hasCurrentDbChanged($db)
@ -1232,21 +1233,21 @@ function PMA_hasCurrentDbChanged($db)
if ($db !== $current_db) {
$reload = 1;
}
$GLOBALS['dbi']->selectDb($db);
$GLOBALS['dbi']->selectDb($db);
}
return $reload;
}
/**
* If a table, database or column gets dropped, clean comments.
*
*
* @param String $db current database
* @param String $table current table
* @param String $dropped_column dropped column if any
* @param bool $purge
* @param array $extra_data
*
*
* @return array $extra_data
*/
function PMA_cleanupRelations($db, $table, $dropped_column, $purge, $extra_data)
@ -1260,16 +1261,16 @@ function PMA_cleanupRelations($db, $table, $dropped_column, $purge, $extra_data)
PMA_relationsCleanupDatabase($db);
}
}
if (isset($dropped_column)
&& !empty($dropped_column)
&& !empty($dropped_column)
&& strlen($db)
&& strlen($table)
) {
PMA_relationsCleanupColumn($db, $table, $dropped_column);
if(isset($extra_data)) {
if (isset($extra_data)) {
// to refresh the list of indexes (Ajax mode)
$extra_data['indexes_list'] = PMA_Index::getView($table, $db);
$extra_data['indexes_list'] = PMA_Index::getView($table, $db);
}
}
@ -1279,7 +1280,7 @@ function PMA_cleanupRelations($db, $table, $dropped_column, $purge, $extra_data)
/**
* Function to count the total number of rows for the same 'SELECT' query without
* the 'LIMIT' clause that may have been programatically added
*
*
* @param int $num_rows number of rows affected/changed by the query
* @param bool $is_select whether the query is SELECT or not
* @param bool $justBrowsing whether just browsing or not
@ -1288,14 +1289,14 @@ function PMA_cleanupRelations($db, $table, $dropped_column, $purge, $extra_data)
* @param array $parsed_sql parsed sql
* @param array $analyzed_sql_results the analyzed query and other varibles set
* after analyzing the query
*
*
* @return int $unlim_num_rows unlimited number of rows
*/
function PMA_countQueryResults($num_rows, $is_select, $justBrowsing,
function PMA_countQueryResults(
$num_rows, $is_select, $justBrowsing,
$db, $table, $parsed_sql, $analyzed_sql_results
) {
if (!PMA_isAppendLimitClause($analyzed_sql_results))
{
if (!PMA_isAppendLimitClause($analyzed_sql_results)) {
// if we did not append a limit, set this to get a correct
// "Showing rows..." message
// $_SESSION['tmp_user_values']['max_rows'] = 'all';
@ -1312,9 +1313,9 @@ function PMA_countQueryResults($num_rows, $is_select, $justBrowsing,
// due to $find_real_end == true
if ($justBrowsing) {
$unlim_num_rows = PMA_Table::countRecords(
$db,
$table,
$force_exact = true
$db,
$table,
true
);
} else {
@ -1326,9 +1327,9 @@ function PMA_countQueryResults($num_rows, $is_select, $justBrowsing,
// take the left part, could be:
// SELECT
// (SELECT
$analyzed_sql = $analyzed_sql_results['analyzed_sql'];
$count_query = PMA_SQP_format(
$parsed_sql,
'query_only',
@ -1379,22 +1380,22 @@ function PMA_countQueryResults($num_rows, $is_select, $justBrowsing,
} else {// not $is_select
$unlim_num_rows = 0;
}
return $unlim_num_rows;
}
/**
* Function to handle all aspects relating to executing the query
*
*
* @param array $analyzed_sql_results
* @param String $full_sql_query full sql query
* @param boolean $is_gotofile whether to go to a file
* @param String $db current database
* @param String $table current table
* @param boolean $find_real_end whether to find the real end
* @param String $import_text sql command
* @param String $import_text sql command
* @param String $bkm_user bookmarking user
*
*
* @return mixed
*/
function PMA_executeTheQuery($analyzed_sql_results, $full_sql_query, $is_gotofile,
@ -1417,7 +1418,7 @@ function PMA_executeTheQuery($analyzed_sql_results, $full_sql_query, $is_gotofil
if ($error) {
PMA_handleQueryExecuteError($is_gotofile, $error);
}
// If there are no errors and bookmarklabel was given,
// store the query as a bookmark
if (! empty($_POST['bkm_label']) && ! empty($import_text)) {
@ -1441,14 +1442,14 @@ function PMA_executeTheQuery($analyzed_sql_results, $full_sql_query, $is_gotofil
}
$justBrowsing = PMA_isJustBrowsing(
$analyzed_sql_results,isset($find_real_end) ? $find_real_end : null
$analyzed_sql_results, isset($find_real_end) ? $find_real_end : null
);
$unlim_num_rows = PMA_countQueryResults($num_rows,
$analyzed_sql_results['is_select'], $justBrowsing, $db,
$table, $analyzed_sql_results['parsed_sql'], $analyzed_sql_results
);
$extra_data = PMA_cleanupRelations(
isset($db) ? $db : '', isset($table) ? $table : '',
isset($_REQUEST['dropped_column']) ? $_REQUEST['dropped_column'] : null,
@ -1456,7 +1457,7 @@ function PMA_executeTheQuery($analyzed_sql_results, $full_sql_query, $is_gotofil
isset($extra_data) ? $extra_data : null
);
}
return array($result, $num_rows, $unlim_num_rows,
isset($profiling_results) ? $profiling_results : null,
isset($justBrowsing) ? $justBrowsing : null, $extra_data
@ -1464,11 +1465,11 @@ function PMA_executeTheQuery($analyzed_sql_results, $full_sql_query, $is_gotofil
}
/**
* Delete related tranformatioinformationn information
*
*
* @param String $db current database
* @param String $table current table
* @param array $analyzed_sql analyzed sql query
*
*
* @return void
*/
function PMA_deleteTransformationInfo($db, $table, $analyzed_sql)
@ -1492,15 +1493,15 @@ function PMA_deleteTransformationInfo($db, $table, $analyzed_sql)
/**
* Function to get the message for the no rows returned case
*
*
* @param string $message_to_show message to show
* @param array $analyzed_sql_results analyzed sql results
* @param int $num_rows number of rows
*
*
* @return string $message
*/
function PMA_getMessageForNoRowsReturned($message_to_show, $analyzed_sql_results,
$num_rows
function PMA_getMessageForNoRowsReturned(
$message_to_show, $analyzed_sql_results, $num_rows
) {
if ($analyzed_sql_results['is_delete']) {
$message = PMA_Message::getMessageForDeletedRows($num_rows);
@ -1554,27 +1555,27 @@ $num_rows
$_querytime->addParam($GLOBALS['querytime']);
$message->addMessage($_querytime);
}
return $message;
}
/**
* Function to send the Ajax response when no rows returned
*
*
* @param string $message message to be send
* @param array $analyzed_sql analyzed sql
* @param object $displayResultsObject DisplayResult instance
* @param bool $showSql whether to show sql or not
* @param array $extra_data extra data
*
*
* @return void
*/
function PMA_sendAjaxResponseForNoResultsReturned($message, $analyzed_sql,
$displayResultsObject, $showSql, $extra_data
function PMA_sendAjaxResponseForNoResultsReturned(
$message, $analyzed_sql, $displayResultsObject, $showSql, $extra_data
) {
/**
* @todo find a better way to make getMessage() in Header.class.php
* output the intended message
* output the intended message
*/
$GLOBALS['message'] = $message;
@ -1616,7 +1617,7 @@ $displayResultsObject, $showSql, $extra_data
* 5-> When deleting a row from BROWSE tab
* 6-> When searching using the SEARCH tab which returns zero results
* 7-> When changing the structure of the table except change operation
*
*
* @param array $analyzed_sql_results analyzed sql results
* @param string $db current database
* @param string $table current table
@ -1625,7 +1626,7 @@ $displayResultsObject, $showSql, $extra_data
* @param object $displayResultsObject DisplayResult instance
* @param array $extra_data extra data
* @param array $cfg configuration
*
*
* @return void
*/
function PMA_sendResponseForNoResultsReturned($analyzed_sql_results, $db, $table,
@ -1636,7 +1637,7 @@ function PMA_sendResponseForNoResultsReturned($analyzed_sql_results, $db, $table
$db, $table, $analyzed_sql_results['analyzed_sql']
);
}
$message = PMA_getMessageForNoRowsReturned(
isset($message_to_show) ? $message_to_show : null, $analyzed_sql_results,
$num_rows

View File

@ -260,11 +260,6 @@ function PMA_SQP_parse($sql)
$punct_queryend = ';';
$punct_qualifier = '.';
$punct_listsep = ',';
$punct_level_plus = '(';
$punct_level_minus = ')';
$punct_user = '@';
$digit_floatdecimal = '.';
$digit_hexset = 'x';
$bracket_list = '()[]{}';
$allpunct_list = '-,;:!?/.^~\*&%+<=>|';
$allpunct_list_pair = array(
@ -1862,7 +1857,7 @@ function PMA_SQP_analyze($arr)
}
}
// do not add a space after an identifier if followed by a dot
if ($arr[$i]['type'] == 'alpha_identifier'
&& $i < $size - 1 && $arr[$i + 1]['data'] == '.'

View File

@ -395,7 +395,7 @@ if (!$GLOBALS['sqlvalidator_error']) {
&& ($this->session_data->target != $this->url)
) {
// Reopens the service on the new URL that was provided
$url = $this->session_data->target;
$this->url = $this->session_data->target;
$this->startService();
}
} // end of the "startSession()" function

View File

@ -1057,7 +1057,7 @@ function PMA_getStuffForEngineTypeTable($current_table, $db_is_information_schem
// countRecords() takes care of $cfg['MaxExactCountViews']
$current_table['TABLE_ROWS'] = PMA_Table::countRecords(
$GLOBALS['db'], $current_table['TABLE_NAME'],
$force_exact = true, $is_view = true
true, true
);
$table_is_view = true;
}
@ -1138,7 +1138,7 @@ function PMA_getValuesForPbmsTable($current_table, $is_show_stats, $sum_size)
$current_table['COUNTED'] = true;
$current_table['TABLE_ROWS'] = PMA_Table::countRecords(
$GLOBALS['db'], $current_table['TABLE_NAME'],
$force_exact = true, $is_view = false
true, false
);
} else {
$current_table['COUNTED'] = false;
@ -1191,11 +1191,7 @@ function PMA_getHtmlForTableStructureHeader(
if (PMA_DRIZZLE) {
$colspan -= 2;
}
if (in_array(
$GLOBALS['cfg']['ActionLinksMode'],
array('icons', 'both')
)
) {
if (in_array($GLOBALS['cfg']['ActionLinksMode'], array('icons', 'both'))) {
$colspan--;
}
$html_output .= '<th colspan="' . $colspan . '" '
@ -1722,10 +1718,10 @@ function getHtmlForRowStatsTable($showtable, $tbl_collation,
&& isset($showtable['Avg_row_length'])
&& $showtable['Avg_row_length'] > 0
) {
list($avg_row_length_value, $avg_row_length_unit)
list($avg_row_length_value, $avg_row_length_unit)
= PMA_Util::formatByteDown(
$showtable['Avg_row_length'],
6,
6,
1
);
$html_output .= PMA_getHtmlForRowStatsTableRow(
@ -2507,7 +2503,7 @@ function PMA_moveColumns($db, $table)
$move_query = 'ALTER TABLE ' . PMA_Util::backquote($table) . ' ';
$move_query .= implode(', ', $changes);
// move columns
$result = $GLOBALS['dbi']->tryQuery($move_query);
$GLOBALS['dbi']->tryQuery($move_query);
$tmp_error = $GLOBALS['dbi']->getError();
if ($tmp_error) {
$response->isSuccess(false);

View File

@ -48,8 +48,6 @@ function PMA_getSysInfo()
$php_os = PMA_getSysInfoOs();
$supported = array('Linux', 'WINNT', 'SunOS');
$sysinfo = array();
if (in_array($php_os, $supported)) {
$ret = eval("return new PMA_SysInfo" . $php_os . "();");
if ($ret->supported()) {
@ -341,12 +339,6 @@ class PMA_SysInfoSunos extends PMA_SysInfo
*/
public function memory()
{
preg_match_all(
MEMORY_REGEXP,
file_get_contents('/proc/meminfo'),
$matches
);
$pagesize = $this->_kstat('unix:0:seg_cache:slab_size');
$mem['MemTotal']
= $this->_kstat('unix:0:system_pages:pagestotal') * $pagesize;

1157
po/bn.po

File diff suppressed because it is too large Load Diff

View File

@ -64,3 +64,4 @@ if (!file_exists('libraries/schema/' . $path . '_Relation_Schema.class.php')) {
}
require "libraries/schema/".$path.'_Relation_Schema.class.php';
$obj_schema = eval("new PMA_".$path."_Relation_Schema();");
$obj_schema->showOutput();

View File

@ -108,11 +108,12 @@ $visualization = PMA_GIS_visualizationResults(
* Displays the page
*/
$html = PMA_getHtmlForGisVisualization($url_params, $labelCandidates,
$spatialCandidates, $visualizationSettings, $sql_query,$visualization,
$svg_support, $data
$html = PMA_getHtmlForGisVisualization(
$url_params, $labelCandidates, $spatialCandidates,
$visualizationSettings, $sql_query, $visualization, $svg_support,
$data
);
$response->addHTML($html);
?>
?>

View File

@ -92,10 +92,10 @@ class PMA_StorageEngineTest extends PHPUnit_Framework_TestCase
*/
public function testGetHtmlSelect()
{
$html = $this->object->getHtmlSelect();
$html = $this->object->getHtmlSelect();
$this->assertContains(
'<option value="dummy" title="dummy comment">',
'<option value="dummy" title="dummy comment">',
$html
);
}

View File

@ -0,0 +1,127 @@
<?php
/**
* Tests for PMA_Dia_Relation_Schema class
*
* @package PhpMyAdmin-test
*/
/*
* Include to test.
*/
require_once 'libraries/Util.class.php';
require_once 'libraries/relation.lib.php';
require_once 'libraries/url_generating.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/database_interface.inc.php';
require_once 'libraries/Response.class.php';
require_once 'libraries/schema/Dia_Relation_Schema.class.php';
/**
* Tests for PMA_Dia_Relation_Schema class
*
* @package PhpMyAdmin-test
*/
class PMA_Dia_Relation_Schema_Test extends PHPUnit_Framework_TestCase
{
/**
* @access protected
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
* @return void
*/
protected function setUp()
{
$_POST['pdf_page_number'] = 33;
$_POST['show_grid'] = true;
$_POST['show_color'] = 'on';
$_POST['show_keys'] = true;
$_POST['orientation'] = 'orientation';
$_POST['paper'] = 'paper';
$_POST['export_type'] = 'PMA_ExportType';
$GLOBALS['server'] = 1;
$GLOBALS['cfg']['ServerDefault'] = 1;
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$GLOBALS['dbi'] = $dbi;
$dbi->expects($this->any())
->method('numRows')
->will($this->returnValue(1));
$dbi->expects($this->any())
->method('query')
->will($this->returnValue("executed_1"));
$dbi->expects($this->any())
->method('tryQuery')
->will($this->returnValue("executed_1"));
$fetchArrayReturn = array(
'table_name' => 'table_name'
);
$dbi->expects($this->at(1))
->method('fetchAssoc')
->will($this->returnValue($fetchArrayReturn));
$this->object = new PMA_Dia_Relation_Schema();
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*
* @access protected
* @return void
*/
protected function tearDown()
{
unset($this->object);
}
/**
* Test for construct, the Property is set correctly
*
* @return void
*
* @group medium
*/
public function testSetProperty()
{
$this->assertEquals(
33,
$this->object->pageNumber
);
$this->assertEquals(
1,
$this->object->showGrid
);
$this->assertEquals(
1,
$this->object->showColor
);
$this->assertEquals(
1,
$this->object->showKeys
);
$this->assertEquals(
'P',
$this->object->orientation
);
$this->assertEquals(
'paper',
$this->object->paper
);
$this->assertEquals(
'PMA_ExportType',
$this->object->exportType
);
}
}

View File

@ -0,0 +1,144 @@
<?php
/**
* Tests for PMA_Eps_Relation_Schema class
*
* @package PhpMyAdmin-test
*/
/*
* Include to test.
*/
require_once 'libraries/Util.class.php';
require_once 'libraries/relation.lib.php';
require_once 'libraries/url_generating.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/database_interface.inc.php';
require_once 'libraries/schema/Eps_Relation_Schema.class.php';
/**
* Tests for PMA_Eps_Relation_Schema class
*
* @package PhpMyAdmin-test
*/
class PMA_Eps_Relation_Schema_Test extends PHPUnit_Framework_TestCase
{
/**
* @access protected
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
* @return void
*/
protected function setUp()
{
$_POST['pdf_page_number'] = 33;
$_POST['show_grid'] = true;
$_POST['show_color'] = 'on';
$_POST['show_keys'] = true;
$_POST['orientation'] = 'orientation';
$_POST['show_table_dimension'] = 'on';
$_POST['all_tables_same_width'] = 'on';
$_POST['paper'] = 'paper';
$_POST['export_type'] = 'PMA_ExportType';
$GLOBALS['server'] = 1;
$GLOBALS['cfg']['ServerDefault'] = 1;
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$GLOBALS['dbi'] = $dbi;
$dbi->expects($this->any())
->method('numRows')
->will($this->returnValue(1));
$dbi->expects($this->any())
->method('query')
->will($this->returnValue("executed_1"));
$dbi->expects($this->any())
->method('tryQuery')
->will($this->returnValue("executed_1"));
$fetchArrayReturn = array(
'table_name' => 'table_name'
);
$dbi->expects($this->at(1))
->method('fetchAssoc')
->will($this->returnValue($fetchArrayReturn));
$this->object = new PMA_Eps_Relation_Schema();
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*
* @access protected
* @return void
*/
protected function tearDown()
{
unset($this->object);
}
/**
* Test for construct
*
* @return void
*
* @group medium
*/
public function testConstructor()
{
$this->assertEquals(
33,
$this->object->pageNumber
);
$this->assertEquals(
1,
$this->object->showColor
);
$this->assertEquals(
1,
$this->object->showKeys
);
$this->assertEquals(
1,
$this->object->tableDimension
);
$this->assertEquals(
1,
$this->object->sameWide
);
$this->assertEquals(
'L',
$this->object->orientation
);
$this->assertEquals(
'PMA_ExportType',
$this->object->exportType
);
}
/**
* Test for setPageNumber
*
* @return void
*
* @group medium
*/
public function testSetPageNumbere()
{
$this->object->setPageNumber(33);
$this->assertEquals(
33,
$this->object->pageNumber
);
}
}

View File

@ -8,6 +8,11 @@
/*
* Include to test.
*/
require_once 'libraries/Util.class.php';
require_once 'libraries/relation.lib.php';
require_once 'libraries/url_generating.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/database_interface.inc.php';
require_once 'libraries/schema/Export_Relation_Schema.class.php';
/**

View File

@ -0,0 +1,141 @@
<?php
/**
* Tests for PMA_Pdf_Relation_Schema class
*
* @package PhpMyAdmin-test
*/
/*
* Include to test.
*/
require_once 'libraries/Util.class.php';
require_once 'libraries/relation.lib.php';
require_once 'libraries/url_generating.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/database_interface.inc.php';
require_once 'libraries/schema/Pdf_Relation_Schema.class.php';
/**
* Tests for PMA_Pdf_Relation_Schema class
*
* @package PhpMyAdmin-test
*/
class PMA_Pdf_Relation_Schema_Test extends PHPUnit_Framework_TestCase
{
/**
* @access protected
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
* @return void
*/
protected function setUp()
{
$_POST['pdf_page_number'] = 33;
$_POST['show_grid'] = true;
$_POST['show_color'] = 'on';
$_POST['show_keys'] = true;
$_POST['orientation'] = 'orientation';
$_POST['show_table_dimension'] = 'on';
$_POST['all_tables_same_width'] = 'on';
$_POST['paper'] = 'paper';
$_POST['export_type'] = 'PMA_ExportType';
$_POST['with_doc'] = 'on';
$GLOBALS['server'] = 1;
$GLOBALS['cfg']['ServerDefault'] = 1;
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$GLOBALS['dbi'] = $dbi;
$dbi->expects($this->any())
->method('numRows')
->will($this->returnValue(1));
$dbi->expects($this->any())
->method('query')
->will($this->returnValue("executed_1"));
$dbi->expects($this->any())
->method('tryQuery')
->will($this->returnValue("executed_1"));
$fetchArrayReturn = array(
'table_name' => 'table_name'
);
$dbi->expects($this->at(1))
->method('fetchAssoc')
->will($this->returnValue($fetchArrayReturn));
$this->object = new PMA_Pdf_Relation_Schema();
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*
* @access protected
* @return void
*/
protected function tearDown()
{
unset($this->object);
}
/**
* Test for construct
*
* @return void
*
* @group medium
*/
public function testConstructor()
{
$this->assertEquals(
33,
$this->object->pageNumber
);
$this->assertEquals(
1,
$this->object->showGrid
);
$this->assertEquals(
1,
$this->object->showColor
);
$this->assertEquals(
1,
$this->object->showKeys
);
$this->assertEquals(
1,
$this->object->tableDimension
);
$this->assertEquals(
1,
$this->object->sameWide
);
$this->assertEquals(
1,
$this->object->withDoc
);
$this->assertEquals(
'L',
$this->object->orientation
);
$this->assertEquals(
'PMA_ExportType',
$this->object->exportType
);
$this->assertEquals(
'paper',
$this->object->paper
);
}
}

View File

@ -0,0 +1,125 @@
<?php
/**
* Tests for PMA_Svg_Relation_Schema class
*
* @package PhpMyAdmin-test
*/
/*
* Include to test.
*/
require_once 'libraries/Util.class.php';
require_once 'libraries/relation.lib.php';
require_once 'libraries/url_generating.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/database_interface.inc.php';
require_once 'libraries/schema/Svg_Relation_Schema.class.php';
/**
* Tests for PMA_Svg_Relation_Schema class
*
* @package PhpMyAdmin-test
*/
class PMA_Svg_Relation_Schema_Test extends PHPUnit_Framework_TestCase
{
/**
* @access protected
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
* @return void
*/
protected function setUp()
{
$_POST['pdf_page_number'] = 33;
$_POST['show_grid'] = true;
$_POST['show_color'] = 'on';
$_POST['show_keys'] = true;
$_POST['orientation'] = 'orientation';
$_POST['show_table_dimension'] = 'on';
$_POST['all_tables_same_width'] = 'on';
$_POST['paper'] = 'paper';
$_POST['export_type'] = 'PMA_ExportType';
$_POST['with_doc'] = 'on';
$GLOBALS['server'] = 1;
$GLOBALS['cfg']['ServerDefault'] = 1;
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$GLOBALS['dbi'] = $dbi;
$dbi->expects($this->any())
->method('numRows')
->will($this->returnValue(1));
$dbi->expects($this->any())
->method('query')
->will($this->returnValue("executed_1"));
$dbi->expects($this->any())
->method('tryQuery')
->will($this->returnValue("executed_1"));
$fetchArrayReturn = array(
'table_name' => 'table_name'
);
$dbi->expects($this->at(1))
->method('fetchAssoc')
->will($this->returnValue($fetchArrayReturn));
$this->object = new PMA_Svg_Relation_Schema();
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*
* @access protected
* @return void
*/
protected function tearDown()
{
unset($this->object);
}
/**
* Test for construct
*
* @return void
*
* @group medium
*/
public function testConstructor()
{
$this->assertEquals(
33,
$this->object->pageNumber
);
$this->assertEquals(
1,
$this->object->showColor
);
$this->assertEquals(
1,
$this->object->showKeys
);
$this->assertEquals(
1,
$this->object->tableDimension
);
$this->assertEquals(
1,
$this->object->sameWide
);
$this->assertEquals(
'PMA_ExportType',
$this->object->exportType
);
}
}

View File

@ -17,7 +17,7 @@ require_once 'libraries/ip_allow_deny.lib.php';
class PMA_Ip_allow_deny_Test extends PHPUnit_Framework_TestCase
{
public function setUp()
public function setUp()
{
$GLOBALS['cfg']['Server']['user'] = "pma_username";
$GLOBALS['cfg']['Server']['AllowDeny']['rules'][] = "allow % 255.255.255.0/4";
@ -37,18 +37,18 @@ class PMA_Ip_allow_deny_Test extends PHPUnit_Framework_TestCase
*/
public function testPMA_getIp()
{
//$_SERVER['REMOTE_ADDR'] is empty
//$_SERVER['REMOTE_ADDR'] is empty
$this->assertEquals(
false,
PMA_getIp()
);
$_SERVER['REMOTE_ADDR'] = "101.0.0.25";
$this->assertEquals(
"101.0.0.25",
PMA_getIp()
);
);
}
/**
@ -57,7 +57,7 @@ class PMA_Ip_allow_deny_Test extends PHPUnit_Framework_TestCase
* @return void
*/
public function testPMA_ipMaskTest()
{
{
//IPV4 testing
$testRange = "255.255.0.0/8";
$ipToTest = "10.0.0.0";
@ -65,14 +65,14 @@ class PMA_Ip_allow_deny_Test extends PHPUnit_Framework_TestCase
false,
PMA_ipMaskTest($testRange, $ipToTest)
);
$testRange = "255.255.0.0/4";
$ipToTest = "255.3.0.0";
$this->assertEquals(
true,
PMA_ipMaskTest($testRange, $ipToTest)
);
$testRange = "255.255.0.[0-10]";
$ipToTest = "255.3.0.3";
$this->assertEquals(
@ -84,7 +84,7 @@ class PMA_Ip_allow_deny_Test extends PHPUnit_Framework_TestCase
false,
PMA_ipMaskTest($testRange, $ipToTest)
);
//IPV6 testing
//not range
$ipToTest = "2001:4998:c:a0d:0000:0000:4998:1020";
@ -99,7 +99,7 @@ class PMA_Ip_allow_deny_Test extends PHPUnit_Framework_TestCase
false,
PMA_ipMaskTest($testRange, $ipToTest)
);
//range
$ipToTest = "2001:4998:c:a0d:0000:0000:4998:1020";
$testRange = "2001:4998:c:a0d:0000:0000:4998:[1001-2010]";
@ -113,7 +113,7 @@ class PMA_Ip_allow_deny_Test extends PHPUnit_Framework_TestCase
false,
PMA_ipMaskTest($testRange, $ipToTest)
);
//CDIR
$ipToTest = "2001:4998:c:a0d:0000:0000:4998:1020";
$testRange = "2001:4998:c:a0d:0000:0000:4998:[1001-2010]";
@ -141,7 +141,7 @@ class PMA_Ip_allow_deny_Test extends PHPUnit_Framework_TestCase
false,
PMA_allowDeny("allow")
);
$_SERVER['REMOTE_ADDR'] = "255.0.1.0";
$this->assertEquals(
true,
@ -152,7 +152,7 @@ class PMA_Ip_allow_deny_Test extends PHPUnit_Framework_TestCase
false,
PMA_allowDeny("allow")
);
$_SERVER['REMOTE_ADDR'] = "255.255.0.1";
$this->assertEquals(
true,
@ -168,7 +168,7 @@ class PMA_Ip_allow_deny_Test extends PHPUnit_Framework_TestCase
false,
PMA_allowDeny("deny")
);
//IPV6
$_SERVER['REMOTE_ADDR'] = "2001:4998:c:a0d:0000:0000:4998:1020";
$this->assertEquals(
@ -184,7 +184,7 @@ class PMA_Ip_allow_deny_Test extends PHPUnit_Framework_TestCase
$this->assertEquals(
true,
PMA_allowDeny("allow")
);
);
}
}