Move libraries/plugins/auth and export classes into a namespace.

Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>
This commit is contained in:
Hugues Peccatte 2015-09-05 00:09:30 +02:00
parent 588488b017
commit 04b4f723d8
47 changed files with 1768 additions and 1414 deletions

View File

@ -11,6 +11,7 @@
*
* @package PhpMyAdmin
*/
use PMA\libraries\plugins\export\ExportSql;
use PMA\libraries\String;
/**

View File

@ -7,7 +7,7 @@
*/
namespace PMA\libraries;
use ExportSql;
use PMA\libraries\plugins\export\ExportSql;
use SqlParser\Components\Expression;
use SqlParser\Components\OptionsArray;
use SqlParser\Context;
@ -785,7 +785,7 @@ class Table
/**
* Instance used for exporting the current structure of the table.
*
* @var ExportSql
* @var \PMA\libraries\plugins\export\ExportSql
*/
$export_sql_plugin = PMA_getPlugin(
"export",

View File

@ -7,7 +7,7 @@
*/
namespace PMA\libraries;
use ExportSql;
use PMA\libraries\plugins\export\ExportSql;
/**
* This class tracks changes on databases, tables and views.
@ -187,7 +187,7 @@ class Tracker
// get Export SQL instance
include_once "libraries/plugin_interface.lib.php";
/* @var $export_sql_plugin ExportSql */
/* @var $export_sql_plugin \PMA\libraries\plugins\export\ExportSql */
$export_sql_plugin = PMA_getPlugin(
"export",
"sql",

View File

@ -365,7 +365,7 @@ function PMA_analyseShowGrant()
$GLOBALS['dbi']->freeResult($rs_usr);
// must also cacheUnset() them in
// libraries/plugins/auth/AuthenticationCookie.class.php
// libraries/plugins/auth/AuthenticationCookie.php
PMA\libraries\Util::cacheSet('is_create_db_priv', $GLOBALS['is_create_db_priv']);
PMA\libraries\Util::cacheSet('is_reload_priv', $GLOBALS['is_reload_priv']);
PMA\libraries\Util::cacheSet('db_to_create', $GLOBALS['db_to_create']);

View File

@ -9,6 +9,7 @@
use PMA\libraries\Message;
use PMA\libraries\Partition;
use PMA\libraries\plugins\export\ExportSql;
use PMA\libraries\Response;
use PMA\libraries\StorageEngine;
use PMA\libraries\Table;

View File

@ -6,12 +6,10 @@
* @package PhpMyAdmin-Authentication
* @subpackage Config
*/
if (! defined('PHPMYADMIN')) {
exit;
}
namespace PMA\libraries\plugins\auth;
/* Get the authentication interface */
require_once 'libraries/plugins/AuthenticationPlugin.class.php';
use AuthenticationPlugin;
use PMA;
/**
* Handles the config authentication method
@ -38,6 +36,7 @@ class AuthenticationConfig extends AuthenticationPlugin
exit;
}
}
return true;
}
@ -51,6 +50,7 @@ class AuthenticationConfig extends AuthenticationPlugin
if ($GLOBALS['token_provided'] && $GLOBALS['token_mismatch']) {
return false;
}
return true;
}
@ -64,7 +64,7 @@ class AuthenticationConfig extends AuthenticationPlugin
// try to workaround PHP 5 session garbage collection which
// looks at the session file's last modified time
if (isset($_REQUEST['access_time'])) {
$_SESSION['last_access_time'] = time()- $_REQUEST['access_time'];
$_SESSION['last_access_time'] = time() - $_REQUEST['access_time'];
} else {
$_SESSION['last_access_time'] = time();
}
@ -91,13 +91,14 @@ class AuthenticationConfig extends AuthenticationPlugin
public function authFails()
{
$conn_error = $GLOBALS['dbi']->getError();
if (! $conn_error) {
if (!$conn_error) {
$conn_error = __('Cannot connect: invalid settings.');
}
/* HTML header */
$response = PMA\libraries\Response::getInstance();
$response->getFooter()->setMinimal();
$response->getFooter()
->setMinimal();
$header = $response->getHeader();
$header->setBodyId('loginform');
$header->setTitle(__('Access denied!'));
@ -120,15 +121,15 @@ class AuthenticationConfig extends AuthenticationPlugin
// Check whether user has configured something
if ($GLOBALS['PMA_Config']->source_mtime == 0) {
echo '<p>' . sprintf(
__(
'You probably did not create a configuration file.'
. ' You might want to use the %1$ssetup script%2$s to'
. ' create one.'
),
'<a href="setup/">',
'</a>'
) . '</p>' . "\n";
} elseif (! isset($GLOBALS['errno'])
__(
'You probably did not create a configuration file.'
. ' You might want to use the %1$ssetup script%2$s to'
. ' create one.'
),
'<a href="setup/">',
'</a>'
) . '</p>' . "\n";
} elseif (!isset($GLOBALS['errno'])
|| (isset($GLOBALS['errno']) && $GLOBALS['errno'] != 2002)
&& $GLOBALS['errno'] != 2003
) {
@ -146,11 +147,16 @@ class AuthenticationConfig extends AuthenticationPlugin
. ' host, username and password in your configuration and'
. ' make sure that they correspond to the information given'
. ' by the administrator of the MySQL server.'
), E_USER_WARNING
),
E_USER_WARNING
);
}
echo PMA\libraries\Util::mysqlDie(
$conn_error, '', true, '', false
$conn_error,
'',
true,
'',
false
);
}
$GLOBALS['error_handler']->dispUserErrors();
@ -160,7 +166,8 @@ class AuthenticationConfig extends AuthenticationPlugin
<td>' . "\n";
echo '<a href="'
. PMA\libraries\Util::getScriptNameForOption(
$GLOBALS['cfg']['DefaultTabServer'], 'server'
$GLOBALS['cfg']['DefaultTabServer'],
'server'
)
. PMA_URL_getCommon(array()) . '" class="button disableAjax">'
. __('Retry to connect')
@ -180,6 +187,7 @@ class AuthenticationConfig extends AuthenticationPlugin
if (!defined('TESTSUITE')) {
exit;
}
return true;
}
}

View File

@ -6,15 +6,12 @@
* @package PhpMyAdmin-Authentication
* @subpackage Cookie
*/
if (! defined('PHPMYADMIN')) {
exit;
}
namespace PMA\libraries\plugins\auth;
use phpseclib\Crypt;
use PMA\libraries\Message;
/* Get the authentication interface */
require_once 'libraries/plugins/AuthenticationPlugin.class.php';
use PMA\libraries\Response;
use PMA\libraries\Util;
/**
* Remember where to redirect the user
@ -70,7 +67,7 @@ class AuthenticationCookie extends AuthenticationPlugin
{
global $conn_error;
$response = PMA\libraries\Response::getInstance();
$response = Response::getInstance();
if ($response->isAjax()) {
$response->isSuccess(false);
// redirect_flag redirects to the login page
@ -173,7 +170,7 @@ class AuthenticationCookie extends AuthenticationPlugin
<fieldset>
<legend>';
echo __('Log in');
echo PMA\libraries\Util::showDocu('index');
echo Util::showDocu('index');
echo '</legend>';
if ($GLOBALS['cfg']['AllowArbitraryServer']) {
echo '
@ -467,11 +464,11 @@ class AuthenticationCookie extends AuthenticationPlugin
$last_access_time = time() - $GLOBALS['cfg']['LoginCookieValidity'];
if ($_SESSION['last_access_time'] < $last_access_time
) {
PMA\libraries\Util::cacheUnset('is_create_db_priv');
PMA\libraries\Util::cacheUnset('is_reload_priv');
PMA\libraries\Util::cacheUnset('db_to_create');
PMA\libraries\Util::cacheUnset('dbs_where_create_table_allowed');
PMA\libraries\Util::cacheUnset('dbs_to_test');
Util::cacheUnset('is_create_db_priv');
Util::cacheUnset('is_reload_priv');
Util::cacheUnset('db_to_create');
Util::cacheUnset('dbs_where_create_table_allowed');
Util::cacheUnset('dbs_to_test');
$GLOBALS['no_activity'] = true;
$this->authFails();
if (! defined('TESTSUITE')) {
@ -617,9 +614,10 @@ class AuthenticationCookie extends AuthenticationPlugin
/**
* Clear user cache.
*/
PMA\libraries\Util::clearUserCache();
Util::clearUserCache();
PMA\libraries\Response::getInstance()->disable();
Response::getInstance()
->disable();
PMA_sendHeaderLocation(
$redirect_url . PMA_URL_getCommon($url_params, 'text'),

View File

@ -7,15 +7,11 @@
* @package PhpMyAdmin-Authentication
* @subpackage HTTP
*/
namespace PMA\libraries\plugins\auth;
use AuthenticationPlugin;
use PMA;
use PMA\libraries\Message;
use PMA\libraries\Response;
if (! defined('PHPMYADMIN')) {
exit;
}
/* Get the authentication interface */
require_once 'libraries/plugins/AuthenticationPlugin.class.php';
/**
* Handles the HTTP authentication methods
@ -58,11 +54,11 @@ class AuthenticationHttp extends AuthenticationPlugin
public function authForm()
{
/* Perform logout to custom URL */
if (! empty($_REQUEST['old_usr'])
&& ! empty($GLOBALS['cfg']['Server']['LogoutURL'])
if (!empty($_REQUEST['old_usr'])
&& !empty($GLOBALS['cfg']['Server']['LogoutURL'])
) {
PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['LogoutURL']);
if (! defined('TESTSUITE')) {
if (!defined('TESTSUITE')) {
exit;
} else {
return false;
@ -81,7 +77,7 @@ class AuthenticationHttp extends AuthenticationPlugin
}
// remove non US-ASCII to respect RFC2616
$realm_message = preg_replace('/[^\x20-\x7e]/i', '', $realm_message);
header('WWW-Authenticate: Basic realm="' . $realm_message . '"');
header('WWW-Authenticate: Basic realm="' . $realm_message . '"');
header('HTTP/1.0 401 Unauthorized');
if (php_sapi_name() !== 'cgi-fcgi') {
header('status: 401 Unauthorized');
@ -89,7 +85,8 @@ class AuthenticationHttp extends AuthenticationPlugin
/* HTML header */
$response = PMA\libraries\Response::getInstance();
$response->getFooter()->setMinimal();
$response->getFooter()
->setMinimal();
$header = $response->getHeader();
$header->setTitle(__('Access denied!'));
$header->disableMenuAndConsole();
@ -110,7 +107,7 @@ class AuthenticationHttp extends AuthenticationPlugin
include CUSTOM_FOOTER_FILE;
}
if (! defined('TESTSUITE')) {
if (!defined('TESTSUITE')) {
exit;
} else {
return false;
@ -120,19 +117,21 @@ class AuthenticationHttp extends AuthenticationPlugin
/**
* Gets advanced authentication settings
*
* @global string $PHP_AUTH_USER the username if register_globals is on
* @global string $PHP_AUTH_PW the password if register_globals is on
* @global array the array of server variables if
* register_globals is off
* @global array the array of environment variables if
* register_globals is off
* @global string the username for the ? server
* @global string the password for the ? server
* @global string the username for the WebSite Professional
* server
* @global string the password for the WebSite Professional
* server
* @global string the username of the user who logs out
* @global string $PHP_AUTH_USER the username if register_globals is
* on
* @global string $PHP_AUTH_PW the password if register_globals is
* on
* @global array the array of server variables if
* register_globals is off
* @global array the array of environment variables if
* register_globals is off
* @global string the username for the ? server
* @global string the password for the ? server
* @global string the username for the WebSite
* Professional server
* @global string the password for the WebSite
* Professional server
* @global string the username of the user who logs out
*
* @return boolean whether we get authentication settings or not
*/
@ -186,7 +185,7 @@ class AuthenticationHttp extends AuthenticationPlugin
// (do not use explode() because a user might have a colon in his password
if (strcmp(substr($PHP_AUTH_USER, 0, 6), 'Basic ') == 0) {
$usr_pass = base64_decode(substr($PHP_AUTH_USER, 6));
if (! empty($usr_pass)) {
if (!empty($usr_pass)) {
$colon = strpos($usr_pass, ':');
if ($colon) {
$PHP_AUTH_USER = substr($usr_pass, 0, $colon);
@ -199,12 +198,12 @@ class AuthenticationHttp extends AuthenticationPlugin
// User logged out -> ensure the new username is not the same
$old_usr = isset($_REQUEST['old_usr']) ? $_REQUEST['old_usr'] : '';
if (! empty($old_usr)
if (!empty($old_usr)
&& (isset($PHP_AUTH_USER) && $old_usr == $PHP_AUTH_USER)
) {
$PHP_AUTH_USER = '';
// -> delete user's choices that were stored in session
if (! defined('TESTSUITE')) {
if (!defined('TESTSUITE')) {
session_destroy();
}
}
@ -220,11 +219,11 @@ class AuthenticationHttp extends AuthenticationPlugin
/**
* Set the user and password after last checkings if required
*
* @global array $cfg the valid servers settings
* @global integer $server the id of the current server
* @global array the current server settings
* @global string $PHP_AUTH_USER the current username
* @global string $PHP_AUTH_PW the current password
* @global array $cfg the valid servers settings
* @global integer $server the id of the current server
* @global array the current server settings
* @global string $PHP_AUTH_USER the current username
* @global string $PHP_AUTH_PW the current password
*
* @return boolean always true
*/
@ -240,16 +239,16 @@ class AuthenticationHttp extends AuthenticationPlugin
for ($i = 1; $i <= $servers_cnt; $i++) {
if (isset($cfg['Servers'][$i])
&& ($cfg['Servers'][$i]['host'] == $cfg['Server']['host']
&& $cfg['Servers'][$i]['user'] == $PHP_AUTH_USER)
&& $cfg['Servers'][$i]['user'] == $PHP_AUTH_USER)
) {
$server = $i;
$server = $i;
$cfg['Server'] = $cfg['Servers'][$i];
break;
}
} // end for
} // end if
$cfg['Server']['user'] = $PHP_AUTH_USER;
$cfg['Server']['user'] = $PHP_AUTH_USER;
$cfg['Server']['password'] = $PHP_AUTH_PW;
// Avoid showing the password in phpinfo()'s output
@ -273,10 +272,12 @@ class AuthenticationHttp extends AuthenticationPlugin
$error = $GLOBALS['dbi']->getError();
if ($error && $GLOBALS['errno'] != 1045) {
PMA_fatalError($error);
return true;
}
$this->authForm();
return true;
}

View File

@ -6,12 +6,10 @@
* @package PhpMyAdmin-Authentication
* @subpackage SignOn
*/
if (! defined('PHPMYADMIN')) {
exit;
}
namespace PMA\libraries\plugins\auth;
/* Get the authentication interface */
require_once 'libraries/plugins/AuthenticationPlugin.class.php';
use AuthenticationPlugin;
use PMA;
/**
* Handles the SignOn authentication method
@ -34,8 +32,8 @@ class AuthenticationSignon extends AuthenticationPlugin
unset($_SESSION['LAST_SIGNON_URL']);
if (empty($GLOBALS['cfg']['Server']['SignonURL'])) {
PMA_fatalError('You must set SignonURL!');
} elseif (! empty($_REQUEST['old_usr'])
&& ! empty($GLOBALS['cfg']['Server']['LogoutURL'])
} elseif (!empty($_REQUEST['old_usr'])
&& !empty($GLOBALS['cfg']['Server']['LogoutURL'])
) {
/* Perform logout to custom URL */
PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['LogoutURL']);
@ -43,7 +41,7 @@ class AuthenticationSignon extends AuthenticationPlugin
PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['SignonURL']);
}
if (! defined('TESTSUITE')) {
if (!defined('TESTSUITE')) {
exit();
} else {
return false;
@ -53,19 +51,19 @@ class AuthenticationSignon extends AuthenticationPlugin
/**
* Gets advanced authentication settings
*
* @global string $PHP_AUTH_USER the username if register_globals is on
* @global string $PHP_AUTH_PW the password if register_globals is on
* @global array the array of server variables if
* register_globals is off
* @global array the array of environment variables if
* register_globals is off
* @global string the username for the ? server
* @global string the password for the ? server
* @global string the username for the WebSite Professional
* server
* @global string the password for the WebSite Professional
* server
* @global string the username of the user who logs out
* @global string $PHP_AUTH_USER the username if register_globals is on
* @global string $PHP_AUTH_PW the password if register_globals is on
* @global array the array of server variables if
* register_globals is off
* @global array the array of environment variables if
* register_globals is off
* @global string the username for the ? server
* @global string the password for the ? server
* @global string the username for the WebSite
* Professional server
* @global string the password for the WebSite
* Professional server
* @global string the username of the user who logs out
*
* @return boolean whether we get authentication settings or not
*/
@ -104,7 +102,7 @@ class AuthenticationSignon extends AuthenticationPlugin
/* Handle script based auth */
if (!empty($script_name)) {
if (! file_exists($script_name)) {
if (!file_exists($script_name)) {
PMA_fatalError(
__('Can not find signon authentication script:')
. ' ' . $script_name
@ -114,19 +112,18 @@ class AuthenticationSignon extends AuthenticationPlugin
list ($PHP_AUTH_USER, $PHP_AUTH_PW)
= get_login_credentials($GLOBALS['cfg']['Server']['user']);
} elseif (isset($_COOKIE[$session_name])) { /* Does session exist? */
/* End current session */
$old_session = session_name();
$old_id = session_id();
if (! defined('TESTSUITE')) {
if (!defined('TESTSUITE')) {
session_write_close();
}
/* Load single signon session */
session_name($session_name);
session_id($_COOKIE[$session_name]);
if (! defined('TESTSUITE')) {
if (!defined('TESTSUITE')) {
session_start();
}
@ -167,7 +164,7 @@ class AuthenticationSignon extends AuthenticationPlugin
}
/* End single signon session */
if (! defined('TESTSUITE')) {
if (!defined('TESTSUITE')) {
session_write_close();
}
@ -176,7 +173,7 @@ class AuthenticationSignon extends AuthenticationPlugin
if (!empty($old_id)) {
session_id($old_id);
}
if (! defined('TESTSUITE')) {
if (!defined('TESTSUITE')) {
session_start();
}
@ -206,9 +203,11 @@ class AuthenticationSignon extends AuthenticationPlugin
// Returns whether we get authentication settings or not
if (empty($PHP_AUTH_USER)) {
unset($_SESSION['LAST_SIGNON_URL']);
return false;
} else {
$_SESSION['LAST_SIGNON_URL'] = $GLOBALS['cfg']['Server']['SignonURL'];
return true;
}
}
@ -216,11 +215,11 @@ class AuthenticationSignon extends AuthenticationPlugin
/**
* Set the user and password after last checkings if required
*
* @global array $cfg the valid servers settings
* @global integer the id of the current server
* @global array the current server settings
* @global string $PHP_AUTH_USER the current username
* @global string $PHP_AUTH_PW the current password
* @global array $cfg the valid servers settings
* @global integer the id of the current server
* @global array the current server settings
* @global string $PHP_AUTH_USER the current username
* @global string $PHP_AUTH_PW the current password
*
* @return boolean always true
*/
@ -229,7 +228,7 @@ class AuthenticationSignon extends AuthenticationPlugin
global $cfg;
global $PHP_AUTH_USER, $PHP_AUTH_PW;
$cfg['Server']['user'] = $PHP_AUTH_USER;
$cfg['Server']['user'] = $PHP_AUTH_USER;
$cfg['Server']['password'] = $PHP_AUTH_PW;
return true;
@ -248,14 +247,14 @@ class AuthenticationSignon extends AuthenticationPlugin
/* Does session exist? */
if (isset($_COOKIE[$session_name])) {
/* End current session */
if (! defined('TESTSUITE')) {
if (!defined('TESTSUITE')) {
session_write_close();
}
/* Load single signon session */
session_name($session_name);
session_id($_COOKIE[$session_name]);
if (! defined('TESTSUITE')) {
if (!defined('TESTSUITE')) {
session_start();
}

View File

@ -6,14 +6,16 @@
* @package PhpMyAdmin-Export
* @subpackage CodeGen
*/
if (! defined('PHPMYADMIN')) {
exit;
}
namespace PMA\libraries\plugins\export;
/* Get the export interface */
require_once 'libraries/plugins/ExportPlugin.class.php';
/* Get the table property class */
require_once 'libraries/plugins/export/TableProperty.class.php';
use ExportPlugin;
use ExportPluginProperties;
use HiddenPropertyItem;
use OptionsPropertyMainGroup;
use OptionsPropertyRootGroup;
use PMA;
use SelectPropertyItem;
use PMA\libraries\plugins\export\TableProperty;
/**
* Handles the export for the CodeGen class
@ -29,7 +31,6 @@ class ExportCodegen extends ExportPlugin
* @var array
*/
private $_cgFormats;
/**
* CodeGen Handlers
*
@ -57,14 +58,14 @@ class ExportCodegen extends ExportPlugin
$this->_setCgFormats(
array(
"NHibernate C# DO",
"NHibernate XML"
"NHibernate XML",
)
);
$this->_setCgHandlers(
array(
"_handleNHibernateCSBody",
"_handleNHibernateXMLBody"
"_handleNHibernateXMLBody",
)
);
}
@ -187,7 +188,12 @@ class ExportCodegen extends ExportPlugin
* @return bool Whether it succeeded
*/
public function exportData(
$db, $table, $crlf, $error_url, $sql_query, $aliases = array()
$db,
$table,
$crlf,
$error_url,
$sql_query,
$aliases = array()
) {
$CG_FORMATS = $this->_getCgFormats();
$CG_HANDLERS = $this->_getCgHandlers();
@ -195,10 +201,12 @@ class ExportCodegen extends ExportPlugin
$format = $GLOBALS['codegen_format'];
if (isset($CG_FORMATS[$format])) {
$method = $CG_HANDLERS[$format];
return PMA_exportOutputHandler(
$this->$method($db, $table, $crlf, $aliases)
);
}
return PMA_exportOutputHandler(sprintf("%s is not supported.", $format));
}
@ -215,12 +223,13 @@ class ExportCodegen extends ExportPlugin
// remove unsafe characters
$str = preg_replace('/[^\p{L}\p{Nl}_]/u', '', $str);
// make sure first character is a letter or _
if (! preg_match('/^\pL/u', $str)) {
if (!preg_match('/^\pL/u', $str)) {
$str = '_' . $str;
}
if ($ucfirst) {
$str = ucfirst($str);
}
return $str;
}
@ -243,7 +252,8 @@ class ExportCodegen extends ExportPlugin
$result = $GLOBALS['dbi']->query(
sprintf(
'DESC %s.%s', PMA\libraries\Util::backquote($db),
'DESC %s.%s',
PMA\libraries\Util::backquote($db),
PMA\libraries\Util::backquote($table)
)
);
@ -281,7 +291,7 @@ class ExportCodegen extends ExportPlugin
. ExportCodegen::cgMakeIdentifier($table_alias) . '() { }';
$temp = array();
foreach ($tableProperties as $tableProperty) {
if (! $tableProperty->isPK()) {
if (!$tableProperty->isPK()) {
$temp[] = $tableProperty->formatCs(
'#dotNetPrimitiveType# #name#'
);
@ -294,7 +304,7 @@ class ExportCodegen extends ExportPlugin
. ')';
$lines[] = ' {';
foreach ($tableProperties as $tableProperty) {
if (! $tableProperty->isPK()) {
if (!$tableProperty->isPK()) {
$lines[] = $tableProperty->formatCs(
' this._#name#=#name#;'
);
@ -318,6 +328,7 @@ class ExportCodegen extends ExportPlugin
$lines[] = ' #endregion';
$lines[] = '}';
}
return implode($crlf, $lines);
}
@ -332,7 +343,10 @@ class ExportCodegen extends ExportPlugin
* @return string containing XML code lines, separated by "\n"
*/
private function _handleNHibernateXMLBody(
$db, $table, $crlf, $aliases = array()
$db,
$table,
$crlf,
$aliases = array()
) {
$db_alias = $db;
$table_alias = $table;
@ -347,7 +361,8 @@ class ExportCodegen extends ExportPlugin
. 'table="' . ExportCodegen::cgMakeIdentifier($table_alias) . '">';
$result = $GLOBALS['dbi']->query(
sprintf(
"DESC %s.%s", PMA\libraries\Util::backquote($db),
"DESC %s.%s",
PMA\libraries\Util::backquote($db),
PMA\libraries\Util::backquote($table)
)
);
@ -382,13 +397,13 @@ class ExportCodegen extends ExportPlugin
}
$lines[] = ' </class>';
$lines[] = '</hibernate-mapping>';
return implode($crlf, $lines);
}
/* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
/**
* Getter for CodeGen formats
*

View File

@ -6,12 +6,17 @@
* @package PhpMyAdmin-Export
* @subpackage CSV
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/* Get the export interface */
require_once 'libraries/plugins/ExportPlugin.class.php';
namespace PMA\libraries\plugins\export;
use BoolPropertyItem;
use ExportPlugin;
use ExportPluginProperties;
use HiddenPropertyItem;
use OptionsPropertyMainGroup;
use OptionsPropertyRootGroup;
use PMA;
use TextPropertyItem;
/**
* Handles the export for the CSV format
@ -113,7 +118,7 @@ class ExportCsv extends ExportPlugin
// Here we just prepare some values for export
if ($what == 'excel') {
$csv_terminated = "\015\012";
switch($GLOBALS['excel_edition']) {
switch ($GLOBALS['excel_edition']) {
case 'win':
// as tested on Windows with Excel 2002 and Excel 2007
$csv_separator = ';';
@ -126,13 +131,14 @@ class ExportCsv extends ExportPlugin
break;
}
$csv_enclosed = '"';
$csv_escaped = '"';
$csv_escaped = '"';
if (isset($GLOBALS['excel_columns'])) {
$GLOBALS['csv_columns'] = 'yes';
}
} else {
if (empty($csv_terminated)
|| /*overload*/mb_strtolower($csv_terminated) == 'auto'
|| /*overload*/
mb_strtolower($csv_terminated) == 'auto'
) {
$csv_terminated = $GLOBALS['crlf'];
} else {
@ -208,7 +214,12 @@ class ExportCsv extends ExportPlugin
* @return bool Whether it succeeded
*/
public function exportData(
$db, $table, $crlf, $error_url, $sql_query, $aliases = array()
$db,
$table,
$crlf,
$error_url,
$sql_query,
$aliases = array()
) {
global $what, $csv_terminated, $csv_separator, $csv_enclosed, $csv_escaped;
@ -218,7 +229,9 @@ class ExportCsv extends ExportPlugin
// Gets the data from the database
$result = $GLOBALS['dbi']->query(
$sql_query, null, PMA\libraries\DatabaseInterface::QUERY_UNBUFFERED
$sql_query,
null,
PMA\libraries\DatabaseInterface::QUERY_UNBUFFERED
);
$fields_cnt = $GLOBALS['dbi']->numFields($result);
@ -240,14 +253,15 @@ class ExportCsv extends ExportPlugin
$csv_escaped . $csv_enclosed,
$col_as
)
. $csv_enclosed;
. $csv_enclosed;
}
$schema_insert .= $csv_separator;
} // end for
$schema_insert = trim(
/*overload*/mb_substr($schema_insert, 0, -1)
/*overload*/
mb_substr($schema_insert, 0, -1)
);
if (! PMA_exportOutputHandler($schema_insert . $csv_terminated)) {
if (!PMA_exportOutputHandler($schema_insert . $csv_terminated)) {
return false;
}
} // end if
@ -256,7 +270,7 @@ class ExportCsv extends ExportPlugin
while ($row = $GLOBALS['dbi']->fetchRow($result)) {
$schema_insert = '';
for ($j = 0; $j < $fields_cnt; $j++) {
if (! isset($row[$j]) || is_null($row[$j])) {
if (!isset($row[$j]) || is_null($row[$j])) {
$schema_insert .= $GLOBALS[$what . '_null'];
} elseif ($row[$j] == '0' || $row[$j] != '') {
// always enclose fields
@ -296,23 +310,23 @@ class ExportCsv extends ExportPlugin
} else {
// avoid a problem when escape string equals enclose
$schema_insert .= $csv_enclosed
. str_replace(
$csv_enclosed,
$csv_escaped . $csv_enclosed,
$row[$j]
)
. $csv_enclosed;
. str_replace(
$csv_enclosed,
$csv_escaped . $csv_enclosed,
$row[$j]
)
. $csv_enclosed;
}
}
} else {
$schema_insert .= '';
}
if ($j < $fields_cnt-1) {
if ($j < $fields_cnt - 1) {
$schema_insert .= $csv_separator;
}
} // end for
if (! PMA_exportOutputHandler($schema_insert . $csv_terminated)) {
if (!PMA_exportOutputHandler($schema_insert . $csv_terminated)) {
return false;
}
} // end while

View File

@ -6,12 +6,15 @@
* @package PhpMyAdmin-Export
* @subpackage CSV-Excel
*/
if (! defined('PHPMYADMIN')) {
exit;
}
namespace PMA\libraries\plugins\export;
/* Extend the export CSV class */
require_once 'libraries/plugins/export/ExportCsv.class.php';
use BoolPropertyItem;
use ExportPluginProperties;
use HiddenPropertyItem;
use OptionsPropertyMainGroup;
use OptionsPropertyRootGroup;
use SelectPropertyItem;
use TextPropertyItem;
/**
* Handles the export for the CSV-Excel format
@ -71,9 +74,9 @@ class ExportExcel extends ExportCsv
$leaf->setName('edition');
$leaf->setValues(
array(
'win' => 'Windows',
'win' => 'Windows',
'mac_excel2003' => 'Excel 2003 / Macintosh',
'mac_excel2008' => 'Excel 2008 / Macintosh'
'mac_excel2008' => 'Excel 2008 / Macintosh',
)
);
$leaf->setText(__('Excel edition:'));

View File

@ -6,12 +6,12 @@
* @package PhpMyAdmin-Export
* @subpackage HTML-Word
*/
if (! defined('PHPMYADMIN')) {
exit;
}
namespace PMA\libraries\plugins\export;
/* Get the export interface */
require_once 'libraries/plugins/ExportPlugin.class.php';
use ExportPlugin;
use ExportPluginProperties;
use PMA\libraries\DatabaseInterface;
use PMA\libraries\Util;
/**
* Handles the export for the HTML-Word format
@ -66,9 +66,9 @@ class ExportHtmlword extends ExportPlugin
$leaf->setName("structure_or_data");
$leaf->setValues(
array(
'structure' => __('structure'),
'data' => __('data'),
'structure_and_data' => __('structure and data')
'structure' => __('structure'),
'data' => __('data'),
'structure_and_data' => __('structure and data'),
)
);
$dumpWhat->addProperty($leaf);
@ -145,6 +145,7 @@ class ExportHtmlword extends ExportPlugin
if (empty($db_alias)) {
$db_alias = $db;
}
return PMA_exportOutputHandler(
'<h1>' . __('Database') . ' ' . htmlspecialchars($db_alias) . '</h1>'
);
@ -189,7 +190,12 @@ class ExportHtmlword extends ExportPlugin
* @return bool Whether it succeeded
*/
public function exportData(
$db, $table, $crlf, $error_url, $sql_query, $aliases = array()
$db,
$table,
$crlf,
$error_url,
$sql_query,
$aliases = array()
) {
global $what;
@ -197,22 +203,26 @@ class ExportHtmlword extends ExportPlugin
$table_alias = $table;
$this->initAlias($aliases, $db_alias, $table_alias);
if (! PMA_exportOutputHandler(
if (!PMA_exportOutputHandler(
'<h2>'
. __('Dumping data for table') . ' ' . htmlspecialchars($table_alias)
. '</h2>'
)) {
)
) {
return false;
}
if (! PMA_exportOutputHandler(
if (!PMA_exportOutputHandler(
'<table class="width100" cellspacing="1">'
)) {
)
) {
return false;
}
// Gets the data from the database
$result = $GLOBALS['dbi']->query(
$sql_query, null, PMA\libraries\DatabaseInterface::QUERY_UNBUFFERED
$sql_query,
null,
DatabaseInterface::QUERY_UNBUFFERED
);
$fields_cnt = $GLOBALS['dbi']->numFields($result);
@ -230,7 +240,7 @@ class ExportHtmlword extends ExportPlugin
. '</strong></td>';
} // end for
$schema_insert .= '</tr>';
if (! PMA_exportOutputHandler($schema_insert)) {
if (!PMA_exportOutputHandler($schema_insert)) {
return false;
}
} // end if
@ -239,7 +249,7 @@ class ExportHtmlword extends ExportPlugin
while ($row = $GLOBALS['dbi']->fetchRow($result)) {
$schema_insert = '<tr class="print-category">';
for ($j = 0; $j < $fields_cnt; $j++) {
if (! isset($row[$j]) || is_null($row[$j])) {
if (!isset($row[$j]) || is_null($row[$j])) {
$value = $GLOBALS[$what . '_null'];
} elseif ($row[$j] == '0' || $row[$j] != '') {
$value = $row[$j];
@ -251,12 +261,12 @@ class ExportHtmlword extends ExportPlugin
. '</td>';
} // end for
$schema_insert .= '</tr>';
if (! PMA_exportOutputHandler($schema_insert)) {
if (!PMA_exportOutputHandler($schema_insert)) {
return false;
}
} // end while
$GLOBALS['dbi']->freeResult($result);
if (! PMA_exportOutputHandler('</table>')) {
if (!PMA_exportOutputHandler('</table>')) {
return false;
}
@ -317,25 +327,26 @@ class ExportHtmlword extends ExportPlugin
}
$schema_insert .= '</table>';
return $schema_insert;
}
/**
* Returns $table's CREATE definition
*
* @param string $db the database name
* @param string $table the table name
* @param bool $do_relation whether to include relation comments
* @param bool $do_comments whether to include the pmadb-style column
* @param string $db the database name
* @param string $table the table name
* @param bool $do_relation whether to include relation comments
* @param bool $do_comments whether to include the pmadb-style column
* comments as comments in the structure;
* this is deprecated but the parameter is
* left here because export.php calls
* PMA_exportStructure() also for other
* export types which use this parameter
* @param bool $do_mime whether to include mime comments
* @param bool $do_mime whether to include mime comments
* at the end
* @param bool $view whether we're handling a view
* @param array $aliases Aliases of db/table/columns
* @param bool $view whether we're handling a view
* @param array $aliases Aliases of db/table/columns
*
* @return string resulting schema
*/
@ -361,7 +372,7 @@ class ExportHtmlword extends ExportPlugin
// Check if we can use Relations
list($res_rel, $have_rel) = PMA_getRelationsAndStatus(
$do_relation && ! empty($cfgRelation['relation']),
$do_relation && !empty($cfgRelation['relation']),
$db,
$table
);
@ -429,7 +440,10 @@ class ExportHtmlword extends ExportPlugin
$schema_insert .= '<td class="print">'
. htmlspecialchars(
$this->getRelationString(
$res_rel, $field_name, $db, $aliases
$res_rel,
$field_name,
$db,
$aliases
)
)
. '</td>';
@ -443,16 +457,17 @@ class ExportHtmlword extends ExportPlugin
if ($do_mime && $cfgRelation['mimework']) {
$schema_insert .= '<td class="print">'
. (isset($mime_map[$field_name]) ?
htmlspecialchars(
str_replace('_', '/', $mime_map[$field_name]['mimetype'])
)
: '') . '</td>';
htmlspecialchars(
str_replace('_', '/', $mime_map[$field_name]['mimetype'])
)
: '') . '</td>';
}
$schema_insert .= '</tr>';
} // end foreach
$schema_insert .= '</table>';
return $schema_insert;
}
@ -494,29 +509,30 @@ class ExportHtmlword extends ExportPlugin
}
$dump .= '</table>';
return $dump;
}
/**
* Outputs table's structure
*
* @param string $db database name
* @param string $table table name
* @param string $crlf the end of line sequence
* @param string $error_url the url to go back in case of error
* @param string $export_mode 'create_table', 'triggers', 'create_view',
* 'stand_in'
* @param string $export_type 'server', 'database', 'table'
* @param bool $do_relation whether to include relation comments
* @param bool $do_comments whether to include the pmadb-style column
* @param string $db database name
* @param string $table table name
* @param string $crlf the end of line sequence
* @param string $error_url the url to go back in case of error
* @param string $export_mode 'create_table', 'triggers', 'create_view',
* 'stand_in'
* @param string $export_type 'server', 'database', 'table'
* @param bool $do_relation whether to include relation comments
* @param bool $do_comments whether to include the pmadb-style column
* comments as comments in the structure;
* this is deprecated but the parameter is
* left here because export.php calls
* PMA_exportStructure() also for other
* export types which use this parameter
* @param bool $do_mime whether to include mime comments
* @param bool $dates whether to include creation/update/check dates
* @param array $aliases Aliases of db/table/columns
* @param bool $do_mime whether to include mime comments
* @param bool $dates whether to include creation/update/check dates
* @param array $aliases Aliases of db/table/columns
*
* @return bool Whether it succeeded
*/
@ -539,15 +555,20 @@ class ExportHtmlword extends ExportPlugin
$dump = '';
switch($export_mode) {
switch ($export_mode) {
case 'create_table':
$dump .= '<h2>'
. __('Table structure for table') . ' '
. htmlspecialchars($table_alias)
. '</h2>';
$dump .= $this->getTableDef(
$db, $table, $do_relation, $do_comments, $do_mime,
false, $aliases
$db,
$table,
$do_relation,
$do_comments,
$do_mime,
false,
$aliases
);
break;
case 'triggers':
@ -565,12 +586,17 @@ class ExportHtmlword extends ExportPlugin
. __('Structure for view') . ' ' . htmlspecialchars($table_alias)
. '</h2>';
$dump .= $this->getTableDef(
$db, $table, $do_relation, $do_comments, $do_mime,
true, $aliases
$db,
$table,
$do_relation,
$do_comments,
$do_mime,
true,
$aliases
);
break;
case 'stand_in':
$dump .= '<h2>'
$dump .= '<h2>'
. __('Stand-in structure for view') . ' '
. htmlspecialchars($table_alias)
. '</h2>';
@ -591,7 +617,9 @@ class ExportHtmlword extends ExportPlugin
* @return string Formatted column definition
*/
protected function formatOneColumnDefinition(
$column, $unique_keys, $col_alias = ''
$column,
$unique_keys,
$col_alias = ''
) {
if (empty($col_alias)) {
$col_alias = $column['Field'];
@ -599,14 +627,14 @@ class ExportHtmlword extends ExportPlugin
$definition = '<tr class="print-category">';
$extracted_columnspec
= PMA\libraries\Util::extractColumnSpec($column['Type']);
= Util::extractColumnSpec($column['Type']);
$type = htmlspecialchars($extracted_columnspec['print_type']);
if (empty($type)) {
$type = '&nbsp;';
}
if (! isset($column['Default'])) {
if (!isset($column['Default'])) {
if ($column['Null'] != 'NO') {
$column['Default'] = 'NULL';
}
@ -634,8 +662,8 @@ class ExportHtmlword extends ExportPlugin
$definition .= '<td class="print">'
. htmlspecialchars(
isset($column['Default'])
? $column['Default']
: ''
? $column['Default']
: ''
)
. '</td>';

View File

@ -6,12 +6,15 @@
* @package PhpMyAdmin-Export
* @subpackage JSON
*/
if (! defined('PHPMYADMIN')) {
exit;
}
namespace PMA\libraries\plugins\export;
/* Get the export interface */
require_once 'libraries/plugins/ExportPlugin.class.php';
use BoolPropertyItem;
use ExportPlugin;
use ExportPluginProperties;
use HiddenPropertyItem;
use OptionsPropertyMainGroup;
use OptionsPropertyRootGroup;
use PMA;
/**
* Handles the export for the JSON format
@ -94,6 +97,7 @@ class ExportJson extends ExportPlugin
. ' @version 0.1' . $GLOBALS['crlf']
. ' */' . $GLOBALS['crlf'] . $GLOBALS['crlf']
);
return true;
}
@ -123,6 +127,7 @@ class ExportJson extends ExportPlugin
PMA_exportOutputHandler(
'// Database \'' . $db_alias . '\'' . $GLOBALS['crlf']
);
return true;
}
@ -165,14 +170,21 @@ class ExportJson extends ExportPlugin
* @return bool Whether it succeeded
*/
public function exportData(
$db, $table, $crlf, $error_url, $sql_query, $aliases = array()
$db,
$table,
$crlf,
$error_url,
$sql_query,
$aliases = array()
) {
$db_alias = $db;
$table_alias = $table;
$this->initAlias($aliases, $db_alias, $table_alias);
$result = $GLOBALS['dbi']->query(
$sql_query, null, PMA\libraries\DatabaseInterface::QUERY_UNBUFFERED
$sql_query,
null,
PMA\libraries\DatabaseInterface::QUERY_UNBUFFERED
);
$columns_cnt = $GLOBALS['dbi']->numFields($result);
@ -199,7 +211,7 @@ class ExportJson extends ExportPlugin
$buffer = ', ';
}
if (! PMA_exportOutputHandler($buffer)) {
if (!PMA_exportOutputHandler($buffer)) {
return false;
}
@ -217,18 +229,19 @@ class ExportJson extends ExportPlugin
$encoded = json_encode($data);
}
if (! PMA_exportOutputHandler($encoded)) {
if (!PMA_exportOutputHandler($encoded)) {
return false;
}
}
if ($record_cnt) {
if (! PMA_exportOutputHandler(']' . $crlf)) {
if (!PMA_exportOutputHandler(']' . $crlf)) {
return false;
}
}
$GLOBALS['dbi']->freeResult($result);
return true;
}
}

View File

@ -6,12 +6,11 @@
* @package PhpMyAdmin-Export
* @subpackage Latex
*/
if (! defined('PHPMYADMIN')) {
exit;
}
namespace PMA\libraries\plugins\export;
/* Get the export interface */
require_once 'libraries/plugins/ExportPlugin.class.php';
use ExportPlugin;
use PMA\libraries\DatabaseInterface;
use PMA\libraries\Util;
/**
* Handles the export for the Latex format
@ -55,7 +54,7 @@ class ExportLatex extends ExportPlugin
global $plugin_param;
$hide_structure = false;
if ($plugin_param['export_type'] == 'table'
&& ! $plugin_param['single_table']
&& !$plugin_param['single_table']
) {
$hide_structure = true;
}
@ -100,9 +99,9 @@ class ExportLatex extends ExportPlugin
$leaf->setName("structure_or_data");
$leaf->setValues(
array(
'structure' => __('structure'),
'data' => __('data'),
'structure_and_data' => __('structure and data')
'structure' => __('structure'),
'data' => __('data'),
'structure_and_data' => __('structure and data'),
)
);
$dumpWhat->addProperty($leaf);
@ -110,7 +109,7 @@ class ExportLatex extends ExportPlugin
$exportSpecificOptions->addProperty($dumpWhat);
// structure options main group
if (! $hide_structure) {
if (!$hide_structure) {
$structureOptions = new OptionsPropertyMainGroup();
$structureOptions->setName("structure");
$structureOptions->setText(__('Object creation options'));
@ -131,7 +130,7 @@ class ExportLatex extends ExportPlugin
$leaf->setText(__('Label key:'));
$leaf->setDoc('faq6-27');
$structureOptions->addProperty($leaf);
if (! empty($GLOBALS['cfgRelation']['relation'])) {
if (!empty($GLOBALS['cfgRelation']['relation'])) {
$leaf = new BoolPropertyItem();
$leaf->setName("relation");
$leaf->setText(__('Display foreign key relationships'));
@ -141,7 +140,7 @@ class ExportLatex extends ExportPlugin
$leaf->setName("comments");
$leaf->setText(__('Display comments'));
$structureOptions->addProperty($leaf);
if (! empty($GLOBALS['cfgRelation']['mimework'])) {
if (!empty($GLOBALS['cfgRelation']['mimework'])) {
$leaf = new BoolPropertyItem();
$leaf->setName("mime");
$leaf->setText(__('Display MIME types'));
@ -203,14 +202,15 @@ class ExportLatex extends ExportPlugin
. '% http://www.phpmyadmin.net' . $crlf
. '%' . $crlf
. '% ' . __('Host:') . ' ' . $cfg['Server']['host'];
if (! empty($cfg['Server']['port'])) {
$head .= ':' . $cfg['Server']['port'];
if (!empty($cfg['Server']['port'])) {
$head .= ':' . $cfg['Server']['port'];
}
$head .= $crlf
. '% ' . __('Generation Time:') . ' '
. PMA\libraries\Util::localisedDate() . $crlf
. Util::localisedDate() . $crlf
. '% ' . __('Server version:') . ' ' . PMA_MYSQL_STR_VERSION . $crlf
. '% ' . __('PHP Version:') . ' ' . phpversion() . $crlf;
return PMA_exportOutputHandler($head);
}
@ -241,6 +241,7 @@ class ExportLatex extends ExportPlugin
$head = '% ' . $crlf
. '% ' . __('Database:') . ' ' . '\'' . $db_alias . '\'' . $crlf
. '% ' . $crlf;
return PMA_exportOutputHandler($head);
}
@ -283,14 +284,21 @@ class ExportLatex extends ExportPlugin
* @return bool Whether it succeeded
*/
public function exportData(
$db, $table, $crlf, $error_url, $sql_query, $aliases = array()
$db,
$table,
$crlf,
$error_url,
$sql_query,
$aliases = array()
) {
$db_alias = $db;
$table_alias = $table;
$this->initAlias($aliases, $db_alias, $table_alias);
$result = $GLOBALS['dbi']->tryQuery(
$sql_query, null, PMA\libraries\DatabaseInterface::QUERY_UNBUFFERED
$result = $GLOBALS['dbi']->tryQuery(
$sql_query,
null,
DatabaseInterface::QUERY_UNBUFFERED
);
$columns_cnt = $GLOBALS['dbi']->numFields($result);
@ -310,29 +318,29 @@ class ExportLatex extends ExportPlugin
for ($index = 0; $index < $columns_cnt; $index++) {
$buffer .= 'l|';
}
$buffer .= '} ' . $crlf ;
$buffer .= '} ' . $crlf;
$buffer .= ' \\hline \\endhead \\hline \\endfoot \\hline ' . $crlf;
if (isset($GLOBALS['latex_caption'])) {
$buffer .= ' \\caption{'
. PMA\libraries\Util::expandUserString(
. Util::expandUserString(
$GLOBALS['latex_data_caption'],
array(
'texEscape',
get_class($this),
'libraries/plugins/export/' . get_class($this) . ".class.php"
'libraries/plugins/export/' . get_class($this) . ".class.php",
),
array('table' => $table_alias, 'database' => $db_alias)
)
. '} \\label{'
. PMA\libraries\Util::expandUserString(
. Util::expandUserString(
$GLOBALS['latex_data_label'],
null,
array('table' => $table_alias, 'database' => $db_alias)
)
. '} \\\\';
}
if (! PMA_exportOutputHandler($buffer)) {
if (!PMA_exportOutputHandler($buffer)) {
return false;
}
@ -344,34 +352,37 @@ class ExportLatex extends ExportPlugin
. self::texEscape(stripslashes($columns_alias[$i])) . '}} & ';
}
$buffer = /*overload*/mb_substr($buffer, 0, -2)
$buffer
= /*overload*/
mb_substr($buffer, 0, -2)
. '\\\\ \\hline \hline ';
if (! PMA_exportOutputHandler($buffer . ' \\endfirsthead ' . $crlf)) {
if (!PMA_exportOutputHandler($buffer . ' \\endfirsthead ' . $crlf)) {
return false;
}
if (isset($GLOBALS['latex_caption'])) {
if (! PMA_exportOutputHandler(
if (!PMA_exportOutputHandler(
'\\caption{'
. PMA\libraries\Util::expandUserString(
. Util::expandUserString(
$GLOBALS['latex_data_continued_caption'],
array(
'texEscape',
get_class($this),
'libraries/plugins/export/'
. get_class($this) . ".class.php"
. get_class($this) . ".class.php",
),
array('table' => $table_alias, 'database' => $db_alias)
)
. '} \\\\ '
)) {
)
) {
return false;
}
}
if (! PMA_exportOutputHandler($buffer . '\\endhead \\endfoot' . $crlf)) {
if (!PMA_exportOutputHandler($buffer . '\\endhead \\endfoot' . $crlf)) {
return false;
}
} else {
if (! PMA_exportOutputHandler('\\\\ \hline')) {
if (!PMA_exportOutputHandler('\\\\ \hline')) {
return false;
}
}
@ -381,8 +392,8 @@ class ExportLatex extends ExportPlugin
$buffer = '';
// print each row
for ($i = 0; $i < $columns_cnt; $i++) {
if ((! function_exists('is_null')
|| ! is_null($record[$columns[$i]]))
if ((!function_exists('is_null')
|| !is_null($record[$columns[$i]]))
&& isset($record[$columns[$i]])
) {
$column_value = self::texEscape(
@ -400,40 +411,41 @@ class ExportLatex extends ExportPlugin
}
}
$buffer .= ' \\\\ \\hline ' . $crlf;
if (! PMA_exportOutputHandler($buffer)) {
if (!PMA_exportOutputHandler($buffer)) {
return false;
}
}
$buffer = ' \\end{longtable}' . $crlf;
if (! PMA_exportOutputHandler($buffer)) {
if (!PMA_exportOutputHandler($buffer)) {
return false;
}
$GLOBALS['dbi']->freeResult($result);
return true;
} // end getTableLaTeX
/**
* Outputs table's structure
*
* @param string $db database name
* @param string $table table name
* @param string $crlf the end of line sequence
* @param string $error_url the url to go back in case of error
* @param string $export_mode 'create_table', 'triggers', 'create_view',
* 'stand_in'
* @param string $export_type 'server', 'database', 'table'
* @param bool $do_relation whether to include relation comments
* @param bool $do_comments whether to include the pmadb-style column
* @param string $db database name
* @param string $table table name
* @param string $crlf the end of line sequence
* @param string $error_url the url to go back in case of error
* @param string $export_mode 'create_table', 'triggers', 'create_view',
* 'stand_in'
* @param string $export_type 'server', 'database', 'table'
* @param bool $do_relation whether to include relation comments
* @param bool $do_comments whether to include the pmadb-style column
* comments as comments in the structure;
* this is deprecated but the parameter is
* left here because export.php calls
* exportStructure() also for other
* export types which use this parameter
* @param bool $do_mime whether to include mime comments
* @param bool $dates whether to include creation/update/check dates
* @param array $aliases Aliases of db/table/columns
* @param bool $do_mime whether to include mime comments
* @param bool $dates whether to include creation/update/check dates
* @param array $aliases Aliases of db/table/columns
*
* @return bool Whether it succeeded
*/
@ -479,16 +491,16 @@ class ExportLatex extends ExportPlugin
// Check if we can use Relations
list($res_rel, $have_rel) = PMA_getRelationsAndStatus(
$do_relation && ! empty($cfgRelation['relation']),
$do_relation && !empty($cfgRelation['relation']),
$db,
$table
);
/**
* Displays the table structure
*/
$buffer = $crlf . '%' . $crlf . '% ' . __('Structure:') . ' '
$buffer = $crlf . '%' . $crlf . '% ' . __('Structure:') . ' '
. $table_alias . $crlf . '%' . $crlf . ' \\begin{longtable}{';
if (! PMA_exportOutputHandler($buffer)) {
if (!PMA_exportOutputHandler($buffer)) {
return false;
}
@ -500,9 +512,9 @@ class ExportLatex extends ExportPlugin
$alignment .= 'l|';
}
if ($do_mime && $cfgRelation['mimework']) {
$alignment .='l|';
$alignment .= 'l|';
}
$buffer = $alignment . '} ' . $crlf ;
$buffer = $alignment . '} ' . $crlf;
$header = ' \\hline ';
$header .= '\\multicolumn{1}{|c|}{\\textbf{' . __('Column')
@ -524,17 +536,17 @@ class ExportLatex extends ExportPlugin
// Table caption for first page and label
if (isset($GLOBALS['latex_caption'])) {
$buffer .= ' \\caption{'
. PMA\libraries\Util::expandUserString(
. Util::expandUserString(
$GLOBALS['latex_structure_caption'],
array(
'texEscape',
get_class($this),
'libraries/plugins/export/' . get_class($this) . ".class.php"
'libraries/plugins/export/' . get_class($this) . ".class.php",
),
array('table' => $table_alias, 'database' => $db_alias)
)
. '} \\label{'
. PMA\libraries\Util::expandUserString(
. Util::expandUserString(
$GLOBALS['latex_structure_label'],
null,
array('table' => $table_alias, 'database' => $db_alias)
@ -546,12 +558,12 @@ class ExportLatex extends ExportPlugin
// Table caption on next pages
if (isset($GLOBALS['latex_caption'])) {
$buffer .= ' \\caption{'
. PMA\libraries\Util::expandUserString(
. Util::expandUserString(
$GLOBALS['latex_structure_continued_caption'],
array(
'texEscape',
get_class($this),
'libraries/plugins/export/' . get_class($this) . ".class.php"
'libraries/plugins/export/' . get_class($this) . ".class.php",
),
array('table' => $table_alias, 'database' => $db_alias)
)
@ -559,22 +571,22 @@ class ExportLatex extends ExportPlugin
}
$buffer .= $header . ' \\\\ \\hline \\hline \\endhead \\endfoot ' . $crlf;
if (! PMA_exportOutputHandler($buffer)) {
if (!PMA_exportOutputHandler($buffer)) {
return false;
}
$fields = $GLOBALS['dbi']->getColumns($db, $table);
foreach ($fields as $row) {
$extracted_columnspec
= PMA\libraries\Util::extractColumnSpec(
$row['Type']
);
= Util::extractColumnSpec(
$row['Type']
);
$type = $extracted_columnspec['print_type'];
if (empty($type)) {
$type = ' ';
}
if (! isset($row['Default'])) {
if (!isset($row['Default'])) {
if ($row['Null'] != 'NO') {
$row['Default'] = 'NULL';
}
@ -593,7 +605,10 @@ class ExportLatex extends ExportPlugin
if ($do_relation && $have_rel) {
$local_buffer .= "\000";
$local_buffer .= $this->getRelationString(
$res_rel, $field_name, $db, $aliases
$res_rel,
$field_name,
$db,
$aliases
);
}
if ($do_comments && $cfgRelation['commwork']) {
@ -613,27 +628,36 @@ class ExportLatex extends ExportPlugin
}
}
$local_buffer = self::texEscape($local_buffer);
if ($row['Key']=='PRI') {
$pos = /*overload*/mb_strpos($local_buffer, "\000");
if ($row['Key'] == 'PRI') {
$pos
= /*overload*/
mb_strpos($local_buffer, "\000");
$local_buffer = '\\textit{'
. /*overload*/mb_substr($local_buffer, 0, $pos)
. '}' . /*overload*/mb_substr($local_buffer, $pos);
. /*overload*/
mb_substr($local_buffer, 0, $pos)
. '}' . /*overload*/
mb_substr($local_buffer, $pos);
}
if (in_array($field_name, $unique_keys)) {
$pos = /*overload*/mb_strpos($local_buffer, "\000");
$pos
= /*overload*/
mb_strpos($local_buffer, "\000");
$local_buffer = '\\textbf{'
. /*overload*/mb_substr($local_buffer, 0, $pos)
. '}' . /*overload*/mb_substr($local_buffer, $pos);
. /*overload*/
mb_substr($local_buffer, 0, $pos)
. '}' . /*overload*/
mb_substr($local_buffer, $pos);
}
$buffer = str_replace("\000", ' & ', $local_buffer);
$buffer .= ' \\\\ \\hline ' . $crlf;
if (! PMA_exportOutputHandler($buffer)) {
if (!PMA_exportOutputHandler($buffer)) {
return false;
}
} // end while
$buffer = ' \\end{longtable}' . $crlf;
return PMA_exportOutputHandler($buffer);
} // end of the 'exportStructure' method
@ -646,11 +670,12 @@ class ExportLatex extends ExportPlugin
*/
public static function texEscape($string)
{
$escape = array('$', '%', '{', '}', '&', '#', '_', '^');
$escape = array('$', '%', '{', '}', '&', '#', '_', '^');
$cnt_escape = count($escape);
for ($k = 0; $k < $cnt_escape; $k++) {
$string = str_replace($escape[$k], '\\' . $escape[$k], $string);
}
return $string;
}
}

View File

@ -6,12 +6,16 @@
* @package PhpMyAdmin-Export
* @subpackage MediaWiki
*/
if (! defined('PHPMYADMIN')) {
exit;
}
namespace PMA\libraries\plugins\export;
/* Get the export interface */
require_once 'libraries/plugins/ExportPlugin.class.php';
use BoolPropertyItem;
use ExportPlugin;
use ExportPluginProperties;
use OptionsPropertyMainGroup;
use OptionsPropertyRootGroup;
use OptionsPropertySubgroup;
use PMA;
use RadioPropertyItem;
/**
* Handles the export for the MediaWiki class
@ -70,9 +74,9 @@ class ExportMediawiki extends ExportPlugin
$leaf->setName('structure_or_data');
$leaf->setValues(
array(
'structure' => __('structure'),
'data' => __('data'),
'structure_and_data' => __('structure and data')
'structure' => __('structure'),
'data' => __('data'),
'structure_and_data' => __('structure and data'),
)
);
$subgroup->setSubgroupHeader($leaf);
@ -197,7 +201,7 @@ class ExportMediawiki extends ExportPlugin
$this->initAlias($aliases, $db_alias, $table_alias);
$output = '';
switch($export_mode) {
switch ($export_mode) {
case 'create_table':
$columns = $GLOBALS['dbi']->getColumns($db, $table);
$columns = array_values($columns);
@ -211,7 +215,7 @@ class ExportMediawiki extends ExportPlugin
// Begin the table construction
$output .= "{| class=\"wikitable\" style=\"text-align:center;\""
. $this->_exportCRLF();
. $this->_exportCRLF();
// Add the table name
if (isset($GLOBALS['mediawiki_caption'])) {
@ -235,31 +239,31 @@ class ExportMediawiki extends ExportPlugin
}
// Add the table structure
$output .= "|-" . $this->_exportCRLF();
$output .= "|-" . $this->_exportCRLF();
$output .= "! Type" . $this->_exportCRLF();
for ($i = 0; $i < $row_cnt; ++$i) {
$output .= " | " . $columns[$i]['Type'] . $this->_exportCRLF();
}
$output .= "|-" . $this->_exportCRLF();
$output .= "|-" . $this->_exportCRLF();
$output .= "! Null" . $this->_exportCRLF();
for ($i = 0; $i < $row_cnt; ++$i) {
$output .= " | " . $columns[$i]['Null'] . $this->_exportCRLF();
}
$output .= "|-" . $this->_exportCRLF();
$output .= "|-" . $this->_exportCRLF();
$output .= "! Default" . $this->_exportCRLF();
for ($i = 0; $i < $row_cnt; ++$i) {
$output .= " | " . $columns[$i]['Default'] . $this->_exportCRLF();
}
$output .= "|-" . $this->_exportCRLF();
$output .= "|-" . $this->_exportCRLF();
$output .= "! Extra" . $this->_exportCRLF();
for ($i = 0; $i < $row_cnt; ++$i) {
$output .= " | " . $columns[$i]['Extra'] . $this->_exportCRLF();
}
$output .= "|}" . str_repeat($this->_exportCRLF(), 2);
$output .= "|}" . str_repeat($this->_exportCRLF(), 2);
break;
} // end switch
@ -312,7 +316,7 @@ class ExportMediawiki extends ExportPlugin
$column_names = $GLOBALS['dbi']->getColumnNames($db, $table);
// Add column names as table headers
if (! is_null($column_names) ) {
if (!is_null($column_names)) {
// Use '|-' for separating rows
$output .= "|-" . $this->_exportCRLF();
@ -330,7 +334,9 @@ class ExportMediawiki extends ExportPlugin
// Get the table data from the database
$result = $GLOBALS['dbi']->query(
$sql_query, null, PMA\libraries\DatabaseInterface::QUERY_UNBUFFERED
$sql_query,
null,
PMA\libraries\DatabaseInterface::QUERY_UNBUFFERED
);
$fields_cnt = $GLOBALS['dbi']->numFields($result);
@ -338,13 +344,14 @@ class ExportMediawiki extends ExportPlugin
$output .= "|-" . $this->_exportCRLF();
// Use '|' for separating table columns
for ($i = 0; $i < $fields_cnt; ++ $i) {
for ($i = 0; $i < $fields_cnt; ++$i) {
$output .= " | " . $row[$i] . "" . $this->_exportCRLF();
}
}
// End table construction
$output .= "|}" . str_repeat($this->_exportCRLF(), 2);
return PMA_exportOutputHandler($output);
}
@ -360,8 +367,8 @@ class ExportMediawiki extends ExportPlugin
// see http://www.mediawiki.org/wiki/Help:Formatting
$comment = $this->_exportCRLF();
$comment .= '<!--' . $this->_exportCRLF();
$comment .= $text . $this->_exportCRLF();
$comment .= '-->' . str_repeat($this->_exportCRLF(), 2);
$comment .= $text . $this->_exportCRLF();
$comment .= '-->' . str_repeat($this->_exportCRLF(), 2);
return $comment;
}

View File

@ -6,15 +6,16 @@
* @package PhpMyAdmin-Export
* @subpackage ODS
*/
if (! defined('PHPMYADMIN')) {
exit;
}
namespace PMA\libraries\plugins\export;
/* Get the export interface */
require_once 'libraries/plugins/ExportPlugin.class.php';
$GLOBALS['ods_buffer'] = '';
require_once 'libraries/opendocument.lib.php';
use BoolPropertyItem;
use ExportPlugin;
use ExportPluginProperties;
use HiddenPropertyItem;
use OptionsPropertyMainGroup;
use OptionsPropertyRootGroup;
use PMA\libraries\DatabaseInterface;
use TextPropertyItem;
/**
* Handles the export for the ODS class
@ -94,49 +95,50 @@ class ExportOds extends ExportPlugin
{
$GLOBALS['ods_buffer'] .= '<?xml version="1.0" encoding="utf-8"?' . '>'
. '<office:document-content '
. $GLOBALS['OpenDocumentNS'] . 'office:version="1.0">'
. $GLOBALS['OpenDocumentNS'] . 'office:version="1.0">'
. '<office:automatic-styles>'
. '<number:date-style style:name="N37"'
. ' number:automatic-order="true">'
. '<number:month number:style="long"/>'
. '<number:text>/</number:text>'
. '<number:day number:style="long"/>'
. '<number:text>/</number:text>'
. '<number:year/>'
. '</number:date-style>'
. '<number:time-style style:name="N43">'
. '<number:hours number:style="long"/>'
. '<number:text>:</number:text>'
. '<number:minutes number:style="long"/>'
. '<number:text>:</number:text>'
. '<number:seconds number:style="long"/>'
. '<number:text> </number:text>'
. '<number:am-pm/>'
. '</number:time-style>'
. '<number:date-style style:name="N50"'
. ' number:automatic-order="true"'
. ' number:format-source="language">'
. '<number:month/>'
. '<number:text>/</number:text>'
. '<number:day/>'
. '<number:text>/</number:text>'
. '<number:year/>'
. '<number:text> </number:text>'
. '<number:hours number:style="long"/>'
. '<number:text>:</number:text>'
. '<number:minutes number:style="long"/>'
. '<number:text> </number:text>'
. '<number:am-pm/>'
. '</number:date-style>'
. '<style:style style:name="DateCell" style:family="table-cell"'
. ' style:parent-style-name="Default" style:data-style-name="N37"/>'
. '<style:style style:name="TimeCell" style:family="table-cell"'
. ' style:parent-style-name="Default" style:data-style-name="N43"/>'
. '<style:style style:name="DateTimeCell" style:family="table-cell"'
. ' style:parent-style-name="Default" style:data-style-name="N50"/>'
. '<number:date-style style:name="N37"'
. ' number:automatic-order="true">'
. '<number:month number:style="long"/>'
. '<number:text>/</number:text>'
. '<number:day number:style="long"/>'
. '<number:text>/</number:text>'
. '<number:year/>'
. '</number:date-style>'
. '<number:time-style style:name="N43">'
. '<number:hours number:style="long"/>'
. '<number:text>:</number:text>'
. '<number:minutes number:style="long"/>'
. '<number:text>:</number:text>'
. '<number:seconds number:style="long"/>'
. '<number:text> </number:text>'
. '<number:am-pm/>'
. '</number:time-style>'
. '<number:date-style style:name="N50"'
. ' number:automatic-order="true"'
. ' number:format-source="language">'
. '<number:month/>'
. '<number:text>/</number:text>'
. '<number:day/>'
. '<number:text>/</number:text>'
. '<number:year/>'
. '<number:text> </number:text>'
. '<number:hours number:style="long"/>'
. '<number:text>:</number:text>'
. '<number:minutes number:style="long"/>'
. '<number:text> </number:text>'
. '<number:am-pm/>'
. '</number:date-style>'
. '<style:style style:name="DateCell" style:family="table-cell"'
. ' style:parent-style-name="Default" style:data-style-name="N37"/>'
. '<style:style style:name="TimeCell" style:family="table-cell"'
. ' style:parent-style-name="Default" style:data-style-name="N43"/>'
. '<style:style style:name="DateTimeCell" style:family="table-cell"'
. ' style:parent-style-name="Default" style:data-style-name="N50"/>'
. '</office:automatic-styles>'
. '<office:body>'
. '<office:spreadsheet>';
return true;
}
@ -150,14 +152,16 @@ class ExportOds extends ExportPlugin
$GLOBALS['ods_buffer'] .= '</office:spreadsheet>'
. '</office:body>'
. '</office:document-content>';
if (! PMA_exportOutputHandler(
if (!PMA_exportOutputHandler(
PMA_createOpenDocument(
'application/vnd.oasis.opendocument.spreadsheet',
$GLOBALS['ods_buffer']
)
)) {
)
) {
return false;
}
return true;
}
@ -213,7 +217,12 @@ class ExportOds extends ExportPlugin
* @return bool Whether it succeeded
*/
public function exportData(
$db, $table, $crlf, $error_url, $sql_query, $aliases = array()
$db,
$table,
$crlf,
$error_url,
$sql_query,
$aliases = array()
) {
global $what;
@ -222,7 +231,9 @@ class ExportOds extends ExportPlugin
$this->initAlias($aliases, $db_alias, $table_alias);
// Gets the data from the database
$result = $GLOBALS['dbi']->query(
$sql_query, null, PMA\libraries\DatabaseInterface::QUERY_UNBUFFERED
$sql_query,
null,
DatabaseInterface::QUERY_UNBUFFERED
);
$fields_cnt = $GLOBALS['dbi']->numFields($result);
$fields_meta = $GLOBALS['dbi']->getFieldsMeta($result);
@ -231,8 +242,8 @@ class ExportOds extends ExportPlugin
$field_flags[$j] = $GLOBALS['dbi']->fieldFlags($result, $j);
}
$GLOBALS['ods_buffer'] .=
'<table:table table:name="' . htmlspecialchars($table_alias) . '">';
$GLOBALS['ods_buffer']
.= '<table:table table:name="' . htmlspecialchars($table_alias) . '">';
// If required, get fields name at the first line
if (isset($GLOBALS[$what . '_columns'])) {
@ -242,8 +253,8 @@ class ExportOds extends ExportPlugin
if (!empty($aliases[$db]['tables'][$table]['columns'][$col_as])) {
$col_as = $aliases[$db]['tables'][$table]['columns'][$col_as];
}
$GLOBALS['ods_buffer'] .=
'<table:table-cell office:value-type="string">'
$GLOBALS['ods_buffer']
.= '<table:table-cell office:value-type="string">'
. '<text:p>'
. htmlspecialchars(
stripslashes($col_as)
@ -258,9 +269,9 @@ class ExportOds extends ExportPlugin
while ($row = $GLOBALS['dbi']->fetchRow($result)) {
$GLOBALS['ods_buffer'] .= '<table:table-row>';
for ($j = 0; $j < $fields_cnt; $j++) {
if (! isset($row[$j]) || is_null($row[$j])) {
$GLOBALS['ods_buffer'] .=
'<table:table-cell office:value-type="string">'
if (!isset($row[$j]) || is_null($row[$j])) {
$GLOBALS['ods_buffer']
.= '<table:table-cell office:value-type="string">'
. '<text:p>'
. htmlspecialchars($GLOBALS[$what . '_null'])
. '</text:p>'
@ -269,54 +280,55 @@ class ExportOds extends ExportPlugin
&& $fields_meta[$j]->blob
) {
// ignore BLOB
$GLOBALS['ods_buffer'] .=
'<table:table-cell office:value-type="string">'
$GLOBALS['ods_buffer']
.= '<table:table-cell office:value-type="string">'
. '<text:p></text:p>'
. '</table:table-cell>';
} elseif ($fields_meta[$j]->type == "date") {
$GLOBALS['ods_buffer'] .=
'<table:table-cell office:value-type="date"'
. ' office:date-value="'
. date("Y-m-d", strtotime($row[$j]))
. '" table:style-name="DateCell">'
$GLOBALS['ods_buffer']
.= '<table:table-cell office:value-type="date"'
. ' office:date-value="'
. date("Y-m-d", strtotime($row[$j]))
. '" table:style-name="DateCell">'
. '<text:p>'
. htmlspecialchars($row[$j])
. '</text:p>'
. '</table:table-cell>';
} elseif ($fields_meta[$j]->type == "time") {
$GLOBALS['ods_buffer'] .=
'<table:table-cell office:value-type="time"'
. ' office:time-value="'
. date("\P\TH\Hi\Ms\S", strtotime($row[$j]))
. '" table:style-name="TimeCell">'
$GLOBALS['ods_buffer']
.= '<table:table-cell office:value-type="time"'
. ' office:time-value="'
. date("\P\TH\Hi\Ms\S", strtotime($row[$j]))
. '" table:style-name="TimeCell">'
. '<text:p>'
. htmlspecialchars($row[$j])
. '</text:p>'
. '</table:table-cell>';
} elseif ($fields_meta[$j]->type == "datetime") {
$GLOBALS['ods_buffer'] .=
'<table:table-cell office:value-type="date"'
. ' office:date-value="'
. date("Y-m-d\TH:i:s", strtotime($row[$j]))
. '" table:style-name="DateTimeCell">'
$GLOBALS['ods_buffer']
.= '<table:table-cell office:value-type="date"'
. ' office:date-value="'
. date("Y-m-d\TH:i:s", strtotime($row[$j]))
. '" table:style-name="DateTimeCell">'
. '<text:p>'
. htmlspecialchars($row[$j])
. '</text:p>'
. '</table:table-cell>';
} elseif (($fields_meta[$j]->numeric
&& $fields_meta[$j]->type != 'timestamp'
&& ! $fields_meta[$j]->blob) || $fields_meta[$j]->type == 'real'
&& $fields_meta[$j]->type != 'timestamp'
&& !$fields_meta[$j]->blob)
|| $fields_meta[$j]->type == 'real'
) {
$GLOBALS['ods_buffer'] .=
'<table:table-cell office:value-type="float"'
. ' office:value="' . $row[$j] . '" >'
$GLOBALS['ods_buffer']
.= '<table:table-cell office:value-type="float"'
. ' office:value="' . $row[$j] . '" >'
. '<text:p>'
. htmlspecialchars($row[$j])
. '</text:p>'
. '</table:table-cell>';
} else {
$GLOBALS['ods_buffer'] .=
'<table:table-cell office:value-type="string">'
$GLOBALS['ods_buffer']
.= '<table:table-cell office:value-type="string">'
. '<text:p>'
. htmlspecialchars($row[$j])
. '</text:p>'

View File

@ -6,15 +6,16 @@
* @package PhpMyAdmin-Export
* @subpackage ODT
*/
if (! defined('PHPMYADMIN')) {
exit;
}
namespace PMA\libraries\plugins\export;
/* Get the export interface */
require_once 'libraries/plugins/ExportPlugin.class.php';
use BoolPropertyItem;
use ExportPluginProperties;
use OptionsPropertyMainGroup;
use OptionsPropertyRootGroup;
use PMA\libraries\DatabaseInterface;
use RadioPropertyItem;
$GLOBALS['odt_buffer'] = '';
require_once 'libraries/opendocument.lib.php';
/**
* Handles the export for the ODT class
@ -42,7 +43,7 @@ class ExportOdt extends ExportPlugin
global $plugin_param;
$hide_structure = false;
if ($plugin_param['export_type'] == 'table'
&& ! $plugin_param['single_table']
&& !$plugin_param['single_table']
) {
$hide_structure = true;
}
@ -80,9 +81,9 @@ class ExportOdt extends ExportPlugin
$leaf->setName("structure_or_data");
$leaf->setValues(
array(
'structure' => __('structure'),
'data' => __('data'),
'structure_and_data' => __('structure and data')
'structure' => __('structure'),
'data' => __('data'),
'structure_and_data' => __('structure and data'),
)
);
$dumpWhat->addProperty($leaf);
@ -90,13 +91,13 @@ class ExportOdt extends ExportPlugin
$exportSpecificOptions->addProperty($dumpWhat);
// structure options main group
if (! $hide_structure) {
if (!$hide_structure) {
$structureOptions = new OptionsPropertyMainGroup();
$structureOptions->setName("structure");
$structureOptions->setText(__('Object creation options'));
$structureOptions->setForce('data');
// create primary items and add them to the group
if (! empty($GLOBALS['cfgRelation']['relation'])) {
if (!empty($GLOBALS['cfgRelation']['relation'])) {
$leaf = new BoolPropertyItem();
$leaf->setName("relation");
$leaf->setText(__('Display foreign key relationships'));
@ -106,7 +107,7 @@ class ExportOdt extends ExportPlugin
$leaf->setName("comments");
$leaf->setText(__('Display comments'));
$structureOptions->addProperty($leaf);
if (! empty($GLOBALS['cfgRelation']['mimework'])) {
if (!empty($GLOBALS['cfgRelation']['mimework'])) {
$leaf = new BoolPropertyItem();
$leaf->setName("mime");
$leaf->setText(__('Display MIME types'));
@ -147,9 +148,10 @@ class ExportOdt extends ExportPlugin
{
$GLOBALS['odt_buffer'] .= '<?xml version="1.0" encoding="utf-8"?' . '>'
. '<office:document-content '
. $GLOBALS['OpenDocumentNS'] . 'office:version="1.0">'
. $GLOBALS['OpenDocumentNS'] . 'office:version="1.0">'
. '<office:body>'
. '<office:text>';
return true;
}
@ -163,14 +165,16 @@ class ExportOdt extends ExportPlugin
$GLOBALS['odt_buffer'] .= '</office:text>'
. '</office:body>'
. '</office:document-content>';
if (! PMA_exportOutputHandler(
if (!PMA_exportOutputHandler(
PMA_createOpenDocument(
'application/vnd.oasis.opendocument.text',
$GLOBALS['odt_buffer']
)
)) {
)
) {
return false;
}
return true;
}
@ -187,11 +191,12 @@ class ExportOdt extends ExportPlugin
if (empty($db_alias)) {
$db_alias = $db;
}
$GLOBALS['odt_buffer'] .=
'<text:h text:outline-level="1" text:style-name="Heading_1"'
. ' text:is-list-header="true">'
$GLOBALS['odt_buffer']
.= '<text:h text:outline-level="1" text:style-name="Heading_1"'
. ' text:is-list-header="true">'
. __('Database') . ' ' . htmlspecialchars($db_alias)
. '</text:h>';
return true;
}
@ -220,6 +225,7 @@ class ExportOdt extends ExportPlugin
{
return true;
}
/**
* Outputs the content of a table in NHibernate format
*
@ -233,7 +239,12 @@ class ExportOdt extends ExportPlugin
* @return bool Whether it succeeded
*/
public function exportData(
$db, $table, $crlf, $error_url, $sql_query, $aliases = array()
$db,
$table,
$crlf,
$error_url,
$sql_query,
$aliases = array()
) {
global $what;
@ -242,7 +253,9 @@ class ExportOdt extends ExportPlugin
$this->initAlias($aliases, $db_alias, $table_alias);
// Gets the data from the database
$result = $GLOBALS['dbi']->query(
$sql_query, null, PMA\libraries\DatabaseInterface::QUERY_UNBUFFERED
$sql_query,
null,
DatabaseInterface::QUERY_UNBUFFERED
);
$fields_cnt = $GLOBALS['dbi']->numFields($result);
$fields_meta = $GLOBALS['dbi']->getFieldsMeta($result);
@ -251,10 +264,10 @@ class ExportOdt extends ExportPlugin
$field_flags[$j] = $GLOBALS['dbi']->fieldFlags($result, $j);
}
$GLOBALS['odt_buffer'] .=
'<text:h text:outline-level="2" text:style-name="Heading_2"'
. ' text:is-list-header="true">'
. __('Dumping data for table') . ' ' . htmlspecialchars($table_alias)
$GLOBALS['odt_buffer']
.= '<text:h text:outline-level="2" text:style-name="Heading_2"'
. ' text:is-list-header="true">'
. __('Dumping data for table') . ' ' . htmlspecialchars($table_alias)
. '</text:h>'
. '<table:table'
. ' table:name="' . htmlspecialchars($table_alias) . '_structure">'
@ -269,12 +282,12 @@ class ExportOdt extends ExportPlugin
if (!empty($aliases[$db]['tables'][$table]['columns'][$col_as])) {
$col_as = $aliases[$db]['tables'][$table]['columns'][$col_as];
}
$GLOBALS['odt_buffer'] .=
'<table:table-cell office:value-type="string">'
$GLOBALS['odt_buffer']
.= '<table:table-cell office:value-type="string">'
. '<text:p>'
. htmlspecialchars(
stripslashes($col_as)
)
. htmlspecialchars(
stripslashes($col_as)
)
. '</text:p>'
. '</table:table-cell>';
} // end for
@ -285,9 +298,9 @@ class ExportOdt extends ExportPlugin
while ($row = $GLOBALS['dbi']->fetchRow($result)) {
$GLOBALS['odt_buffer'] .= '<table:table-row>';
for ($j = 0; $j < $fields_cnt; $j++) {
if (! isset($row[$j]) || is_null($row[$j])) {
$GLOBALS['odt_buffer'] .=
'<table:table-cell office:value-type="string">'
if (!isset($row[$j]) || is_null($row[$j])) {
$GLOBALS['odt_buffer']
.= '<table:table-cell office:value-type="string">'
. '<text:p>'
. htmlspecialchars($GLOBALS[$what . '_null'])
. '</text:p>'
@ -296,24 +309,24 @@ class ExportOdt extends ExportPlugin
&& $fields_meta[$j]->blob
) {
// ignore BLOB
$GLOBALS['odt_buffer'] .=
'<table:table-cell office:value-type="string">'
$GLOBALS['odt_buffer']
.= '<table:table-cell office:value-type="string">'
. '<text:p></text:p>'
. '</table:table-cell>';
} elseif ($fields_meta[$j]->numeric
&& $fields_meta[$j]->type != 'timestamp'
&& ! $fields_meta[$j]->blob
&& !$fields_meta[$j]->blob
) {
$GLOBALS['odt_buffer'] .=
'<table:table-cell office:value-type="float"'
. ' office:value="' . $row[$j] . '" >'
$GLOBALS['odt_buffer']
.= '<table:table-cell office:value-type="float"'
. ' office:value="' . $row[$j] . '" >'
. '<text:p>'
. htmlspecialchars($row[$j])
. '</text:p>'
. '</table:table-cell>';
} else {
$GLOBALS['odt_buffer'] .=
'<table:table-cell office:value-type="string">'
$GLOBALS['odt_buffer']
.= '<table:table-cell office:value-type="string">'
. '<text:p>'
. htmlspecialchars($row[$j])
. '</text:p>'
@ -352,12 +365,12 @@ class ExportOdt extends ExportPlugin
/**
* Displays the table structure
*/
$GLOBALS['odt_buffer'] .=
'<table:table table:name="'
$GLOBALS['odt_buffer']
.= '<table:table table:name="'
. htmlspecialchars($view_alias) . '_data">';
$columns_cnt = 4;
$GLOBALS['odt_buffer'] .=
'<table:table-column'
$GLOBALS['odt_buffer']
.= '<table:table-column'
. ' table:number-columns-repeated="' . $columns_cnt . '"/>';
/* Header */
$GLOBALS['odt_buffer'] .= '<table:table-row>'
@ -382,34 +395,36 @@ class ExportOdt extends ExportPlugin
$col_as = $aliases[$db]['tables'][$view]['columns'][$col_as];
}
$GLOBALS['odt_buffer'] .= $this->formatOneColumnDefinition(
$column, $col_as
$column,
$col_as
);
$GLOBALS['odt_buffer'] .= '</table:table-row>';
} // end foreach
$GLOBALS['odt_buffer'] .= '</table:table>';
return true;
}
/**
* Returns $table's CREATE definition
*
* @param string $db the database name
* @param string $table the table name
* @param string $crlf the end of line sequence
* @param string $error_url the url to go back in case of error
* @param bool $do_relation whether to include relation comments
* @param bool $do_comments whether to include the pmadb-style column
* @param string $db the database name
* @param string $table the table name
* @param string $crlf the end of line sequence
* @param string $error_url the url to go back in case of error
* @param bool $do_relation whether to include relation comments
* @param bool $do_comments whether to include the pmadb-style column
* comments as comments in the structure;
* this is deprecated but the parameter is
* left here because export.php calls
* PMA_exportStructure() also for other
* @param bool $do_mime whether to include mime comments
* @param bool $show_dates whether to include creation/update/check dates
* @param bool $add_semicolon whether to add semicolon and end-of-line at
* the end
* @param bool $view whether we're handling a view
* @param array $aliases Aliases of db/table/columns
* @param bool $do_mime whether to include mime comments
* @param bool $show_dates whether to include creation/update/check dates
* @param bool $add_semicolon whether to add semicolon and end-of-line at
* the end
* @param bool $view whether we're handling a view
* @param array $aliases Aliases of db/table/columns
*
* @return bool true
*/
@ -438,7 +453,7 @@ class ExportOdt extends ExportPlugin
// Check if we can use Relations
list($res_rel, $have_rel) = PMA_getRelationsAndStatus(
$do_relation && ! empty($cfgRelation['relation']),
$do_relation && !empty($cfgRelation['relation']),
$db,
$table
);
@ -499,7 +514,8 @@ class ExportOdt extends ExportPlugin
$col_as = $aliases[$db]['tables'][$table]['columns'][$col_as];
}
$GLOBALS['odt_buffer'] .= $this->formatOneColumnDefinition(
$column, $col_as
$column,
$col_as
);
if ($do_relation && $have_rel) {
$foreigner = PMA_searchColumnInForeigners($res_rel, $field_name);
@ -515,8 +531,8 @@ class ExportOdt extends ExportPlugin
$rtable = $aliases[$db]['tables'][$rtable]['alias'];
}
$relation = htmlspecialchars($rtable . ' (' . $rfield . ')');
$GLOBALS['odt_buffer'] .=
'<table:table-cell office:value-type="string">'
$GLOBALS['odt_buffer']
.= '<table:table-cell office:value-type="string">'
. '<text:p>'
. htmlspecialchars($relation)
. '</text:p>'
@ -525,23 +541,23 @@ class ExportOdt extends ExportPlugin
}
if ($do_comments) {
if (isset($comments[$field_name])) {
$GLOBALS['odt_buffer'] .=
'<table:table-cell office:value-type="string">'
$GLOBALS['odt_buffer']
.= '<table:table-cell office:value-type="string">'
. '<text:p>'
. htmlspecialchars($comments[$field_name])
. '</text:p>'
. '</table:table-cell>';
} else {
$GLOBALS['odt_buffer'] .=
'<table:table-cell office:value-type="string">'
$GLOBALS['odt_buffer']
.= '<table:table-cell office:value-type="string">'
. '<text:p></text:p>'
. '</table:table-cell>';
}
}
if ($do_mime && $cfgRelation['mimework']) {
if (isset($mime_map[$field_name])) {
$GLOBALS['odt_buffer'] .=
'<table:table-cell office:value-type="string">'
$GLOBALS['odt_buffer']
.= '<table:table-cell office:value-type="string">'
. '<text:p>'
. htmlspecialchars(
str_replace('_', '/', $mime_map[$field_name]['mimetype'])
@ -549,8 +565,8 @@ class ExportOdt extends ExportPlugin
. '</text:p>'
. '</table:table-cell>';
} else {
$GLOBALS['odt_buffer'] .=
'<table:table-cell office:value-type="string">'
$GLOBALS['odt_buffer']
.= '<table:table-cell office:value-type="string">'
. '<text:p></text:p>'
. '</table:table-cell>';
}
@ -559,6 +575,7 @@ class ExportOdt extends ExportPlugin
} // end foreach
$GLOBALS['odt_buffer'] .= '</table:table>';
return true;
} // end of the '$this->getTableDef()' function
@ -623,28 +640,29 @@ class ExportOdt extends ExportPlugin
}
$GLOBALS['odt_buffer'] .= '</table:table>';
return true;
}
/**
* Outputs table's structure
*
* @param string $db database name
* @param string $table table name
* @param string $crlf the end of line sequence
* @param string $error_url the url to go back in case of error
* @param string $export_mode 'create_table', 'triggers', 'create_view',
* 'stand_in'
* @param string $export_type 'server', 'database', 'table'
* @param bool $do_relation whether to include relation comments
* @param bool $do_comments whether to include the pmadb-style column
* @param string $db database name
* @param string $table table name
* @param string $crlf the end of line sequence
* @param string $error_url the url to go back in case of error
* @param string $export_mode 'create_table', 'triggers', 'create_view',
* 'stand_in'
* @param string $export_type 'server', 'database', 'table'
* @param bool $do_relation whether to include relation comments
* @param bool $do_comments whether to include the pmadb-style column
* comments as comments in the structure;
* this is deprecated but the parameter is
* left here because export.php calls
* PMA_exportStructure() also for other
* @param bool $do_mime whether to include mime comments
* @param bool $dates whether to include creation/update/check dates
* @param array $aliases Aliases of db/table/columns
* @param bool $do_mime whether to include mime comments
* @param bool $dates whether to include creation/update/check dates
* @param array $aliases Aliases of db/table/columns
*
* @return bool Whether it succeeded
*/
@ -664,47 +682,65 @@ class ExportOdt extends ExportPlugin
$db_alias = $db;
$table_alias = $table;
$this->initAlias($aliases, $db_alias, $table_alias);
switch($export_mode) {
switch ($export_mode) {
case 'create_table':
$GLOBALS['odt_buffer'] .=
'<text:h text:outline-level="2" text:style-name="Heading_2"'
$GLOBALS['odt_buffer']
.= '<text:h text:outline-level="2" text:style-name="Heading_2"'
. ' text:is-list-header="true">'
. __('Table structure for table') . ' ' .
htmlspecialchars($table_alias)
. '</text:h>';
$this->getTableDef(
$db, $table, $crlf, $error_url, $do_relation, $do_comments,
$do_mime, $dates, true, false, $aliases
$db,
$table,
$crlf,
$error_url,
$do_relation,
$do_comments,
$do_mime,
$dates,
true,
false,
$aliases
);
break;
case 'triggers':
$triggers = $GLOBALS['dbi']->getTriggers($db, $table, $aliases);
if ($triggers) {
$GLOBALS['odt_buffer'] .=
'<text:h text:outline-level="2" text:style-name="Heading_2"'
$GLOBALS['odt_buffer']
.= '<text:h text:outline-level="2" text:style-name="Heading_2"'
. ' text:is-list-header="true">'
. __('Triggers') . ' '
. htmlspecialchars($table_alias)
. '</text:h>';
$this->getTriggers($db, $table);
$this->getTriggers($db, $table);
}
break;
case 'create_view':
$GLOBALS['odt_buffer'] .=
'<text:h text:outline-level="2" text:style-name="Heading_2"'
$GLOBALS['odt_buffer']
.= '<text:h text:outline-level="2" text:style-name="Heading_2"'
. ' text:is-list-header="true">'
. __('Structure for view') . ' '
. htmlspecialchars($table_alias)
. '</text:h>';
$this->getTableDef(
$db, $table, $crlf, $error_url, $do_relation, $do_comments,
$do_mime, $dates, true, true, $aliases
$db,
$table,
$crlf,
$error_url,
$do_relation,
$do_comments,
$do_mime,
$dates,
true,
true,
$aliases
);
break;
case 'stand_in':
$GLOBALS['odt_buffer'] .=
'<text:h text:outline-level="2" text:style-name="Heading_2"'
. ' text:is-list-header="true">'
$GLOBALS['odt_buffer']
.= '<text:h text:outline-level="2" text:style-name="Heading_2"'
. ' text:is-list-header="true">'
. __('Stand-in structure for view') . ' '
. htmlspecialchars($table_alias)
. '</text:h>';
@ -728,13 +764,13 @@ class ExportOdt extends ExportPlugin
if (empty($col_as)) {
$col_as = $column['Field'];
}
$definition = '<table:table-row>';
$definition = '<table:table-row>';
$definition .= '<table:table-cell office:value-type="string">'
. '<text:p>' . htmlspecialchars($col_as) . '</text:p>'
. '</table:table-cell>';
$extracted_columnspec
= PMA\libraries\Util::extractColumnSpec($column['Type']);
= Util::extractColumnSpec($column['Type']);
$type = htmlspecialchars($extracted_columnspec['print_type']);
if (empty($type)) {
$type = '&nbsp;';
@ -743,7 +779,7 @@ class ExportOdt extends ExportPlugin
$definition .= '<table:table-cell office:value-type="string">'
. '<text:p>' . htmlspecialchars($type) . '</text:p>'
. '</table:table-cell>';
if (! isset($column['Default'])) {
if (!isset($column['Default'])) {
if ($column['Null'] != 'NO') {
$column['Default'] = 'NULL';
} else {
@ -760,6 +796,7 @@ class ExportOdt extends ExportPlugin
$definition .= '<table:table-cell office:value-type="string">'
. '<text:p>' . htmlspecialchars($column['Default']) . '</text:p>'
. '</table:table-cell>';
return $definition;
}
}

View File

@ -6,22 +6,24 @@
* @package PhpMyAdmin-Export
* @subpackage PDF
*/
if (! defined('PHPMYADMIN')) {
exit;
}
namespace PMA\libraries\plugins\export;
use ExportPlugin;
use ExportPluginProperties;
use OptionsPropertyMainGroup;
use OptionsPropertyRootGroup;
use PMA\libraries\plugins\export\PMA_ExportPdf;
use RadioPropertyItem;
/**
* Skip the plugin if TCPDF is not available.
*/
if (! file_exists(TCPDF_INC)) {
if (!file_exists(TCPDF_INC)) {
$GLOBALS['skip_import'] = true;
return;
}
/* Get the export interface */
require_once 'libraries/plugins/ExportPlugin.class.php';
/* Get the PMA_ExportPdf class */
require_once 'libraries/plugins/export/PMA_ExportPdf.class.php';
require_once 'libraries/transformations.lib.php';
/**
@ -33,12 +35,11 @@ require_once 'libraries/transformations.lib.php';
class ExportPdf extends ExportPlugin
{
/**
* PMA_ExportPdf instance
* PMA\libraries\plugins\export\PMA_ExportPdf instance
*
* @var PMA_ExportPdf
*/
private $_pdf;
/**
* PDF Report Title
*
@ -64,7 +65,7 @@ class ExportPdf extends ExportPlugin
*/
protected function initSpecificVariables()
{
if (! empty($_POST['pdf_report_title'])) {
if (!empty($_POST['pdf_report_title'])) {
$this->_setPdfReportTitle($_POST['pdf_report_title']);
}
$this->_setPdf(new PMA_ExportPdf('L', 'pt', 'A3'));
@ -116,9 +117,9 @@ class ExportPdf extends ExportPlugin
$leaf->setName("structure_or_data");
$leaf->setValues(
array(
'structure' => __('structure'),
'data' => __('data'),
'structure_and_data' => __('structure and data')
'structure' => __('structure'),
'data' => __('data'),
'structure_and_data' => __('structure and data'),
)
);
$dumpWhat->addProperty($leaf);
@ -158,7 +159,7 @@ class ExportPdf extends ExportPlugin
$pdf = $this->_getPdf();
// instead of $pdf->Output():
if (! PMA_exportOutputHandler($pdf->getPDFData())) {
if (!PMA_exportOutputHandler($pdf->getPDFData())) {
return false;
}
@ -203,6 +204,7 @@ class ExportPdf extends ExportPlugin
{
return true;
}
/**
* Outputs the content of a table in NHibernate format
*
@ -216,16 +218,23 @@ class ExportPdf extends ExportPlugin
* @return bool Whether it succeeded
*/
public function exportData(
$db, $table, $crlf, $error_url, $sql_query, $aliases = array()
$db,
$table,
$crlf,
$error_url,
$sql_query,
$aliases = array()
) {
$db_alias = $db;
$table_alias = $table;
$this->initAlias($aliases, $db_alias, $table_alias);
$pdf = $this->_getPdf();
$attr = array(
'currentDb' => $db, 'currentTable' => $table,
'dbAlias' => $db_alias, 'tableAlias' => $table_alias,
'aliases' => $aliases
'currentDb' => $db,
'currentTable' => $table,
'dbAlias' => $db_alias,
'tableAlias' => $table_alias,
'aliases' => $aliases,
);
$pdf->setAttributes($attr);
$pdf->purpose = __('Dumping data');
@ -237,23 +246,23 @@ class ExportPdf extends ExportPlugin
/**
* Outputs table structure
*
* @param string $db database name
* @param string $table table name
* @param string $crlf the end of line sequence
* @param string $error_url the url to go back in case of error
* @param string $export_mode 'create_table', 'triggers', 'create_view',
* @param string $db database name
* @param string $table table name
* @param string $crlf the end of line sequence
* @param string $error_url the url to go back in case of error
* @param string $export_mode 'create_table', 'triggers', 'create_view',
* 'stand_in'
* @param string $export_type 'server', 'database', 'table'
* @param bool $do_relation whether to include relation comments
* @param bool $do_comments whether to include the pmadb-style column
* @param string $export_type 'server', 'database', 'table'
* @param bool $do_relation whether to include relation comments
* @param bool $do_comments whether to include the pmadb-style column
* comments as comments in the structure;
* this is deprecated but the parameter is
* left here because export.php calls
* PMA_exportStructure() also for other
* export types which use this parameter
* @param bool $do_mime whether to include mime comments
* @param bool $dates whether to include creation/update/check dates
* @param array $aliases aliases for db/table/columns
* @param bool $do_mime whether to include mime comments
* @param bool $dates whether to include creation/update/check dates
* @param array $aliases aliases for db/table/columns
*
* @return bool Whether it succeeded
*/
@ -275,7 +284,7 @@ class ExportPdf extends ExportPlugin
$this->initAlias($aliases, $db_alias, $table_alias);
$pdf = $this->_getPdf();
// getting purpose to show at top
switch($export_mode) {
switch ($export_mode) {
case 'create_table':
$purpose = __('Table structure');
break;
@ -290,9 +299,12 @@ class ExportPdf extends ExportPlugin
} // end switch
$attr = array(
'currentDb' => $db, 'currentTable' => $table,
'dbAlias' => $db_alias, 'tableAlias' => $table_alias,
'aliases' => $aliases, 'purpose' => $purpose
'currentDb' => $db,
'currentTable' => $table,
'dbAlias' => $db_alias,
'tableAlias' => $table_alias,
'aliases' => $aliases,
'purpose' => $purpose,
);
$pdf->setAttributes($attr);
/**
@ -300,10 +312,16 @@ class ExportPdf extends ExportPlugin
* format, no option is present to take user input.
*/
$do_comments = true;
switch($export_mode) {
switch ($export_mode) {
case 'create_table':
$pdf->getTableDef(
$db, $table, $do_relation, $do_comments, $do_mime, false, $aliases
$db,
$table,
$do_relation,
$do_comments,
$do_mime,
false,
$aliases
);
break;
case 'triggers':
@ -311,7 +329,13 @@ class ExportPdf extends ExportPlugin
break;
case 'create_view':
$pdf->getTableDef(
$db, $table, $do_relation, $do_comments, $do_mime, false, $aliases
$db,
$table,
$do_relation,
$do_comments,
$do_mime,
false,
$aliases
);
break;
case 'stand_in':
@ -327,9 +351,8 @@ class ExportPdf extends ExportPlugin
/* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
/**
* Gets the PMA_ExportPdf instance
* Gets the PMA\libraries\plugins\export\PMA_ExportPdf instance
*
* @return PMA_ExportPdf
*/
@ -339,7 +362,7 @@ class ExportPdf extends ExportPlugin
}
/**
* Instantiates the PMA_ExportPdf class
* Instantiates the PMA\libraries\plugins\export\PMA_ExportPdf class
*
* @param PMA_ExportPdf $pdf The instance
*

View File

@ -6,12 +6,15 @@
* @package PhpMyAdmin-Export
* @subpackage PHP
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/* Get the export interface */
require_once 'libraries/plugins/ExportPlugin.class.php';
namespace PMA\libraries\plugins\export;
use ExportPlugin;
use ExportPluginProperties;
use HiddenPropertyItem;
use OptionsPropertyMainGroup;
use OptionsPropertyRootGroup;
use PMA;
/**
* Handles the export for the PHP Array class
@ -83,6 +86,7 @@ class ExportPhparray extends ExportPlugin
. ' * @version 0.2b' . $GLOBALS['crlf']
. ' */' . $GLOBALS['crlf'] . $GLOBALS['crlf']
);
return true;
}
@ -114,6 +118,7 @@ class ExportPhparray extends ExportPlugin
. '// Database ' . PMA\libraries\Util::backquote($db_alias)
. $GLOBALS['crlf'] . '//' . $GLOBALS['crlf']
);
return true;
}
@ -156,14 +161,21 @@ class ExportPhparray extends ExportPlugin
* @return bool Whether it succeeded
*/
public function exportData(
$db, $table, $crlf, $error_url, $sql_query, $aliases = array()
$db,
$table,
$crlf,
$error_url,
$sql_query,
$aliases = array()
) {
$db_alias = $db;
$table_alias = $table;
$this->initAlias($aliases, $db_alias, $table_alias);
$result = $GLOBALS['dbi']->query(
$sql_query, null, PMA\libraries\DatabaseInterface::QUERY_UNBUFFERED
$sql_query,
null,
PMA\libraries\DatabaseInterface::QUERY_UNBUFFERED
);
$columns_cnt = $GLOBALS['dbi']->numFields($result);
@ -178,14 +190,17 @@ class ExportPhparray extends ExportPlugin
// fix variable names (based on
// http://www.php.net/manual/language.variables.basics.php)
if (! preg_match(
if (!preg_match(
'/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/',
$table_alias
)) {
)
) {
// fix invalid characters in variable names by replacing them with
// underscores
$tablefixed = preg_replace(
'/[^a-zA-Z0-9_\x7f-\xff]/', '_', $table_alias
'/[^a-zA-Z0-9_\x7f-\xff]/',
'_',
$table_alias
);
// variable name must not start with a number or dash...
@ -223,11 +238,12 @@ class ExportPhparray extends ExportPlugin
}
$buffer .= $crlf . ');' . $crlf;
if (! PMA_exportOutputHandler($buffer)) {
if (!PMA_exportOutputHandler($buffer)) {
return false;
}
$GLOBALS['dbi']->freeResult($result);
return true;
}
}

View File

@ -6,12 +6,9 @@
* @package PhpMyAdmin-Export
* @subpackage Texy!text
*/
if (! defined('PHPMYADMIN')) {
exit;
}
namespace PMA\libraries\plugins\export;
/* Get the export interface */
require_once 'libraries/plugins/ExportPlugin.class.php';
use ExportPlugin;
/**
* Handles the export for the Texy! text class
@ -65,9 +62,9 @@ class ExportTexytext extends ExportPlugin
$leaf->setName("structure_or_data");
$leaf->setValues(
array(
'structure' => __('structure'),
'data' => __('data'),
'structure_and_data' => __('structure and data')
'structure' => __('structure'),
'data' => __('data'),
'structure_and_data' => __('structure and data'),
)
);
$dumpWhat->addProperty($leaf);
@ -129,6 +126,7 @@ class ExportTexytext extends ExportPlugin
if (empty($db_alias)) {
$db_alias = $db;
}
return PMA_exportOutputHandler(
'===' . __('Database') . ' ' . $db_alias . "\n\n"
);
@ -159,6 +157,7 @@ class ExportTexytext extends ExportPlugin
{
return true;
}
/**
* Outputs the content of a table in NHibernate format
*
@ -172,7 +171,12 @@ class ExportTexytext extends ExportPlugin
* @return bool Whether it succeeded
*/
public function exportData(
$db, $table, $crlf, $error_url, $sql_query, $aliases = array()
$db,
$table,
$crlf,
$error_url,
$sql_query,
$aliases = array()
) {
global $what;
@ -180,17 +184,20 @@ class ExportTexytext extends ExportPlugin
$table_alias = $table;
$this->initAlias($aliases, $db_alias, $table_alias);
if (! PMA_exportOutputHandler(
if (!PMA_exportOutputHandler(
'== ' . __('Dumping data for table') . ' ' . $table_alias . "\n\n"
)) {
)
) {
return false;
}
// Gets the data from the database
$result = $GLOBALS['dbi']->query(
$sql_query, null, PMA\libraries\DatabaseInterface::QUERY_UNBUFFERED
$result = $GLOBALS['dbi']->query(
$sql_query,
null,
PMA\libraries\DatabaseInterface::QUERY_UNBUFFERED
);
$fields_cnt = $GLOBALS['dbi']->numFields($result);
$fields_cnt = $GLOBALS['dbi']->numFields($result);
// If required, get fields name at the first line
if (isset($GLOBALS[$what . '_columns'])) {
@ -204,7 +211,7 @@ class ExportTexytext extends ExportPlugin
. htmlspecialchars(stripslashes($col_as));
} // end for
$text_output .= "\n|------\n";
if (! PMA_exportOutputHandler($text_output)) {
if (!PMA_exportOutputHandler($text_output)) {
return false;
}
} // end if
@ -213,7 +220,7 @@ class ExportTexytext extends ExportPlugin
while ($row = $GLOBALS['dbi']->fetchRow($result)) {
$text_output = '';
for ($j = 0; $j < $fields_cnt; $j++) {
if (! isset($row[$j]) || is_null($row[$j])) {
if (!isset($row[$j]) || is_null($row[$j])) {
$value = $GLOBALS[$what . '_null'];
} elseif ($row[$j] == '0' || $row[$j] != '') {
$value = $row[$j];
@ -222,11 +229,13 @@ class ExportTexytext extends ExportPlugin
}
$text_output .= '|'
. str_replace(
'|', '&#124;', htmlspecialchars($value)
'|',
'&#124;',
htmlspecialchars($value)
);
} // end for
$text_output .= "\n";
if (! PMA_exportOutputHandler($text_output)) {
if (!PMA_exportOutputHandler($text_output)) {
return false;
}
} // end while
@ -283,7 +292,9 @@ class ExportTexytext extends ExportPlugin
$col_as = $aliases[$db]['tables'][$view]['columns'][$col_as];
}
$text_output .= $this->formatOneColumnDefinition(
$column, $unique_keys, $col_as
$column,
$unique_keys,
$col_as
);
$text_output .= "\n";
} // end foreach
@ -294,23 +305,23 @@ class ExportTexytext extends ExportPlugin
/**
* Returns $table's CREATE definition
*
* @param string $db the database name
* @param string $table the table name
* @param string $crlf the end of line sequence
* @param string $error_url the url to go back in case of error
* @param bool $do_relation whether to include relation comments
* @param bool $do_comments whether to include the pmadb-style column
* @param string $db the database name
* @param string $table the table name
* @param string $crlf the end of line sequence
* @param string $error_url the url to go back in case of error
* @param bool $do_relation whether to include relation comments
* @param bool $do_comments whether to include the pmadb-style column
* comments as comments in the structure;
* this is deprecated but the parameter is
* left here because export.php calls
* $this->exportStructure() also for other
* export types which use this parameter
* @param bool $do_mime whether to include mime comments
* @param bool $show_dates whether to include creation/update/check dates
* @param bool $add_semicolon whether to add semicolon and end-of-line
* at the end
* @param bool $view whether we're handling a view
* @param array $aliases Aliases of db/table/columns
* @param bool $do_mime whether to include mime comments
* @param bool $show_dates whether to include creation/update/check dates
* @param bool $add_semicolon whether to add semicolon and end-of-line
* at the end
* @param bool $view whether we're handling a view
* @param array $aliases Aliases of db/table/columns
*
* @return string resulting schema
*/
@ -335,7 +346,7 @@ class ExportTexytext extends ExportPlugin
* Get the unique keys in the table
*/
$unique_keys = array();
$keys = $GLOBALS['dbi']->getTableIndexes($db, $table);
$keys = $GLOBALS['dbi']->getTableIndexes($db, $table);
foreach ($keys as $key) {
if ($key['Non_unique'] == 0) {
$unique_keys[] = $key['Column_name'];
@ -349,7 +360,7 @@ class ExportTexytext extends ExportPlugin
// Check if we can use Relations
list($res_rel, $have_rel) = PMA_getRelationsAndStatus(
$do_relation && ! empty($cfgRelation['relation']),
$do_relation && !empty($cfgRelation['relation']),
$db,
$table
);
@ -383,27 +394,34 @@ class ExportTexytext extends ExportPlugin
$col_as = $aliases[$db]['tables'][$table]['columns'][$col_as];
}
$text_output .= $this->formatOneColumnDefinition(
$column, $unique_keys, $col_as
$column,
$unique_keys,
$col_as
);
$field_name = $column['Field'];
if ($do_relation && $have_rel) {
$text_output .= '|' . htmlspecialchars(
$this->getRelationString($res_rel, $field_name, $db, $aliases)
);
$this->getRelationString(
$res_rel,
$field_name,
$db,
$aliases
)
);
}
if ($do_comments && $cfgRelation['commwork']) {
$text_output .= '|'
. (isset($comments[$field_name])
? htmlspecialchars($comments[$field_name])
: '');
? htmlspecialchars($comments[$field_name])
: '');
}
if ($do_mime && $cfgRelation['mimework']) {
$text_output .= '|'
. (isset($mime_map[$field_name])
? htmlspecialchars(
str_replace('_', '/', $mime_map[$field_name]['mimetype'])
)
: '');
? htmlspecialchars(
str_replace('_', '/', $mime_map[$field_name]['mimetype'])
)
: '');
}
$text_output .= "\n";
@ -450,23 +468,23 @@ class ExportTexytext extends ExportPlugin
/**
* Outputs table's structure
*
* @param string $db database name
* @param string $table table name
* @param string $crlf the end of line sequence
* @param string $error_url the url to go back in case of error
* @param string $export_mode 'create_table', 'triggers', 'create_view',
* 'stand_in'
* @param string $export_type 'server', 'database', 'table'
* @param bool $do_relation whether to include relation comments
* @param bool $do_comments whether to include the pmadb-style column
* @param string $db database name
* @param string $table table name
* @param string $crlf the end of line sequence
* @param string $error_url the url to go back in case of error
* @param string $export_mode 'create_table', 'triggers', 'create_view',
* 'stand_in'
* @param string $export_type 'server', 'database', 'table'
* @param bool $do_relation whether to include relation comments
* @param bool $do_comments whether to include the pmadb-style column
* comments as comments in the structure;
* this is deprecated but the parameter is
* left here because export.php calls
* $this->exportStructure() also for other
* export types which use this parameter
* @param bool $do_mime whether to include mime comments
* @param bool $dates whether to include creation/update/check dates
* @param array $aliases Aliases of db/table/columns
* @param bool $do_mime whether to include mime comments
* @param bool $dates whether to include creation/update/check dates
* @param array $aliases Aliases of db/table/columns
*
* @return bool Whether it succeeded
*/
@ -488,13 +506,22 @@ class ExportTexytext extends ExportPlugin
$this->initAlias($aliases, $db_alias, $table_alias);
$dump = '';
switch($export_mode) {
switch ($export_mode) {
case 'create_table':
$dump .= '== ' . __('Table structure for table') . ' '
. $table_alias . "\n\n";
$dump .= $this->getTableDef(
$db, $table, $crlf, $error_url, $do_relation, $do_comments,
$do_mime, $dates, true, false, $aliases
$db,
$table,
$crlf,
$error_url,
$do_relation,
$do_comments,
$do_mime,
$dates,
true,
false,
$aliases
);
break;
case 'triggers':
@ -508,12 +535,21 @@ class ExportTexytext extends ExportPlugin
case 'create_view':
$dump .= '== ' . __('Structure for view') . ' ' . $table_alias . "\n\n";
$dump .= $this->getTableDef(
$db, $table, $crlf, $error_url, $do_relation, $do_comments,
$do_mime, $dates, true, true, $aliases
$db,
$table,
$crlf,
$error_url,
$do_relation,
$do_comments,
$do_mime,
$dates,
true,
true,
$aliases
);
break;
case 'stand_in':
$dump .= '== ' . __('Stand-in structure for view')
$dump .= '== ' . __('Stand-in structure for view')
. ' ' . $table . "\n\n";
// export a stand-in definition to resolve view dependencies
$dump .= $this->getTableDefStandIn($db, $table, $crlf, $aliases);
@ -532,7 +568,9 @@ class ExportTexytext extends ExportPlugin
* @return string Formatted column definition
*/
public function formatOneColumnDefinition(
$column, $unique_keys, $col_alias = ''
$column,
$unique_keys,
$col_alias = ''
) {
if (empty($col_alias)) {
$col_alias = $column['Field'];
@ -541,10 +579,10 @@ class ExportTexytext extends ExportPlugin
= PMA\libraries\Util::extractColumnSpec($column['Type']);
$type = $extracted_columnspec['print_type'];
if (empty($type)) {
$type = '&nbsp;';
$type = '&nbsp;';
}
if (! isset($column['Default'])) {
if (!isset($column['Default'])) {
if ($column['Null'] != 'NO') {
$column['Default'] = 'NULL';
}
@ -556,7 +594,7 @@ class ExportTexytext extends ExportPlugin
$fmt_pre = '**' . $fmt_pre;
$fmt_post = $fmt_post . '**';
}
if ($column['Key']=='PRI') {
if ($column['Key'] == 'PRI') {
$fmt_pre = '//' . $fmt_pre;
$fmt_post = $fmt_post . '//';
}
@ -565,11 +603,12 @@ class ExportTexytext extends ExportPlugin
$definition .= '|' . htmlspecialchars($type);
$definition .= '|'
. (($column['Null'] == '' || $column['Null'] == 'NO')
? __('No') : __('Yes'));
? __('No') : __('Yes'));
$definition .= '|'
. htmlspecialchars(
isset($column['Default']) ? $column['Default'] : ''
);
return $definition;
}
}

View File

@ -6,17 +6,14 @@
* @package PhpMyAdmin-Export
* @subpackage XML
*/
if (! defined('PHPMYADMIN')) {
exit;
}
namespace PMA\libraries\plugins\export;
if (!/*overload*/mb_strlen($GLOBALS['db'])) { /* Can't do server export */
$GLOBALS['skip_import'] = true;
return;
}
/* Get the export interface */
require_once 'libraries/plugins/ExportPlugin.class.php';
/**
* Handles the export for the XML class
*
@ -31,7 +28,6 @@ class ExportXml extends ExportPlugin
* @var string
*/
private $_table;
/**
* Table names
*
@ -101,7 +97,7 @@ class ExportXml extends ExportPlugin
$structure->setName("structure");
$structure->setText(__('Object creation options (all are recommended)'));
// create primary items and add them to the group
if (! PMA_DRIZZLE) {
if (!PMA_DRIZZLE) {
$leaf = new BoolPropertyItem();
$leaf->setName("export_events");
$leaf->setText(__('Events'));
@ -119,7 +115,7 @@ class ExportXml extends ExportPlugin
$leaf->setName("export_tables");
$leaf->setText(__('Tables'));
$structure->addProperty($leaf);
if (! PMA_DRIZZLE) {
if (!PMA_DRIZZLE) {
$leaf = new BoolPropertyItem();
$leaf->setName("export_triggers");
$leaf->setText(__('Triggers'));
@ -173,15 +169,15 @@ class ExportXml extends ExportPlugin
$charset = 'utf-8';
}
$head = '<?xml version="1.0" encoding="' . $charset . '"?>' . $crlf
. '<!--' . $crlf
. '- phpMyAdmin XML Dump' . $crlf
. '- version ' . PMA_VERSION . $crlf
. '- https://www.phpmyadmin.net' . $crlf
. '-' . $crlf
. '- ' . __('Host:') . ' ' . $cfg['Server']['host'];
if (! empty($cfg['Server']['port'])) {
$head .= ':' . $cfg['Server']['port'];
$head = '<?xml version="1.0" encoding="' . $charset . '"?>' . $crlf
. '<!--' . $crlf
. '- phpMyAdmin XML Dump' . $crlf
. '- version ' . PMA_VERSION . $crlf
. '- https://www.phpmyadmin.net' . $crlf
. '-' . $crlf
. '- ' . __('Host:') . ' ' . $cfg['Server']['host'];
if (!empty($cfg['Server']['port'])) {
$head .= ':' . $cfg['Server']['port'];
}
$head .= $crlf
. '- ' . __('Generation Time:') . ' '
@ -192,8 +188,8 @@ class ExportXml extends ExportPlugin
$head .= '<pma_xml_export version="1.0"'
. (($export_struct)
? ' xmlns:pma="http://www.phpmyadmin.net/some_doc_url/"'
: '')
? ' xmlns:pma="http://www.phpmyadmin.net/some_doc_url/"'
: '')
. '>' . $crlf;
if ($export_struct) {
@ -235,9 +231,10 @@ class ExportXml extends ExportPlugin
. PMA\libraries\Util::backquote($table),
0
);
$tbl = $result[$table][1];
$tbl = $result[$table][1];
$is_view = $GLOBALS['dbi']->getTable($db, $table)->isView();
$is_view = $GLOBALS['dbi']->getTable($db, $table)
->isView();
if ($is_view) {
$type = 'view';
@ -245,11 +242,11 @@ class ExportXml extends ExportPlugin
$type = 'table';
}
if ($is_view && ! isset($GLOBALS['xml_export_views'])) {
if ($is_view && !isset($GLOBALS['xml_export_views'])) {
continue;
}
if (! $is_view && ! isset($GLOBALS['xml_export_tables'])) {
if (!$is_view && !isset($GLOBALS['xml_export_tables'])) {
continue;
}
@ -274,7 +271,9 @@ class ExportXml extends ExportPlugin
. $trigger['name'] . '">' . $crlf;
// Do some formatting
$code = /*overload*/mb_substr(rtrim($code), 0, -3);
$code
= /*overload*/
mb_substr(rtrim($code), 0, -3);
$code = " " . htmlspecialchars($code);
$code = str_replace("\n", "\n ", $code);
@ -293,7 +292,8 @@ class ExportXml extends ExportPlugin
) {
// Export functions
$functions = $GLOBALS['dbi']->getProceduresOrFunctions(
$db, 'FUNCTION'
$db,
'FUNCTION'
);
if ($functions) {
foreach ($functions as $function) {
@ -302,7 +302,9 @@ class ExportXml extends ExportPlugin
// Do some formatting
$sql = $GLOBALS['dbi']->getDefinition(
$db, 'FUNCTION', $function
$db,
'FUNCTION',
$function
);
$sql = rtrim($sql);
$sql = " " . htmlspecialchars($sql);
@ -322,7 +324,8 @@ class ExportXml extends ExportPlugin
) {
// Export procedures
$procedures = $GLOBALS['dbi']->getProceduresOrFunctions(
$db, 'PROCEDURE'
$db,
'PROCEDURE'
);
if ($procedures) {
foreach ($procedures as $procedure) {
@ -331,7 +334,9 @@ class ExportXml extends ExportPlugin
// Do some formatting
$sql = $GLOBALS['dbi']->getDefinition(
$db, 'PROCEDURE', $procedure
$db,
'PROCEDURE',
$procedure
);
$sql = rtrim($sql);
$sql = " " . htmlspecialchars($sql);
@ -352,7 +357,8 @@ class ExportXml extends ExportPlugin
// Export events
$events = $GLOBALS['dbi']->fetchResult(
"SELECT EVENT_NAME FROM information_schema.EVENTS "
. "WHERE EVENT_SCHEMA='" . PMA\libraries\Util::sqlAddslashes($db) . "'"
. "WHERE EVENT_SCHEMA='" . PMA\libraries\Util::sqlAddslashes($db)
. "'"
);
if ($events) {
foreach ($events as $event) {
@ -360,7 +366,9 @@ class ExportXml extends ExportPlugin
. $event . '">' . $crlf;
$sql = $GLOBALS['dbi']->getDefinition(
$db, 'EVENT', $event
$db,
'EVENT',
$event
);
$sql = rtrim($sql);
$sql = " " . htmlspecialchars($sql);
@ -419,10 +427,10 @@ class ExportXml extends ExportPlugin
&& $GLOBALS['xml_export_contents']
) {
$head = ' <!--' . $crlf
. ' - ' . __('Database:') . ' ' . '\''
. $db_alias . '\'' . $crlf
. ' -->' . $crlf . ' <database name="'
. htmlspecialchars($db_alias) . '">' . $crlf;
. ' - ' . __('Database:') . ' ' . '\''
. $db_alias . '\'' . $crlf
. ' -->' . $crlf . ' <database name="'
. htmlspecialchars($db_alias) . '">' . $crlf;
return PMA_exportOutputHandler($head);
} else {
@ -477,7 +485,12 @@ class ExportXml extends ExportPlugin
* @return bool Whether it succeeded
*/
public function exportData(
$db, $table, $crlf, $error_url, $sql_query, $aliases = array()
$db,
$table,
$crlf,
$error_url,
$sql_query,
$aliases = array()
) {
$db_alias = $db;
$table_alias = $table;
@ -486,7 +499,9 @@ class ExportXml extends ExportPlugin
&& $GLOBALS['xml_export_contents']
) {
$result = $GLOBALS['dbi']->query(
$sql_query, null, PMA\libraries\DatabaseInterface::QUERY_UNBUFFERED
$sql_query,
null,
PMA\libraries\DatabaseInterface::QUERY_UNBUFFERED
);
$columns_cnt = $GLOBALS['dbi']->numFields($result);
@ -498,7 +513,7 @@ class ExportXml extends ExportPlugin
$buffer = ' <!-- ' . __('Table') . ' '
. $table_alias . ' -->' . $crlf;
if (! PMA_exportOutputHandler($buffer)) {
if (!PMA_exportOutputHandler($buffer)) {
return false;
}
@ -514,17 +529,17 @@ class ExportXml extends ExportPlugin
}
// If a cell is NULL, still export it to preserve
// the XML structure
if (! isset($record[$i]) || is_null($record[$i])) {
if (!isset($record[$i]) || is_null($record[$i])) {
$record[$i] = 'NULL';
}
$buffer .= ' <column name="'
. htmlspecialchars($col_as) . '">'
. htmlspecialchars((string)$record[$i])
. '</column>' . $crlf;
. '</column>' . $crlf;
}
$buffer .= ' </table>' . $crlf;
$buffer .= ' </table>' . $crlf;
if (! PMA_exportOutputHandler($buffer)) {
if (!PMA_exportOutputHandler($buffer)) {
return false;
}
}
@ -537,7 +552,6 @@ class ExportXml extends ExportPlugin
/* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
/**
* Gets the table name
*

View File

@ -6,12 +6,15 @@
* @package PhpMyAdmin-Export
* @subpackage YAML
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/* Get the export interface */
require_once 'libraries/plugins/ExportPlugin.class.php';
namespace PMA\libraries\plugins\export;
use ExportPlugin;
use ExportPluginProperties;
use HiddenPropertyItem;
use OptionsPropertyMainGroup;
use OptionsPropertyRootGroup;
use PMA;
/**
* Handles the export for the YAML format
@ -80,6 +83,7 @@ class ExportYaml extends ExportPlugin
PMA_exportOutputHandler(
'%YAML 1.1' . $GLOBALS['crlf'] . '---' . $GLOBALS['crlf']
);
return true;
}
@ -91,6 +95,7 @@ class ExportYaml extends ExportPlugin
public function exportFooter()
{
PMA_exportOutputHandler('...' . $GLOBALS['crlf']);
return true;
}
@ -146,13 +151,20 @@ class ExportYaml extends ExportPlugin
* @return bool Whether it succeeded
*/
public function exportData(
$db, $table, $crlf, $error_url, $sql_query, $aliases = array()
$db,
$table,
$crlf,
$error_url,
$sql_query,
$aliases = array()
) {
$db_alias = $db;
$table_alias = $table;
$this->initAlias($aliases, $db_alias, $table_alias);
$result = $GLOBALS['dbi']->query(
$sql_query, null, PMA\libraries\DatabaseInterface::QUERY_UNBUFFERED
$sql_query,
null,
PMA\libraries\DatabaseInterface::QUERY_UNBUFFERED
);
$columns_cnt = $GLOBALS['dbi']->numFields($result);
@ -179,7 +191,7 @@ class ExportYaml extends ExportPlugin
}
for ($i = 0; $i < $columns_cnt; $i++) {
if (! isset($record[$i])) {
if (!isset($record[$i])) {
continue;
}
@ -189,7 +201,7 @@ class ExportYaml extends ExportPlugin
}
if (is_numeric($record[$i])) {
$buffer .= ' ' . $columns[$i] . ': ' . $record[$i] . $crlf;
$buffer .= ' ' . $columns[$i] . ': ' . $record[$i] . $crlf;
continue;
}
@ -201,7 +213,7 @@ class ExportYaml extends ExportPlugin
$buffer .= ' ' . $columns[$i] . ': "' . $record[$i] . '"' . $crlf;
}
if (! PMA_exportOutputHandler($buffer)) {
if (!PMA_exportOutputHandler($buffer)) {
return false;
}
}

View File

@ -1,16 +1,16 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* TableProperty class
* PMA\libraries\plugins\export\TableProperty class
*
* @package PhpMyAdmin-Export
* @subpackage PDF
*/
use PMA\libraries\PDF;
namespace PMA\libraries\plugins\export;
if (! defined('PHPMYADMIN')) {
exit;
}
use PMA\libraries\PDF;
use PMA\libraries\Util;
use TCPDF_STATIC;
/**
* Adapted from a LGPL script by Philip Clarke
@ -41,7 +41,7 @@ class PMA_ExportPdf extends PDF
}
$current_page = $this->page;
if ((($y + $h) > $this->PageBreakTrigger)
AND (! $this->InFooter)
AND (!$this->InFooter)
AND ($this->AcceptPageBreak())
) {
if ($addpage) {
@ -56,7 +56,7 @@ class PMA_ExportPdf extends PDF
$this_page_olm = $this->pagedim[$this->page]['olm'];
$old_page_olm = $this->pagedim[$oldpage]['olm'];
if ($this->rtl) {
if ($this_page_orm!= $old_page_orm) {
if ($this_page_orm != $old_page_orm) {
$this->x = $x - ($this_page_orm - $old_page_orm);
} else {
$this->x = $x;
@ -69,12 +69,14 @@ class PMA_ExportPdf extends PDF
}
}
}
return true;
}
if ($current_page != $this->page) {
// account for columns mode
return true;
}
return false;
}
@ -92,19 +94,19 @@ class PMA_ExportPdf extends PDF
// FIXME: Better approach might be to try to compact the content
$this->SetAutoPageBreak(false);
// Check if header for this page already exists
if (! isset($this->headerset[$this->page])) {
if (!isset($this->headerset[$this->page])) {
$fullwidth = 0;
foreach ($this->tablewidths as $width) {
$fullwidth += $width;
}
$this->SetY(($this->tMargin) - ($this->FontSizePt / $this->k) * 5);
$this->cellFontSize = $this->FontSizePt ;
$this->cellFontSize = $this->FontSizePt;
$this->SetFont(
PMA_PDF_FONT,
'',
($this->titleFontSize
? $this->titleFontSize
: $this->FontSizePt)
? $this->titleFontSize
: $this->FontSizePt)
);
$this->Cell(0, $this->FontSizePt, $this->titleText, 0, 1, 'C');
$this->SetFont(PMA_PDF_FONT, '', $this->cellFontSize);
@ -115,7 +117,9 @@ class PMA_ExportPdf extends PDF
__('Database:') . ' ' . $this->dbAlias . ', '
. __('Table:') . ' ' . $this->tableAlias . ', '
. __('Purpose:') . ' ' . $this->purpose,
0, 1, 'L'
0,
1,
'L'
);
$l = ($this->lMargin);
foreach ($this->colTitles as $col => $txt) {
@ -125,8 +129,8 @@ class PMA_ExportPdf extends PDF
$this->FontSizePt,
$txt
);
$l += $this->tablewidths[$col] ;
$maxY = ($maxY < $this->getY()) ? $this->getY() : $maxY ;
$l += $this->tablewidths[$col];
$maxY = ($maxY < $this->getY()) ? $this->getY() : $maxY;
}
$this->SetXY($this->lMargin, $this->tMargin);
$this->setFillColor(200, 200, 200);
@ -135,7 +139,7 @@ class PMA_ExportPdf extends PDF
$this->SetXY($l, $this->tMargin);
$this->cell(
$this->tablewidths[$col],
$maxY-($this->tMargin),
$maxY - ($this->tMargin),
'',
1,
0,
@ -189,7 +193,7 @@ class PMA_ExportPdf extends PDF
while ($data = $GLOBALS['dbi']->fetchRow($this->results)) {
$this->page = $currpage;
// write the horizontal borders
$this->Line($l, $h, $fullwidth+$l, $h);
$this->Line($l, $h, $fullwidth + $l, $h);
// write the content and remember the height of the highest col
foreach ($data as $col => $txt) {
$this->page = $currpage;
@ -205,7 +209,7 @@ class PMA_ExportPdf extends PDF
$l += $this->tablewidths[$col];
}
if (! isset($tmpheight[$row . '-' . $this->page])) {
if (!isset($tmpheight[$row . '-' . $this->page])) {
$tmpheight[$row . '-' . $this->page] = 0;
}
if ($tmpheight[$row . '-' . $this->page] < $this->GetY()) {
@ -229,13 +233,13 @@ class PMA_ExportPdf extends PDF
// draw the borders
// we start adding a horizontal line on the last page
$this->page = $maxpage;
$this->Line($l, $h, $fullwidth+$l, $h);
$this->Line($l, $h, $fullwidth + $l, $h);
// now we start at the top of the document and walk down
for ($i = $startpage; $i <= $maxpage; $i++) {
$this->page = $i;
$l = $this->lMargin;
$t = ($i == $startpage) ? $startheight : $this->tMargin;
$lh = ($i == $maxpage) ? $h : $this->h-$this->bMargin;
$lh = ($i == $maxpage) ? $h : $this->h - $this->bMargin;
$this->Line($l, $t, $l, $lh);
foreach ($this->tablewidths as $width) {
$l += $width;
@ -256,7 +260,7 @@ class PMA_ExportPdf extends PDF
public function setAttributes($attr = array())
{
foreach ($attr as $key => $val) {
$this->$key = $val ;
$this->$key = $val;
}
}
@ -286,7 +290,8 @@ class PMA_ExportPdf extends PDF
$i = 0;
$triggers = $GLOBALS['dbi']->getTriggers($db, $table);
foreach ($triggers as $trigger) {
$i++; break;
$i++;
break;
}
if ($i == 0) {
return; //prevents printing blank trigger list for any table
@ -347,7 +352,7 @@ class PMA_ExportPdf extends PDF
$data[] = $trigger['definition'];
$this->page = $currpage;
// write the horizontal borders
$this->Line($l, $h, $fullwidth+$l, $h);
$this->Line($l, $h, $fullwidth + $l, $h);
// write the content and remember the height of the highest col
foreach ($data as $col => $txt) {
$this->page = $currpage;
@ -363,7 +368,7 @@ class PMA_ExportPdf extends PDF
$l += $this->tablewidths[$col];
}
if (! isset($tmpheight[$row . '-' . $this->page])) {
if (!isset($tmpheight[$row . '-' . $this->page])) {
$tmpheight[$row . '-' . $this->page] = 0;
}
if ($tmpheight[$row . '-' . $this->page] < $this->GetY()) {
@ -385,13 +390,13 @@ class PMA_ExportPdf extends PDF
// draw the borders
// we start adding a horizontal line on the last page
$this->page = $maxpage;
$this->Line($l, $h, $fullwidth+$l, $h);
$this->Line($l, $h, $fullwidth + $l, $h);
// now we start at the top of the document and walk down
for ($i = $startpage; $i <= $maxpage; $i++) {
$this->page = $i;
$l = $this->lMargin;
$t = ($i == $startpage) ? $startheight : $this->tMargin;
$lh = ($i == $maxpage) ? $h : $this->h-$this->bMargin;
$lh = ($i == $maxpage) ? $h : $this->h - $this->bMargin;
$this->Line($l, $t, $l, $lh);
foreach ($this->tablewidths as $width) {
$l += $width;
@ -405,18 +410,18 @@ class PMA_ExportPdf extends PDF
/**
* Print $table's CREATE definition
*
* @param string $db the database name
* @param string $table the table name
* @param bool $do_relation whether to include relation comments
* @param bool $do_comments whether to include the pmadb-style column
* @param string $db the database name
* @param string $table the table name
* @param bool $do_relation whether to include relation comments
* @param bool $do_comments whether to include the pmadb-style column
* comments as comments in the structure;
* this is deprecated but the parameter is
* left here because export.php calls
* PMA_exportStructure() also for other
* export types which use this parameter
* @param bool $do_mime whether to include mime comments
* @param bool $view whether we're handling a view
* @param array $aliases aliases of db/table/columns
* @param bool $do_mime whether to include mime comments
* @param bool $view whether we're handling a view
* @param array $aliases aliases of db/table/columns
*
* @return void
*/
@ -458,7 +463,7 @@ class PMA_ExportPdf extends PDF
$res_rel = PMA_getForeigners($db, $table);
$have_rel = !empty($res_rel);
} else {
$have_rel = false;
$have_rel = false;
} // end if
//column count and table heading
@ -546,14 +551,14 @@ class PMA_ExportPdf extends PDF
// fun begin
foreach ($columns as $column) {
$extracted_columnspec
= PMA\libraries\Util::extractColumnSpec($column['Type']);
= Util::extractColumnSpec($column['Type']);
$type = $extracted_columnspec['print_type'];
if (empty($type)) {
$type = ' ';
}
if (! isset($column['Default'])) {
if (!isset($column['Default'])) {
if ($column['Null'] != 'NO') {
$column['Default'] = 'NULL';
}
@ -569,15 +574,15 @@ class PMA_ExportPdf extends PDF
if ($do_relation && $have_rel) {
$data [] = isset($res_rel[$field_name])
? $res_rel[$field_name]['foreign_table']
. ' (' . $res_rel[$field_name]['foreign_field']
. ')'
: '';
? $res_rel[$field_name]['foreign_table']
. ' (' . $res_rel[$field_name]['foreign_field']
. ')'
: '';
}
if ($do_comments) {
$data [] = isset($comments[$field_name])
? $comments[$field_name]
: '';
? $comments[$field_name]
: '';
}
if ($do_mime) {
$data [] = isset($mime_map[$field_name])
@ -587,7 +592,7 @@ class PMA_ExportPdf extends PDF
$this->page = $currpage;
// write the horizontal borders
$this->Line($l, $h, $fullwidth+$l, $h);
$this->Line($l, $h, $fullwidth + $l, $h);
// write the content and remember the height of the highest col
foreach ($data as $col => $txt) {
$this->page = $currpage;
@ -603,7 +608,7 @@ class PMA_ExportPdf extends PDF
$l += $this->tablewidths[$col];
}
if (! isset($tmpheight[$row . '-' . $this->page])) {
if (!isset($tmpheight[$row . '-' . $this->page])) {
$tmpheight[$row . '-' . $this->page] = 0;
}
if ($tmpheight[$row . '-' . $this->page] < $this->GetY()) {
@ -622,18 +627,17 @@ class PMA_ExportPdf extends PDF
$currpage = $maxpage;
unset($data);
$row++;
}
// draw the borders
// we start adding a horizontal line on the last page
$this->page = $maxpage;
$this->Line($l, $h, $fullwidth+$l, $h);
$this->Line($l, $h, $fullwidth + $l, $h);
// now we start at the top of the document and walk down
for ($i = $startpage; $i <= $maxpage; $i++) {
$this->page = $i;
$l = $this->lMargin;
$t = ($i == $startpage) ? $startheight : $this->tMargin;
$lh = ($i == $maxpage) ? $h : $this->h-$this->bMargin;
$lh = ($i == $maxpage) ? $h : $this->h - $this->bMargin;
$this->Line($l, $t, $l, $lh);
foreach ($this->tablewidths as $width) {
$l += $width;
@ -664,9 +668,11 @@ class PMA_ExportPdf extends PDF
* Pass 1 for column widths
*/
$this->results = $GLOBALS['dbi']->query(
$query, null, PMA\libraries\DatabaseInterface::QUERY_UNBUFFERED
$query,
null,
PMA\libraries\DatabaseInterface::QUERY_UNBUFFERED
);
$this->numFields = $GLOBALS['dbi']->numFields($this->results);
$this->numFields = $GLOBALS['dbi']->numFields($this->results);
$this->fields = $GLOBALS['dbi']->getFieldsMeta($this->results);
// sColWidth = starting col width (an average size width)
@ -687,7 +693,7 @@ class PMA_ExportPdf extends PDF
if (!empty($this->aliases[$db]['tables'][$table]['columns'][$col_as])) {
$col_as = $this->aliases[$db]['tables'][$table]['columns'][$col_as];
}
$stringWidth = $this->getstringwidth($col_as) + 6 ;
$stringWidth = $this->getstringwidth($col_as) + 6;
// save the real title's width
$titleWidth[$i] = $stringWidth;
$totalTitleWidth += $stringWidth;
@ -695,7 +701,7 @@ class PMA_ExportPdf extends PDF
// set any column titles less than the start width to
// the column title width
if ($stringWidth < $this->sColWidth) {
$colFits[$i] = $stringWidth ;
$colFits[$i] = $stringWidth;
}
$this->colTitles[$i] = $col_as;
$this->display_column[$i] = true;
@ -738,11 +744,11 @@ class PMA_ExportPdf extends PDF
// loop through the data; any column whose contents
// is greater than the column size is resized
/**
* @todo force here a LIMIT to avoid reading all rows
*/
* @todo force here a LIMIT to avoid reading all rows
*/
while ($row = $GLOBALS['dbi']->fetchRow($this->results)) {
foreach ($colFits as $key => $val) {
$stringWidth = $this->getstringwidth($row[$key]) + 6 ;
$stringWidth = $this->getstringwidth($row[$key]) + 6;
if ($adjustingMode && ($stringWidth > $this->sColWidth)) {
// any column whose data's width is bigger than
// the start width is now discarded
@ -754,7 +760,7 @@ class PMA_ExportPdf extends PDF
if ($stringWidth > $val
&& $stringWidth < ($this->sColWidth * 3)
) {
$colFits[$key] = $stringWidth ;
$colFits[$key] = $stringWidth;
}
}
}
@ -776,7 +782,7 @@ class PMA_ExportPdf extends PDF
}
for ($i = 0; $i < $this->numFields; $i++) {
if (! in_array($i, array_keys($colFits))) {
if (!in_array($i, array_keys($colFits))) {
$this->tablewidths[$i] = $this->sColWidth + $surplusToAdd;
}
if ($this->display_column[$i] == false) {
@ -791,14 +797,14 @@ class PMA_ExportPdf extends PDF
// Pass 2
$this->results = $GLOBALS['dbi']->query(
$query, null, PMA\libraries\DatabaseInterface::QUERY_UNBUFFERED
$query,
null,
PMA\libraries\DatabaseInterface::QUERY_UNBUFFERED
);
$this->setY($this->tMargin);
$this->AddPage();
$this->SetFont(PMA_PDF_FONT, '', 9);
$this->morepagestable($this->FontSizePt);
$GLOBALS['dbi']->freeResult($this->results);
} // end of mysqlReport function
} // end of PMA_Export_PDF class

View File

@ -15,9 +15,6 @@ if (! defined('PHPMYADMIN')) {
exit;
}
/* Get the export interface */
require_once 'libraries/plugins/ExportPlugin.class.php';
/**
* Handles the export for the [Name] format
*

View File

@ -1,17 +1,15 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Holds the TableProperty class
* Holds the PMA\libraries\plugins\export\TableProperty class
*
* @package PhpMyAdmin-Export
* @subpackage CodeGen
*/
if (! defined('PHPMYADMIN')) {
exit;
}
namespace PMA\libraries\plugins\export;
/**
* TableProperty class
* PMA\libraries\plugins\export\TableProperty class
*
* @package PhpMyAdmin-Export
* @subpackage CodeGen

View File

@ -1,23 +1,19 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for AuthenticationConfig class
* tests for PMA\libraries\plugins\auth\AuthenticationConfig class
*
* @package PhpMyAdmin-test
*/
require_once 'libraries/plugins/auth/AuthenticationConfig.class.php';
use PMA\libraries\plugins\auth\AuthenticationConfig;
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/config.default.php';
require_once 'libraries/js_escape.lib.php';
/**
* tests for AuthenticationConfig class
* tests for PMA\libraries\plugins\auth\AuthenticationConfig class
*
* @package PhpMyAdmin-test
*/
@ -52,7 +48,7 @@ class PMA_AuthenticationConfig_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for AuthenticationConfig::auth
* Test for PMA\libraries\plugins\auth\AuthenticationConfig::auth
*
* @return void
*/
@ -64,7 +60,7 @@ class PMA_AuthenticationConfig_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for AuthenticationConfig::authCheck
* Test for PMA\libraries\plugins\auth\AuthenticationConfig::authCheck
*
* @return void
*/
@ -76,7 +72,7 @@ class PMA_AuthenticationConfig_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for AuthenticationConfig::authSetUser
* Test for PMA\libraries\plugins\auth\AuthenticationConfig::authSetUser
*
* @return void
*/
@ -88,7 +84,7 @@ class PMA_AuthenticationConfig_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for AuthenticationConfig::authFails
* Test for PMA\libraries\plugins\auth\AuthenticationConfig::authFails
*
* @return void
*/

View File

@ -1,31 +1,25 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for AuthenticationCookie class
* tests for PMA\libraries\plugins\auth\AuthenticationCookie class
*
* @package PhpMyAdmin-test
*/
use PMA\libraries\plugins\auth\AuthenticationCookie;
use PMA\libraries\Theme;
$GLOBALS['PMA_Config'] = new PMA\libraries\Config();
require_once 'libraries/plugins/auth/AuthenticationCookie.class.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/config.default.php';
require_once 'libraries/js_escape.lib.php';
require_once 'libraries/sanitizing.lib.php';
require_once 'libraries/database_interface.inc.php';
require_once 'libraries/select_lang.lib.php';
/**
* tests for AuthenticationCookie class
* tests for PMA\libraries\plugins\auth\AuthenticationCookie class
*
* @package PhpMyAdmin-test
*/
@ -69,7 +63,7 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for AuthenticationConfig::auth
* Test for PMA\libraries\plugins\auth\AuthenticationConfig::auth
*
* @return void
* @group medium
@ -360,7 +354,7 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for AuthenticationConfig::auth with headers
* Test for PMA\libraries\plugins\auth\AuthenticationConfig::auth with headers
*
* @return void
*/
@ -404,7 +398,7 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for AuthenticationConfig::authCheck
* Test for PMA\libraries\plugins\auth\AuthenticationConfig::authCheck
*
* @return void
*/
@ -551,7 +545,7 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for AuthenticationConfig::authCheck with constant modifications
* Test for PMA\libraries\plugins\auth\AuthenticationConfig::authCheck with constant modifications
*
* @return void
*/
@ -598,7 +592,7 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for AuthenticationConfig::authCheck (mock blowfish functions reqd)
* Test for PMA\libraries\plugins\auth\AuthenticationConfig::authCheck (mock blowfish functions reqd)
*
* @return void
*/
@ -616,7 +610,7 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase
$_SESSION['last_valid_captcha'] = true;
// mock for blowfish function
$this->object = $this->getMockBuilder('AuthenticationCookie')
$this->object = $this->getMockBuilder('PMA\libraries\plugins\auth\AuthenticationCookie')
->disableOriginalConstructor()
->setMethods(array('cookieDecrypt'))
->getMock();
@ -636,7 +630,7 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for AuthenticationConfig::authCheck (mocking blowfish functions)
* Test for PMA\libraries\plugins\auth\AuthenticationConfig::authCheck (mocking blowfish functions)
*
* @return void
*/
@ -656,7 +650,7 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase
$GLOBALS['cfg']['LoginCookieValidity'] = 1440;
// mock for blowfish function
$this->object = $this->getMockBuilder('AuthenticationCookie')
$this->object = $this->getMockBuilder('PMA\libraries\plugins\auth\AuthenticationCookie')
->disableOriginalConstructor()
->setMethods(array('cookieDecrypt'))
->getMock();
@ -681,7 +675,7 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for AuthenticationConfig::authCheck (mocking the object itself)
* Test for PMA\libraries\plugins\auth\AuthenticationConfig::authCheck (mocking the object itself)
*
* @return void
*/
@ -700,7 +694,7 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase
$GLOBALS['cfg']['LoginCookieValidity'] = 0;
$_SESSION['last_access_time'] = -1;
// mock for blowfish function
$this->object = $this->getMockBuilder('AuthenticationCookie')
$this->object = $this->getMockBuilder('PMA\libraries\plugins\auth\AuthenticationCookie')
->disableOriginalConstructor()
->setMethods(array('authFails'))
->getMock();
@ -718,7 +712,7 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for AuthenticationConfig::authSetUser
* Test for PMA\libraries\plugins\auth\AuthenticationConfig::authSetUser
*
* @return void
*/
@ -775,7 +769,7 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for AuthenticationConfig::authSetUser (check for headers redirect)
* Test for PMA\libraries\plugins\auth\AuthenticationConfig::authSetUser (check for headers redirect)
*
* @return void
*/
@ -850,7 +844,7 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for AuthenticationConfig::authFails
* Test for PMA\libraries\plugins\auth\AuthenticationConfig::authFails
*
* @return void
*/
@ -862,7 +856,7 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase
);
}
$this->object = $this->getMockBuilder('AuthenticationCookie')
$this->object = $this->getMockBuilder('PMA\libraries\plugins\auth\AuthenticationCookie')
->disableOriginalConstructor()
->setMethods(array('auth'))
->getMock();
@ -955,14 +949,14 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for AuthenticationConfig::_getEncryptionSecret
* Test for PMA\libraries\plugins\auth\AuthenticationConfig::_getEncryptionSecret
*
* @return void
*/
public function testGetEncryptionSecret()
{
$method = new \ReflectionMethod(
'AuthenticationCookie',
'PMA\libraries\plugins\auth\AuthenticationCookie',
'_getEncryptionSecret'
);
$method->setAccessible(true);
@ -997,7 +991,7 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for AuthenticationConfig::cookieEncrypt
* Test for PMA\libraries\plugins\auth\AuthenticationConfig::cookieEncrypt
*
* @return void
*/
@ -1012,7 +1006,7 @@ class PMA_AuthenticationCookie_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for AuthenticationConfig::cookieDecrypt
* Test for PMA\libraries\plugins\auth\AuthenticationConfig::cookieDecrypt
*
* @return void
*/

View File

@ -1,24 +1,19 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for AuthenticationHttp class
* tests for PMA\libraries\plugins\auth\AuthenticationHttp class
*
* @package PhpMyAdmin-test
*/
require_once 'libraries/plugins/auth/AuthenticationHttp.class.php';
use PMA\libraries\plugins\auth\AuthenticationHttp;
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/config.default.php';
require_once 'libraries/sanitizing.lib.php';
/**
* tests for AuthenticationHttp class
* tests for PMA\libraries\plugins\auth\AuthenticationHttp class
*
* @package PhpMyAdmin-test
*/
@ -61,7 +56,7 @@ class PMA_AuthenticationHttp_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for AuthenticationHttp::auth
* Test for PMA\libraries\plugins\auth\AuthenticationHttp::auth
*
* @return void
*/
@ -201,7 +196,7 @@ class PMA_AuthenticationHttp_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for AuthenticationHttp::authCheck
* Test for PMA\libraries\plugins\auth\AuthenticationHttp::authCheck
*
* @param string $user test username
* @param string $pass test password
@ -303,7 +298,7 @@ class PMA_AuthenticationHttp_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for AuthenticationHttp::authSetUser
* Test for PMA\libraries\plugins\auth\AuthenticationHttp::authSetUser
*
* @return void
*/
@ -411,7 +406,7 @@ class PMA_AuthenticationHttp_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for AuthenticationHttp::authSetFails
* Test for PMA\libraries\plugins\auth\AuthenticationHttp::authSetFails
*
* @return void
*
@ -448,7 +443,7 @@ class PMA_AuthenticationHttp_Test extends PHPUnit_Framework_TestCase
$result
);
$this->object = $this->getMockBuilder('AuthenticationHttp')
$this->object = $this->getMockBuilder('PMA\libraries\plugins\auth\AuthenticationHttp')
->disableOriginalConstructor()
->setMethods(array('authForm'))
->getMock();

View File

@ -1,24 +1,19 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for AuthenticationSignon class
* tests for PMA\libraries\plugins\auth\AuthenticationSignon class
*
* @package PhpMyAdmin-test
*/
require_once 'libraries/plugins/auth/AuthenticationSignon.class.php';
use PMA\libraries\plugins\auth\AuthenticationSignon;
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/config.default.php';
require_once 'libraries/sanitizing.lib.php';
/**
* tests for AuthenticationSignon class
* tests for PMA\libraries\plugins\auth\AuthenticationSignon class
*
* @package PhpMyAdmin-test
*/
@ -50,7 +45,7 @@ class PMA_AuthenticationSignon_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for AuthenticationSignon::auth
* Test for PMA\libraries\plugins\auth\AuthenticationSignon::auth
*
* @return void
*/
@ -104,7 +99,7 @@ class PMA_AuthenticationSignon_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for AuthenticationSignon::authCheck
* Test for PMA\libraries\plugins\auth\AuthenticationSignon::authCheck
*
* @return void
*/
@ -216,7 +211,7 @@ class PMA_AuthenticationSignon_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for AuthenticationSignon::authSetUser
* Test for PMA\libraries\plugins\auth\AuthenticationSignon::authSetUser
*
* @return void
*/
@ -241,7 +236,7 @@ class PMA_AuthenticationSignon_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for AuthenticationSignon::authFails
* Test for PMA\libraries\plugins\auth\AuthenticationSignon::authFails
*
* @return void
*/
@ -250,7 +245,7 @@ class PMA_AuthenticationSignon_Test extends PHPUnit_Framework_TestCase
$GLOBALS['cfg']['Server']['SignonSession'] = 'newSession';
$_COOKIE['newSession'] = '42';
$this->object = $this->getMockBuilder('AuthenticationSignon')
$this->object = $this->getMockBuilder('PMA\libraries\plugins\auth\AuthenticationSignon')
->disableOriginalConstructor()
->setMethods(array('auth'))
->getMock();

View File

@ -1,21 +1,18 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for ExportCodegen class
* tests for PMA\libraries\plugins\export\ExportCodegen class
*
* @package PhpMyAdmin-test
*/
use PMA\libraries\plugins\export\ExportCodegen;
require_once 'libraries/export.lib.php';
require_once 'libraries/plugins/export/ExportCodegen.class.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/config.default.php';
require_once 'export.php';
/**
* tests for ExportCodegen class
* tests for PMA\libraries\plugins\export\ExportCodegen class
*
* @package PhpMyAdmin-test
* @group medium
@ -46,21 +43,21 @@ class PMA_ExportCodegen_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportCodegen::initSpecificVariables
* Test for PMA\libraries\plugins\export\ExportCodegen::initSpecificVariables
*
* @return void
*/
public function testInitSpecificVariables()
{
$method = new ReflectionMethod('ExportCodegen', 'initSpecificVariables');
$method = new ReflectionMethod('PMA\libraries\plugins\export\ExportCodegen', 'initSpecificVariables');
$method->setAccessible(true);
$method->invoke($this->object, null);
$attrCgFormats = new ReflectionProperty('ExportCodegen', '_cgFormats');
$attrCgFormats = new ReflectionProperty('PMA\libraries\plugins\export\ExportCodegen', '_cgFormats');
$attrCgFormats->setAccessible(true);
$attrCgHandlers = new ReflectionProperty('ExportCodegen', '_cgHandlers');
$attrCgHandlers = new ReflectionProperty('PMA\libraries\plugins\export\ExportCodegen', '_cgHandlers');
$attrCgHandlers->setAccessible(true);
$this->assertEquals(
@ -81,17 +78,17 @@ class PMA_ExportCodegen_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportCodegen::setProperties
* Test for PMA\libraries\plugins\export\ExportCodegen::setProperties
*
* @return void
*/
public function testSetProperties()
{
$method = new ReflectionMethod('ExportCodegen', 'setProperties');
$method = new ReflectionMethod('PMA\libraries\plugins\export\ExportCodegen', 'setProperties');
$method->setAccessible(true);
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty('ExportCodegen', 'properties');
$attrProperties = new ReflectionProperty('PMA\libraries\plugins\export\ExportCodegen', 'properties');
$attrProperties->setAccessible(true);
$properties = $attrProperties->getValue($this->object);
@ -186,7 +183,7 @@ class PMA_ExportCodegen_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportCodegen::exportHeader
* Test for PMA\libraries\plugins\export\ExportCodegen::exportHeader
*
* @return void
*/
@ -198,7 +195,7 @@ class PMA_ExportCodegen_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportCodegen::exportFooter
* Test for PMA\libraries\plugins\export\ExportCodegen::exportFooter
*
* @return void
*/
@ -210,7 +207,7 @@ class PMA_ExportCodegen_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportCodegen::exportDBHeader
* Test for PMA\libraries\plugins\export\ExportCodegen::exportDBHeader
*
* @return void
*/
@ -222,7 +219,7 @@ class PMA_ExportCodegen_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportCodegen::exportDBFooter
* Test for PMA\libraries\plugins\export\ExportCodegen::exportDBFooter
*
* @return void
*/
@ -234,7 +231,7 @@ class PMA_ExportCodegen_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportCodegen::exportData
* Test for PMA\libraries\plugins\export\ExportCodegen::exportData
*
* @return void
*/
@ -290,7 +287,7 @@ class PMA_ExportCodegen_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportCodegen::cgMakeIdentifier
* Test for PMA\libraries\plugins\export\ExportCodegen::cgMakeIdentifier
*
* @return void
*/
@ -313,7 +310,7 @@ class PMA_ExportCodegen_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportCodegen::_handleNHibernateCSBody
* Test for PMA\libraries\plugins\export\ExportCodegen::_handleNHibernateCSBody
*
* @return void
*/
@ -339,7 +336,7 @@ class PMA_ExportCodegen_Test extends PHPUnit_Framework_TestCase
->will($this->returnValue(null));
$GLOBALS['dbi'] = $dbi;
$method = new ReflectionMethod('ExportCodegen', '_handleNHibernateCSBody');
$method = new ReflectionMethod('PMA\libraries\plugins\export\ExportCodegen', '_handleNHibernateCSBody');
$method->setAccessible(true);
$result = $method->invoke($this->object, 'db', 'table', "\n");
@ -378,7 +375,7 @@ class PMA_ExportCodegen_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportCodegen::_handleNHibernateXMLBody
* Test for PMA\libraries\plugins\export\ExportCodegen::_handleNHibernateXMLBody
*
* @return void
*/
@ -409,7 +406,7 @@ class PMA_ExportCodegen_Test extends PHPUnit_Framework_TestCase
->will($this->returnValue(null));
$GLOBALS['dbi'] = $dbi;
$method = new ReflectionMethod('ExportCodegen', '_handleNHibernateXMLBody');
$method = new ReflectionMethod('PMA\libraries\plugins\export\ExportCodegen', '_handleNHibernateXMLBody');
$method->setAccessible(true);
$result = $method->invoke($this->object, 'db', 'table', "\n");
@ -434,14 +431,14 @@ class PMA_ExportCodegen_Test extends PHPUnit_Framework_TestCase
/**
* Test for
* - ExportCodegen::_getCgFormats
* - ExportCodegen::_setCgFormats
* - PMA\libraries\plugins\export\ExportCodegen::_getCgFormats
* - PMA\libraries\plugins\export\ExportCodegen::_setCgFormats
*
* @return void
*/
public function testSetGetCgFormats()
{
$reflection = new ReflectionClass('ExportCodegen');
$reflection = new ReflectionClass('PMA\libraries\plugins\export\ExportCodegen');
$getter = $reflection->getMethod('_getCgFormats');
$setter = $reflection->getMethod('_setCgFormats');
@ -459,14 +456,14 @@ class PMA_ExportCodegen_Test extends PHPUnit_Framework_TestCase
/**
* Test for
* - ExportCodegen::_getCgHandlers
* - ExportCodegen::_setCgHandlers
* - PMA\libraries\plugins\export\ExportCodegen::_getCgHandlers
* - PMA\libraries\plugins\export\ExportCodegen::_setCgHandlers
*
* @return void
*/
public function testSetGetCgHandlers()
{
$reflection = new ReflectionClass('ExportCodegen');
$reflection = new ReflectionClass('PMA\libraries\plugins\export\ExportCodegen');
$getter = $reflection->getMethod('_getCgHandlers');
$setter = $reflection->getMethod('_setCgHandlers');

View File

@ -1,22 +1,18 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for ExportCsv class
* tests for PMA\libraries\plugins\export\ExportCsv class
*
* @package PhpMyAdmin-test
*/
require_once 'libraries/plugins/export/ExportCsv.class.php';
use PMA\libraries\plugins\export\ExportCsv;
require_once 'libraries/export.lib.php';
require_once 'libraries/config.default.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'export.php';
/**
* tests for ExportCsv class
* tests for PMA\libraries\plugins\export\ExportCsv class
*
* @package PhpMyAdmin-test
* @group medium
@ -47,17 +43,17 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportCsv::setProperties
* Test for PMA\libraries\plugins\export\ExportCsv::setProperties
*
* @return void
*/
public function testSetProperties()
{
$method = new ReflectionMethod('ExportCsv', 'setProperties');
$method = new ReflectionMethod('PMA\libraries\plugins\export\ExportCsv', 'setProperties');
$method->setAccessible(true);
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty('ExportCsv', 'properties');
$attrProperties = new ReflectionProperty('PMA\libraries\plugins\export\ExportCsv', 'properties');
$attrProperties->setAccessible(true);
$properties = $attrProperties->getValue($this->object);
@ -247,7 +243,7 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportCsv::exportHeader
* Test for PMA\libraries\plugins\export\ExportCsv::exportHeader
*
* @return void
*/
@ -424,7 +420,7 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportCsv::exportFooter
* Test for PMA\libraries\plugins\export\ExportCsv::exportFooter
*
* @return void
*/
@ -436,7 +432,7 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportCsv::exportDBHeader
* Test for PMA\libraries\plugins\export\ExportCsv::exportDBHeader
*
* @return void
*/
@ -448,7 +444,7 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportCsv::exportDBFooter
* Test for PMA\libraries\plugins\export\ExportCsv::exportDBFooter
*
* @return void
*/
@ -460,7 +456,7 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportCsv::exportDBCreate
* Test for PMA\libraries\plugins\export\ExportCsv::exportDBCreate
*
* @return void
*/
@ -472,7 +468,7 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportCsv::exportData
* Test for PMA\libraries\plugins\export\ExportCsv::exportData
*
* @return void
*/

View File

@ -1,20 +1,18 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for ExportExcel class
* tests for PMA\libraries\plugins\export\ExportExcel class
*
* @package PhpMyAdmin-test
*/
require_once 'libraries/plugins/export/ExportExcel.class.php';
use PMA\libraries\plugins\export\ExportExcel;
require_once 'libraries/export.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/config.default.php';
require_once 'export.php';
/**
* tests for ExportExcel class
* tests for PMA\libraries\plugins\export\ExportExcel class
*
* @package PhpMyAdmin-test
* @group medium
@ -45,17 +43,17 @@ class PMA_ExportExcel_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportExcel::setProperties
* Test for PMA\libraries\plugins\export\ExportExcel::setProperties
*
* @return void
*/
public function testSetProperties()
{
$method = new ReflectionMethod('ExportExcel', 'setProperties');
$method = new ReflectionMethod('PMA\libraries\plugins\export\ExportExcel', 'setProperties');
$method->setAccessible(true);
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty('ExportExcel', 'properties');
$attrProperties = new ReflectionProperty('PMA\libraries\plugins\export\ExportExcel', 'properties');
$attrProperties->setAccessible(true);
$properties = $attrProperties->getValue($this->object);

View File

@ -1,23 +1,20 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for ExportHtmlword class
* tests for PMA\libraries\plugins\export\ExportHtmlword class
*
* @package PhpMyAdmin-test
*/
require_once 'libraries/plugins/export/ExportHtmlword.class.php';
use PMA\libraries\plugins\export\ExportHtmlword;
require_once 'libraries/export.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/config.default.php';
require_once 'libraries/relation.lib.php';
require_once 'libraries/transformations.lib.php';
require_once 'export.php';
/**
* tests for ExportHtmlword class
* tests for PMA\libraries\plugins\export\ExportHtmlword class
*
* @package PhpMyAdmin-test
* @group medium
@ -57,17 +54,17 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportHtmlword::setProperties
* Test for PMA\libraries\plugins\export\ExportHtmlword::setProperties
*
* @return void
*/
public function testSetProperties()
{
$method = new ReflectionMethod('ExportHtmlword', 'setProperties');
$method = new ReflectionMethod('PMA\libraries\plugins\export\ExportHtmlword', 'setProperties');
$method->setAccessible(true);
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty('ExportHtmlword', 'properties');
$attrProperties = new ReflectionProperty('PMA\libraries\plugins\export\ExportHtmlword', 'properties');
$attrProperties->setAccessible(true);
$properties = $attrProperties->getValue($this->object);
@ -213,7 +210,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportHtmlword::exportHeader
* Test for PMA\libraries\plugins\export\ExportHtmlword::exportHeader
*
* @return void
*/
@ -270,7 +267,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportHtmlword::exportFooter
* Test for PMA\libraries\plugins\export\ExportHtmlword::exportFooter
*
* @return void
*/
@ -289,7 +286,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportHtmlword::exportDBHeader
* Test for PMA\libraries\plugins\export\ExportHtmlword::exportDBHeader
*
* @return void
*/
@ -308,7 +305,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportHtmlword::exportDBFooter
* Test for PMA\libraries\plugins\export\ExportHtmlword::exportDBFooter
*
* @return void
*/
@ -320,7 +317,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportHtmlword::exportDBCreate
* Test for PMA\libraries\plugins\export\ExportHtmlword::exportDBCreate
*
* @return void
*/
@ -332,7 +329,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportHtmlword::exportData
* Test for PMA\libraries\plugins\export\ExportHtmlword::exportData
*
* @return void
*/
@ -402,13 +399,13 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportHtmlword::getTableDefStandIn
* Test for PMA\libraries\plugins\export\ExportHtmlword::getTableDefStandIn
*
* @return void
*/
public function testGetTableDefStandIn()
{
$this->object = $this->getMockBuilder('ExportHtmlword')
$this->object = $this->getMockBuilder('PMA\libraries\plugins\export\ExportHtmlword')
->setMethods(array('formatOneColumnDefinition'))
->getMock();
@ -458,13 +455,13 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportHtmlword::getTableDef
* Test for PMA\libraries\plugins\export\ExportHtmlword::getTableDef
*
* @return void
*/
public function testGetTableDef()
{
$this->object = $this->getMockBuilder('ExportHtmlword')
$this->object = $this->getMockBuilder('PMA\libraries\plugins\export\ExportHtmlword')
->setMethods(array('formatOneColumnDefinition'))
->getMock();
@ -739,7 +736,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportHtmlword::getTriggers
* Test for PMA\libraries\plugins\export\ExportHtmlword::getTriggers
*
* @return void
*/
@ -765,7 +762,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
$GLOBALS['dbi'] = $dbi;
$method = new ReflectionMethod('ExportHtmlword', 'getTriggers');
$method = new ReflectionMethod('PMA\libraries\plugins\export\ExportHtmlword', 'getTriggers');
$method->setAccessible(true);
$result = $method->invoke($this->object, 'database', 'table');
@ -779,7 +776,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportHtmlword::exportStructure
* Test for PMA\libraries\plugins\export\ExportHtmlword::exportStructure
*
* @return void
*/
@ -795,7 +792,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
->with('db', 'tbl')
->will($this->returnValue(1));
$this->object = $this->getMockBuilder('ExportHtmlword')
$this->object = $this->getMockBuilder('PMA\libraries\plugins\export\ExportHtmlword')
->setMethods(array('getTableDef', 'getTriggers', 'getTableDefStandIn'))
->getMock();
@ -875,7 +872,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportHtmlword::formatOneColumnDefinition
* Test for PMA\libraries\plugins\export\ExportHtmlword::formatOneColumnDefinition
*
* @return void
*/
@ -884,7 +881,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
$GLOBALS['cfg']['LimitChars'] = 40;
$method = new ReflectionMethod(
'ExportHtmlword', 'formatOneColumnDefinition'
'PMA\libraries\plugins\export\ExportHtmlword', 'formatOneColumnDefinition'
);
$method->setAccessible(true);

View File

@ -1,21 +1,18 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for ExportJson class
* tests for PMA\libraries\plugins\export\ExportJson class
*
* @package PhpMyAdmin-test
*/
require_once 'libraries/plugins/export/ExportJson.class.php';
use PMA\libraries\plugins\export\ExportJson;
require_once 'libraries/export.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/config.default.php';
require_once 'export.php';
/**
* tests for ExportJson class
* tests for PMA\libraries\plugins\export\ExportJson class
*
* @package PhpMyAdmin-test
* @group medium
@ -51,17 +48,17 @@ class PMA_ExportJson_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportJson::setProperties
* Test for PMA\libraries\plugins\export\ExportJson::setProperties
*
* @return void
*/
public function testSetProperties()
{
$method = new ReflectionMethod('ExportJson', 'setProperties');
$method = new ReflectionMethod('PMA\libraries\plugins\export\ExportJson', 'setProperties');
$method->setAccessible(true);
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty('ExportJson', 'properties');
$attrProperties = new ReflectionProperty('PMA\libraries\plugins\export\ExportJson', 'properties');
$attrProperties->setAccessible(true);
$properties = $attrProperties->getValue($this->object);
@ -132,7 +129,7 @@ class PMA_ExportJson_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportJson::exportHeader
* Test for PMA\libraries\plugins\export\ExportJson::exportHeader
*
* @return void
*/
@ -153,7 +150,7 @@ class PMA_ExportJson_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportJson::exportFooter
* Test for PMA\libraries\plugins\export\ExportJson::exportFooter
*
* @return void
*/
@ -165,7 +162,7 @@ class PMA_ExportJson_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportJson::exportDBHeader
* Test for PMA\libraries\plugins\export\ExportJson::exportDBHeader
*
* @return void
*/
@ -183,7 +180,7 @@ class PMA_ExportJson_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportJson::exportDBFooter
* Test for PMA\libraries\plugins\export\ExportJson::exportDBFooter
*
* @return void
*/
@ -195,7 +192,7 @@ class PMA_ExportJson_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportJson::exportDBCreate
* Test for PMA\libraries\plugins\export\ExportJson::exportDBCreate
*
* @return void
*/
@ -207,7 +204,7 @@ class PMA_ExportJson_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportJson::exportData
* Test for PMA\libraries\plugins\export\ExportJson::exportData
*
* @return void
*/

View File

@ -1,23 +1,20 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for ExportLatex class
* tests for PMA\libraries\plugins\export\ExportLatex class
*
* @package PhpMyAdmin-test
*/
require_once 'libraries/plugins/export/ExportLatex.class.php';
use PMA\libraries\plugins\export\ExportLatex;
require_once 'libraries/export.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/config.default.php';
require_once 'libraries/relation.lib.php';
require_once 'libraries/transformations.lib.php';
require_once 'export.php';
/**
* tests for ExportLatex class
* tests for PMA\libraries\plugins\export\ExportLatex class
*
* @package PhpMyAdmin-test
* @group medium
@ -61,7 +58,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportLatex::setProperties
* Test for PMA\libraries\plugins\export\ExportLatex::setProperties
*
* @return void
*/
@ -71,11 +68,11 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
$GLOBALS['plugin_param']['single_table'] = false;
$GLOBALS['cfgRelation']['mimework'] = true;
$method = new ReflectionMethod('ExportLatex', 'setProperties');
$method = new ReflectionMethod('PMA\libraries\plugins\export\ExportLatex', 'setProperties');
$method->setAccessible(true);
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty('ExportLatex', 'properties');
$attrProperties = new ReflectionProperty('PMA\libraries\plugins\export\ExportLatex', 'properties');
$attrProperties->setAccessible(true);
$properties = $attrProperties->getValue($this->object);
@ -472,7 +469,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportLatex::exportHeader
* Test for PMA\libraries\plugins\export\ExportLatex::exportHeader
*
* @return void
*/
@ -499,7 +496,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportLatex::exportFooter
* Test for PMA\libraries\plugins\export\ExportLatex::exportFooter
*
* @return void
*/
@ -511,7 +508,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportLatex::exportDBHeader
* Test for PMA\libraries\plugins\export\ExportLatex::exportDBHeader
*
* @return void
*/
@ -529,7 +526,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportLatex::exportDBFooter
* Test for PMA\libraries\plugins\export\ExportLatex::exportDBFooter
*
* @return void
*/
@ -541,7 +538,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportLatex::exportDBCreate
* Test for PMA\libraries\plugins\export\ExportLatex::exportDBCreate
*
* @return void
*/
@ -553,7 +550,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportLatex::exportData
* Test for PMA\libraries\plugins\export\ExportLatex::exportData
*
* @return void
*/
@ -667,13 +664,13 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportLatex::exportStructure
* Test for PMA\libraries\plugins\export\ExportLatex::exportStructure
*
* @return void
*/
public function testExportStructure()
{
// $this->object = $this->getMockBuilder('ExportHtmlword')
// $this->object = $this->getMockBuilder('PMA\libraries\plugins\export\ExportHtmlword')
// ->setMethods(array('formatOneColumnDefinition'))
// ->getMock();
@ -1000,7 +997,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportLatex::texEscape
* Test for PMA\libraries\plugins\export\ExportLatex::texEscape
*
* @return void
*/

View File

@ -1,21 +1,19 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for ExportMediawiki class
* tests for PMA\libraries\plugins\export\ExportMediawiki class
*
* @package PhpMyAdmin-test
*/
require_once 'libraries/plugins/export/ExportMediawiki.class.php';
use PMA\libraries\plugins\export\ExportMediawiki;
require_once 'libraries/export.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/config.default.php';
require_once 'export.php';
/**
* tests for ExportMediawiki class
* tests for PMA\libraries\plugins\export\ExportMediawiki class
*
* @package PhpMyAdmin-test
* @group medium
@ -51,17 +49,17 @@ class PMA_ExportMediawiki_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportMediawiki::setProperties
* Test for PMA\libraries\plugins\export\ExportMediawiki::setProperties
*
* @return void
*/
public function testSetProperties()
{
$method = new ReflectionMethod('ExportMediawiki', 'setProperties');
$method = new ReflectionMethod('PMA\libraries\plugins\export\ExportMediawiki', 'setProperties');
$method->setAccessible(true);
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty('ExportMediawiki', 'properties');
$attrProperties = new ReflectionProperty('PMA\libraries\plugins\export\ExportMediawiki', 'properties');
$attrProperties->setAccessible(true);
$properties = $attrProperties->getValue($this->object);
@ -196,7 +194,7 @@ class PMA_ExportMediawiki_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportMediawiki::exportHeader
* Test for PMA\libraries\plugins\export\ExportMediawiki::exportHeader
*
* @return void
*/
@ -208,7 +206,7 @@ class PMA_ExportMediawiki_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportMediawiki::exportFooter
* Test for PMA\libraries\plugins\export\ExportMediawiki::exportFooter
*
* @return void
*/
@ -220,7 +218,7 @@ class PMA_ExportMediawiki_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportMediawiki::exportDBHeader
* Test for PMA\libraries\plugins\export\ExportMediawiki::exportDBHeader
*
* @return void
*/
@ -232,7 +230,7 @@ class PMA_ExportMediawiki_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportMediawiki::exportDBFooter
* Test for PMA\libraries\plugins\export\ExportMediawiki::exportDBFooter
*
* @return void
*/
@ -244,7 +242,7 @@ class PMA_ExportMediawiki_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportMediawiki::exportDBCreate
* Test for PMA\libraries\plugins\export\ExportMediawiki::exportDBCreate
*
* @return void
*/
@ -346,7 +344,7 @@ class PMA_ExportMediawiki_Test extends PHPUnit_Framework_TestCase
*/
}
/**
* Test for ExportMediawiki::exportData
* Test for PMA\libraries\plugins\export\ExportMediawiki::exportData
*
* @return void
*/

View File

@ -1,21 +1,19 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for ExportOds class
* tests for PMA\libraries\plugins\export\ExportOds class
*
* @package PhpMyAdmin-test
*/
require_once 'libraries/plugins/export/ExportOds.class.php';
use PMA\libraries\plugins\export\ExportOds;
require_once 'libraries/export.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/config.default.php';
require_once 'export.php';
/**
* tests for ExportOds class
* tests for PMA\libraries\plugins\export\ExportOds class
*
* @package PhpMyAdmin-test
* @group medium
@ -51,17 +49,17 @@ class PMA_ExportOds_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportOds::setProperties
* Test for PMA\libraries\plugins\export\ExportOds::setProperties
*
* @return void
*/
public function testSetProperties()
{
$method = new ReflectionMethod('ExportOds', 'setProperties');
$method = new ReflectionMethod('PMA\libraries\plugins\export\ExportOds', 'setProperties');
$method->setAccessible(true);
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty('ExportOds', 'properties');
$attrProperties = new ReflectionProperty('PMA\libraries\plugins\export\ExportOds', 'properties');
$attrProperties->setAccessible(true);
$properties = $attrProperties->getValue($this->object);
@ -170,7 +168,7 @@ class PMA_ExportOds_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportOds::exportHeader
* Test for PMA\libraries\plugins\export\ExportOds::exportHeader
*
* @return void
*/
@ -186,7 +184,7 @@ class PMA_ExportOds_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportOds::exportFooter
* Test for PMA\libraries\plugins\export\ExportOds::exportFooter
*
* @return void
*/
@ -223,7 +221,7 @@ class PMA_ExportOds_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportOds::exportDBHeader
* Test for PMA\libraries\plugins\export\ExportOds::exportDBHeader
*
* @return void
*/
@ -235,7 +233,7 @@ class PMA_ExportOds_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportOds::exportDBFooter
* Test for PMA\libraries\plugins\export\ExportOds::exportDBFooter
*
* @return void
*/
@ -247,7 +245,7 @@ class PMA_ExportOds_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportOds::exportDBCreate
* Test for PMA\libraries\plugins\export\ExportOds::exportDBCreate
*
* @return void
*/
@ -259,7 +257,7 @@ class PMA_ExportOds_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportOds::exportData
* Test for PMA\libraries\plugins\export\ExportOds::exportData
*
* @return void
*/
@ -384,7 +382,7 @@ class PMA_ExportOds_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportOds::exportData
* Test for PMA\libraries\plugins\export\ExportOds::exportData
*
* @return void
*/

View File

@ -1,24 +1,21 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for ExportOdt class
* tests for PMA\libraries\plugins\export\ExportOdt class
*
* @package PhpMyAdmin-test
*/
require_once 'libraries/plugins/export/ExportOdt.class.php';
use PMA\libraries\plugins\export\ExportOdt;
require_once 'libraries/export.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/config.default.php';
require_once 'libraries/relation.lib.php';
require_once 'libraries/transformations.lib.php';
require_once 'export.php';
/**
* tests for ExportOdt class
* tests for PMA\libraries\plugins\export\ExportOdt class
*
* @package PhpMyAdmin-test
* @group medium
@ -62,7 +59,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportOdt::setProperties
* Test for PMA\libraries\plugins\export\ExportOdt::setProperties
*
* @return void
*/
@ -72,11 +69,11 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
$GLOBALS['plugin_param']['single_table'] = false;
$GLOBALS['cfgRelation']['mimework'] = true;
$method = new ReflectionMethod('ExportOdt', 'setProperties');
$method = new ReflectionMethod('PMA\libraries\plugins\export\ExportOdt', 'setProperties');
$method->setAccessible(true);
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty('ExportOdt', 'properties');
$attrProperties = new ReflectionProperty('PMA\libraries\plugins\export\ExportOdt', 'properties');
$attrProperties->setAccessible(true);
$properties = $attrProperties->getValue($this->object);
@ -313,7 +310,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportOdt::exportHeader
* Test for PMA\libraries\plugins\export\ExportOdt::exportHeader
*
* @return void
*/
@ -332,7 +329,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportOdt::exportFooter
* Test for PMA\libraries\plugins\export\ExportOdt::exportFooter
*
* @return void
*/
@ -359,7 +356,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportOdt::exportDBHeader
* Test for PMA\libraries\plugins\export\ExportOdt::exportDBHeader
*
* @return void
*/
@ -383,7 +380,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportOdt::exportDBFooter
* Test for PMA\libraries\plugins\export\ExportOdt::exportDBFooter
*
* @return void
*/
@ -395,7 +392,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportOdt::exportDBCreate
* Test for PMA\libraries\plugins\export\ExportOdt::exportDBCreate
*
* @return void
*/
@ -407,7 +404,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportOdt::exportData
* Test for PMA\libraries\plugins\export\ExportOdt::exportData
*
* @return void
*/
@ -503,7 +500,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportOdt::exportData
* Test for PMA\libraries\plugins\export\ExportOdt::exportData
*
* @return void
*/
@ -628,7 +625,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportOdt::getTableDefStandIn
* Test for PMA\libraries\plugins\export\ExportOdt::getTableDefStandIn
*
* @return void
*/
@ -645,7 +642,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
$GLOBALS['dbi'] = $dbi;
$this->object = $this->getMockBuilder('ExportOdt')
$this->object = $this->getMockBuilder('PMA\libraries\plugins\export\ExportOdt')
->disableOriginalConstructor()
->setMethods(array('formatOneColumnDefinition'))
->getMock();
@ -677,13 +674,13 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportOdt::getTableDef
* Test for PMA\libraries\plugins\export\ExportOdt::getTableDef
*
* @return void
*/
public function testGetTableDef()
{
$this->object = $this->getMockBuilder('ExportOdt')
$this->object = $this->getMockBuilder('PMA\libraries\plugins\export\ExportOdt')
->setMethods(array('formatOneColumnDefinition'))
->getMock();
@ -885,7 +882,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportOdt::getTriggers
* Test for PMA\libraries\plugins\export\ExportOdt::getTriggers
*
* @return void
*/
@ -911,7 +908,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
$GLOBALS['dbi'] = $dbi;
$method = new ReflectionMethod('ExportOdt', 'getTriggers');
$method = new ReflectionMethod('PMA\libraries\plugins\export\ExportOdt', 'getTriggers');
$method->setAccessible(true);
$result = $method->invoke($this->object, 'database', 'ta<ble');
@ -946,7 +943,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportOdt::exportStructure
* Test for PMA\libraries\plugins\export\ExportOdt::exportStructure
*
* @return void
*/
@ -962,7 +959,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
->with('db', 't&bl')
->will($this->returnValue(1));
$this->object = $this->getMockBuilder('ExportOdt')
$this->object = $this->getMockBuilder('PMA\libraries\plugins\export\ExportOdt')
->setMethods(array('getTableDef', 'getTriggers', 'getTableDefStandIn'))
->getMock();
@ -1050,7 +1047,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportOdt::formatOneColumnDefinition
* Test for PMA\libraries\plugins\export\ExportOdt::formatOneColumnDefinition
*
* @return void
*/
@ -1059,7 +1056,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
$GLOBALS['cfg']['LimitChars'] = 40;
$method = new ReflectionMethod(
'ExportOdt', 'formatOneColumnDefinition'
'PMA\libraries\plugins\export\ExportOdt', 'formatOneColumnDefinition'
);
$method->setAccessible(true);

View File

@ -1,21 +1,20 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for ExportPdf class
* tests for PMA\libraries\plugins\export\ExportPdf class
*
* @package PhpMyAdmin-test
*/
require_once 'libraries/plugins/export/ExportPdf.class.php';
require_once 'libraries/plugins/export/PMA_ExportPdf.class.php';
use PMA\libraries\plugins\export\ExportPdf;
use PMA\libraries\plugins\export\PMA_ExportPdf;
require_once 'libraries/export.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/config.default.php';
require_once 'export.php';
/**
* tests for ExportPdf class
* tests for PMA\libraries\plugins\export\ExportPdf class
*
* @package PhpMyAdmin-test
* @group medium
@ -51,17 +50,17 @@ class PMA_ExportPdf_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportPdf::setProperties
* Test for PMA\libraries\plugins\export\ExportPdf::setProperties
*
* @return void
*/
public function testSetProperties()
{
$method = new ReflectionMethod('ExportPdf', 'setProperties');
$method = new ReflectionMethod('PMA\libraries\plugins\export\ExportPdf', 'setProperties');
$method->setAccessible(true);
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty('ExportPdf', 'properties');
$attrProperties = new ReflectionProperty('PMA\libraries\plugins\export\ExportPdf', 'properties');
$attrProperties->setAccessible(true);
$properties = $attrProperties->getValue($this->object);
@ -177,13 +176,13 @@ class PMA_ExportPdf_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportPdf::exportHeader
* Test for PMA\libraries\plugins\export\ExportPdf::exportHeader
*
* @return void
*/
public function testExportHeader()
{
$pdf = $this->getMockBuilder('PMA_ExportPdf')
$pdf = $this->getMockBuilder('PMA\libraries\plugins\export\PMA_ExportPdf')
->disableOriginalConstructor()
->getMock();
@ -196,7 +195,7 @@ class PMA_ExportPdf_Test extends PHPUnit_Framework_TestCase
$pdf->expects($this->once())
->method('setTopMargin');
$attrPdf = new ReflectionProperty('ExportPdf', '_pdf');
$attrPdf = new ReflectionProperty('PMA\libraries\plugins\export\ExportPdf', '_pdf');
$attrPdf->setAccessible(true);
$attrPdf->setValue($this->object, $pdf);
@ -206,20 +205,20 @@ class PMA_ExportPdf_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportPdf::exportFooter
* Test for PMA\libraries\plugins\export\ExportPdf::exportFooter
*
* @return void
*/
public function testExportFooter()
{
$pdf = $this->getMockBuilder('PMA_ExportPdf')
$pdf = $this->getMockBuilder('PMA\libraries\plugins\export\PMA_ExportPdf')
->disableOriginalConstructor()
->getMock();
$pdf->expects($this->once())
->method('getPDFData');
$attrPdf = new ReflectionProperty('ExportPdf', '_pdf');
$attrPdf = new ReflectionProperty('PMA\libraries\plugins\export\ExportPdf', '_pdf');
$attrPdf->setAccessible(true);
$attrPdf->setValue($this->object, $pdf);
@ -229,7 +228,7 @@ class PMA_ExportPdf_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportPdf::exportDBHeader
* Test for PMA\libraries\plugins\export\ExportPdf::exportDBHeader
*
* @return void
*/
@ -241,7 +240,7 @@ class PMA_ExportPdf_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportPdf::exportDBFooter
* Test for PMA\libraries\plugins\export\ExportPdf::exportDBFooter
*
* @return void
*/
@ -253,7 +252,7 @@ class PMA_ExportPdf_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportPdf::exportDBCreate
* Test for PMA\libraries\plugins\export\ExportPdf::exportDBCreate
*
* @return void
*/
@ -265,13 +264,13 @@ class PMA_ExportPdf_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportPdf::exportData
* Test for PMA\libraries\plugins\export\ExportPdf::exportData
*
* @return void
*/
public function testExportData()
{
$pdf = $this->getMockBuilder('PMA_ExportPdf')
$pdf = $this->getMockBuilder('PMA\libraries\plugins\export\PMA_ExportPdf')
->disableOriginalConstructor()
->getMock();
@ -289,7 +288,7 @@ class PMA_ExportPdf_Test extends PHPUnit_Framework_TestCase
->method('mysqlReport')
->with('SELECT');
$attrPdf = new ReflectionProperty('ExportPdf', '_pdf');
$attrPdf = new ReflectionProperty('PMA\libraries\plugins\export\ExportPdf', '_pdf');
$attrPdf->setAccessible(true);
$attrPdf->setValue($this->object, $pdf);
@ -302,39 +301,39 @@ class PMA_ExportPdf_Test extends PHPUnit_Framework_TestCase
/**
* Test for
* - ExportPdf::_setPdf
* - ExportPdf::_getPdf
* - PMA\libraries\plugins\export\ExportPdf::_setPdf
* - PMA\libraries\plugins\export\ExportPdf::_getPdf
*
* @return void
*/
public function testSetGetPdf()
{
$setter = new ReflectionMethod('ExportPdf', '_setPdf');
$setter = new ReflectionMethod('PMA\libraries\plugins\export\ExportPdf', '_setPdf');
$setter->setAccessible(true);
$setter->invoke($this->object, new PMA_ExportPdf);
$getter = new ReflectionMethod('ExportPdf', '_getPdf');
$getter = new ReflectionMethod('PMA\libraries\plugins\export\ExportPdf', '_getPdf');
$getter->setAccessible(true);
$this->assertInstanceOf(
'PMA_ExportPdf',
'PMA\libraries\plugins\export\PMA_ExportPdf',
$getter->invoke($this->object)
);
}
/**
* Test for
* - ExportPdf::_setPdfReportTitle
* - ExportPdf::_getPdfReportTitle
* - PMA\libraries\plugins\export\ExportPdf::_setPdfReportTitle
* - PMA\libraries\plugins\export\ExportPdf::_getPdfReportTitle
*
* @return void
*/
public function testSetGetPdfTitle()
{
$setter = new ReflectionMethod('ExportPdf', '_setPdfReportTitle');
$setter = new ReflectionMethod('PMA\libraries\plugins\export\ExportPdf', '_setPdfReportTitle');
$setter->setAccessible(true);
$setter->invoke($this->object, "title");
$getter = new ReflectionMethod('ExportPdf', '_getPdfReportTitle');
$getter = new ReflectionMethod('PMA\libraries\plugins\export\ExportPdf', '_getPdfReportTitle');
$getter->setAccessible(true);
$this->assertEquals(
'title',

View File

@ -1,21 +1,19 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for ExportPhparray class
* tests for PMA\libraries\plugins\export\ExportPhparray class
*
* @package PhpMyAdmin-test
*/
require_once 'libraries/plugins/export/ExportPhparray.class.php';
use PMA\libraries\plugins\export\ExportPhparray;
require_once 'libraries/export.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/config.default.php';
require_once 'export.php';
/**
* tests for ExportPhparray class
* tests for PMA\libraries\plugins\export\ExportPhparray class
*
* @package PhpMyAdmin-test
* @group medium
@ -51,17 +49,17 @@ class PMA_ExportPhparray_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportPhparray::setProperties
* Test for PMA\libraries\plugins\export\ExportPhparray::setProperties
*
* @return void
*/
public function testSetProperties()
{
$method = new ReflectionMethod('ExportPhparray', 'setProperties');
$method = new ReflectionMethod('PMA\libraries\plugins\export\ExportPhparray', 'setProperties');
$method->setAccessible(true);
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty('ExportPhparray', 'properties');
$attrProperties = new ReflectionProperty('PMA\libraries\plugins\export\ExportPhparray', 'properties');
$attrProperties->setAccessible(true);
$properties = $attrProperties->getValue($this->object);
@ -126,7 +124,7 @@ class PMA_ExportPhparray_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportPhparray::exportHeader
* Test for PMA\libraries\plugins\export\ExportPhparray::exportHeader
*
* @return void
*/
@ -147,7 +145,7 @@ class PMA_ExportPhparray_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportPhparray::exportFooter
* Test for PMA\libraries\plugins\export\ExportPhparray::exportFooter
*
* @return void
*/
@ -159,7 +157,7 @@ class PMA_ExportPhparray_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportPhparray::exportDBHeader
* Test for PMA\libraries\plugins\export\ExportPhparray::exportDBHeader
*
* @return void
*/
@ -180,7 +178,7 @@ class PMA_ExportPhparray_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportPhparray::exportDBFooter
* Test for PMA\libraries\plugins\export\ExportPhparray::exportDBFooter
*
* @return void
*/
@ -192,7 +190,7 @@ class PMA_ExportPhparray_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportPhparray::exportDBCreate
* Test for PMA\libraries\plugins\export\ExportPhparray::exportDBCreate
*
* @return void
*/
@ -204,7 +202,7 @@ class PMA_ExportPhparray_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportPhparray::exportData
* Test for PMA\libraries\plugins\export\ExportPhparray::exportData
*
* @return void
*/

View File

@ -1,28 +1,24 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for ExportSql class
* tests for PMA\libraries\plugins\export\ExportSql class
*
* @package PhpMyAdmin-test
*/
use PMA\libraries\plugins\export\ExportSql;
use PMA\libraries\Table;
require_once 'libraries/plugins/export/ExportSql.class.php';
require_once 'libraries/export.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/config.default.php';
require_once 'libraries/mysql_charsets.lib.php';
require_once 'libraries/relation.lib.php';
require_once 'libraries/transformations.lib.php';
require_once 'libraries/charset_conversion.lib.php';
require_once 'export.php';
/**
* tests for ExportSql class
* tests for PMA\libraries\plugins\export\ExportSql class
*
* @package PhpMyAdmin-test
* @group medium
@ -66,7 +62,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportSql::setProperties
* Test for PMA\libraries\plugins\export\ExportSql::setProperties
*
* @return void
* @group medium
@ -92,11 +88,11 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
$GLOBALS['plugin_param']['single_table'] = false;
$GLOBALS['cfgRelation']['mimework'] = true;
$method = new ReflectionMethod('ExportSql', 'setProperties');
$method = new ReflectionMethod('PMA\libraries\plugins\export\ExportSql', 'setProperties');
$method->setAccessible(true);
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty('ExportSql', 'properties');
$attrProperties = new ReflectionProperty('PMA\libraries\plugins\export\ExportSql', 'properties');
$attrProperties->setAccessible(true);
$properties = $attrProperties->getValue($this->object);
@ -348,7 +344,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportSql::setProperties
* Test for PMA\libraries\plugins\export\ExportSql::setProperties
*
* @return void
*/
@ -376,11 +372,11 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
$GLOBALS['cfgRelation']['mimework'] = false;
$GLOBALS['cfgRelation']['relation'] = false;
$method = new ReflectionMethod('ExportSql', 'setProperties');
$method = new ReflectionMethod('PMA\libraries\plugins\export\ExportSql', 'setProperties');
$method->setAccessible(true);
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty('ExportSql', 'properties');
$attrProperties = new ReflectionProperty('PMA\libraries\plugins\export\ExportSql', 'properties');
$attrProperties->setAccessible(true);
$properties = $attrProperties->getValue($this->object);
@ -474,7 +470,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportSql::exportRoutines
* Test for PMA\libraries\plugins\export\ExportSql::exportRoutines
*
* @return void
*/
@ -524,13 +520,13 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportSql::_exportComment
* Test for PMA\libraries\plugins\export\ExportSql::_exportComment
*
* @return void
*/
public function testExportComment()
{
$method = new ReflectionMethod('ExportSql', '_exportComment');
$method = new ReflectionMethod('PMA\libraries\plugins\export\ExportSql', '_exportComment');
$method->setAccessible(true);
$GLOBALS['crlf'] = '##';
@ -562,13 +558,13 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportSql::_possibleCRLF
* Test for PMA\libraries\plugins\export\ExportSql::_possibleCRLF
*
* @return void
*/
public function testPossibleCRLF()
{
$method = new ReflectionMethod('ExportSql', '_possibleCRLF');
$method = new ReflectionMethod('PMA\libraries\plugins\export\ExportSql', '_possibleCRLF');
$method->setAccessible(true);
$GLOBALS['crlf'] = '##';
@ -600,7 +596,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportSql::exportFooter
* Test for PMA\libraries\plugins\export\ExportSql::exportFooter
*
* @return void
*/
@ -656,7 +652,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportSql::exportHeader
* Test for PMA\libraries\plugins\export\ExportSql::exportHeader
*
* @return void
*/
@ -756,7 +752,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportSql::exportDBCreate
* Test for PMA\libraries\plugins\export\ExportSql::exportDBCreate
*
* @return void
*/
@ -842,7 +838,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportSql::exportDBHeader
* Test for PMA\libraries\plugins\export\ExportSql::exportDBHeader
*
* @return void
*/
@ -881,7 +877,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportSql::exportEvents
* Test for PMA\libraries\plugins\export\ExportSql::exportEvents
*
* @return void
*/
@ -958,7 +954,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportSql::exportDBFooter
* Test for PMA\libraries\plugins\export\ExportSql::exportDBFooter
*
* @return void
*/
@ -1003,7 +999,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportSql::getTableDefStandIn
* Test for PMA\libraries\plugins\export\ExportSql::getTableDefStandIn
*
* @return void
*/
@ -1041,7 +1037,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportSql::_getTableDefForView
* Test for PMA\libraries\plugins\export\ExportSql::_getTableDefForView
*
* @return void
*/
@ -1092,7 +1088,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
$GLOBALS['dbi'] = $dbi;
$GLOBALS['sql_compatibility'] = 'MSSQL';
$method = new ReflectionMethod('ExportSql', '_getTableDefForView');
$method = new ReflectionMethod('PMA\libraries\plugins\export\ExportSql', '_getTableDefForView');
$method->setAccessible(true);
$result = $method->invoke(
$this->object, 'db', 'view', "\n"
@ -1121,7 +1117,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportSql::getTableDef
* Test for PMA\libraries\plugins\export\ExportSql::getTableDef
*
* @return void
* @group medium
@ -1309,7 +1305,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportSql::getTableDef
* Test for PMA\libraries\plugins\export\ExportSql::getTableDef
*
* @return void
*/
@ -1435,7 +1431,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportSql::getTableDef
* Test for PMA\libraries\plugins\export\ExportSql::getTableDef
*
* @return void
*/
@ -1542,7 +1538,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportSql::_getTableComments
* Test for PMA\libraries\plugins\export\ExportSql::_getTableComments
*
* @return void
*/
@ -1592,7 +1588,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
);
$GLOBALS['dbi'] = $dbi;
$method = new ReflectionMethod('ExportSql', '_getTableComments');
$method = new ReflectionMethod('PMA\libraries\plugins\export\ExportSql', '_getTableComments');
$method->setAccessible(true);
$result = $method->invoke(
$this->object, 'db', '', "\n", true, true
@ -1614,7 +1610,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportSql::exportStructure
* Test for PMA\libraries\plugins\export\ExportSql::exportStructure
*
* @return void
* @group medium
@ -1637,7 +1633,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
)
);
$this->object = $this->getMockBuilder('ExportSql')
$this->object = $this->getMockBuilder('PMA\libraries\plugins\export\ExportSql')
->setMethods(array('getTableDef', 'getTriggers', 'getTableDefStandIn'))
->getMock();
@ -1783,7 +1779,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportSql::exportData
* Test for PMA\libraries\plugins\export\ExportSql::exportData
*
* @return void
* @group medium
@ -1922,7 +1918,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportSql::exportData
* Test for PMA\libraries\plugins\export\ExportSql::exportData
*
* @return void
* @group medium
@ -2021,7 +2017,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportSql::exportData
* Test for PMA\libraries\plugins\export\ExportSql::exportData
*
* @return void
*/
@ -2066,7 +2062,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportSql::exportData
* Test for PMA\libraries\plugins\export\ExportSql::exportData
*
* @return void
*/
@ -2103,7 +2099,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportSql::_makeCreateTableMSSQLCompatible
* Test for PMA\libraries\plugins\export\ExportSql::_makeCreateTableMSSQLCompatible
*
* @return void
*/
@ -2128,7 +2124,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
" \" double NOT NULL DEFAULT '213'\n";
$method = new ReflectionMethod(
'ExportSql', '_makeCreateTableMSSQLCompatible'
'PMA\libraries\plugins\export\ExportSql', '_makeCreateTableMSSQLCompatible'
);
$method->setAccessible(true);
$result = $method->invoke(
@ -2160,7 +2156,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportSql::initAlias
* Test for PMA\libraries\plugins\export\ExportSql::initAlias
*
* @return void
*/
@ -2202,7 +2198,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportSql::getAlias
* Test for PMA\libraries\plugins\export\ExportSql::getAlias
*
* @return void
*/
@ -2247,7 +2243,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportSql::replaceWithAlias
* Test for PMA\libraries\plugins\export\ExportSql::replaceWithAlias
*
* @return void
*/

View File

@ -1,23 +1,21 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for ExportTexytext class
* tests for PMA\libraries\plugins\export\ExportTexytext class
*
* @package PhpMyAdmin-test
*/
require_once 'libraries/plugins/export/ExportTexytext.class.php';
use PMA\libraries\plugins\export\ExportTexytext;
require_once 'libraries/export.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/config.default.php';
require_once 'libraries/relation.lib.php';
require_once 'libraries/transformations.lib.php';
require_once 'export.php';
/**
* tests for ExportTexytext class
* tests for PMA\libraries\plugins\export\ExportTexytext class
*
* @package PhpMyAdmin-test
* @group medium
@ -60,17 +58,17 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportTexytext::setProperties
* Test for PMA\libraries\plugins\export\ExportTexytext::setProperties
*
* @return void
*/
public function testSetProperties()
{
$method = new ReflectionMethod('ExportTexytext', 'setProperties');
$method = new ReflectionMethod('PMA\libraries\plugins\export\ExportTexytext', 'setProperties');
$method->setAccessible(true);
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty('ExportTexytext', 'properties');
$attrProperties = new ReflectionProperty('PMA\libraries\plugins\export\ExportTexytext', 'properties');
$attrProperties->setAccessible(true);
$properties = $attrProperties->getValue($this->object);
@ -174,7 +172,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportTexytext::exportHeader
* Test for PMA\libraries\plugins\export\ExportTexytext::exportHeader
*
* @return void
*/
@ -186,7 +184,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportTexytext::exportFooter
* Test for PMA\libraries\plugins\export\ExportTexytext::exportFooter
*
* @return void
*/
@ -198,7 +196,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportTexytext::exportDBHeader
* Test for PMA\libraries\plugins\export\ExportTexytext::exportDBHeader
*
* @return void
*/
@ -213,7 +211,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportTexytext::exportDBFooter
* Test for PMA\libraries\plugins\export\ExportTexytext::exportDBFooter
*
* @return void
*/
@ -225,7 +223,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportTexytext::exportDBCreate
* Test for PMA\libraries\plugins\export\ExportTexytext::exportDBCreate
*
* @return void
*/
@ -237,7 +235,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportTexytext::exportData
* Test for PMA\libraries\plugins\export\ExportTexytext::exportData
*
* @return void
*/
@ -300,7 +298,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportTexytext::getTableDefStandIn
* Test for PMA\libraries\plugins\export\ExportTexytext::getTableDefStandIn
*
* @return void
*/
@ -337,7 +335,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
$GLOBALS['dbi'] = $dbi;
$this->object = $this->getMockBuilder('ExportTexytext')
$this->object = $this->getMockBuilder('PMA\libraries\plugins\export\ExportTexytext')
->disableOriginalConstructor()
->setMethods(array('formatOneColumnDefinition'))
->getMock();
@ -361,13 +359,13 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportTexytext::getTableDef
* Test for PMA\libraries\plugins\export\ExportTexytext::getTableDef
*
* @return void
*/
public function testGetTableDef()
{
$this->object = $this->getMockBuilder('ExportTexytext')
$this->object = $this->getMockBuilder('PMA\libraries\plugins\export\ExportTexytext')
->setMethods(array('formatOneColumnDefinition'))
->getMock();
@ -473,7 +471,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportTexytext::getTriggers
* Test for PMA\libraries\plugins\export\ExportTexytext::getTriggers
*
* @return void
*/
@ -514,7 +512,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportTexytext::exportStructure
* Test for PMA\libraries\plugins\export\ExportTexytext::exportStructure
*
* @return void
*/
@ -530,7 +528,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
->with('db', 't&bl')
->will($this->returnValue(1));
$this->object = $this->getMockBuilder('ExportTexytext')
$this->object = $this->getMockBuilder('PMA\libraries\plugins\export\ExportTexytext')
->setMethods(array('getTableDef', 'getTriggers', 'getTableDefStandIn'))
->getMock();
@ -617,7 +615,7 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportTexytext::formatOneColumnDefinition
* Test for PMA\libraries\plugins\export\ExportTexytext::formatOneColumnDefinition
*
* @return void
*/

View File

@ -1,25 +1,22 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for ExportXml class
* tests for PMA\libraries\plugins\export\ExportXml class
*
* @package PhpMyAdmin-test
*/
use PMA\libraries\plugins\export\ExportXml;
use PMA\libraries\Table;
$GLOBALS['db'] = 'db';
require_once 'libraries/plugins/export/ExportXml.class.php';
require_once 'libraries/export.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/config.default.php';
require_once 'export.php';
/**
* tests for ExportXml class
* tests for PMA\libraries\plugins\export\ExportXml class
*
* @package PhpMyAdmin-test
* @group medium
@ -62,7 +59,7 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportXml::setProperties
* Test for PMA\libraries\plugins\export\ExportXml::setProperties
*
* @return void
* @group medium
@ -82,11 +79,11 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
}
}
$method = new ReflectionMethod('ExportXml', 'setProperties');
$method = new ReflectionMethod('PMA\libraries\plugins\export\ExportXml', 'setProperties');
$method->setAccessible(true);
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty('ExportXml', 'properties');
$attrProperties = new ReflectionProperty('PMA\libraries\plugins\export\ExportXml', 'properties');
$attrProperties->setAccessible(true);
$properties = $attrProperties->getValue($this->object);
@ -221,7 +218,7 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportXml::exportHeader
* Test for PMA\libraries\plugins\export\ExportXml::exportHeader
*
* @return void
* @group medium
@ -482,7 +479,7 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportXml::exportHeader
* Test for PMA\libraries\plugins\export\ExportXml::exportHeader
*
* @return void
*/
@ -566,7 +563,7 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportXml::exportFooter
* Test for PMA\libraries\plugins\export\ExportXml::exportFooter
*
* @return void
*/
@ -581,7 +578,7 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportXml::exportDBHeader
* Test for PMA\libraries\plugins\export\ExportXml::exportDBHeader
*
* @return void
*/
@ -608,7 +605,7 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportXml::exportDBFooter
* Test for PMA\libraries\plugins\export\ExportXml::exportDBFooter
*
* @return void
*/
@ -635,7 +632,7 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportXml::exportDBCreate
* Test for PMA\libraries\plugins\export\ExportXml::exportDBCreate
*
* @return void
*/
@ -647,7 +644,7 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportXml::exportData
* Test for PMA\libraries\plugins\export\ExportXml::exportData
*
* @return void
*/

View File

@ -1,21 +1,20 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for ExportYaml class
* tests for PMA\libraries\plugins\export\ExportYaml class
*
* @package PhpMyAdmin-test
*/
require_once 'libraries/plugins/export/ExportYaml.class.php';
use PMA\libraries\plugins\export\ExportYaml;
require_once 'libraries/export.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/config.default.php';
require_once 'libraries/database_interface.inc.php';
require_once 'export.php';
/**
* tests for ExportYaml class
* tests for PMA\libraries\plugins\export\ExportYaml class
*
* @package PhpMyAdmin-test
* @group medium
@ -52,17 +51,17 @@ class PMA_ExportYaml_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportYaml::setProperties
* Test for PMA\libraries\plugins\export\ExportYaml::setProperties
*
* @return void
*/
public function testSetProperties()
{
$method = new ReflectionMethod('ExportYaml', 'setProperties');
$method = new ReflectionMethod('PMA\libraries\plugins\export\ExportYaml', 'setProperties');
$method->setAccessible(true);
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty('ExportYaml', 'properties');
$attrProperties = new ReflectionProperty('PMA\libraries\plugins\export\ExportYaml', 'properties');
$attrProperties->setAccessible(true);
$properties = $attrProperties->getValue($this->object);
@ -123,7 +122,7 @@ class PMA_ExportYaml_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportYaml::exportHeader
* Test for PMA\libraries\plugins\export\ExportYaml::exportHeader
*
* @return void
*/
@ -142,7 +141,7 @@ class PMA_ExportYaml_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportYaml::exportFooter
* Test for PMA\libraries\plugins\export\ExportYaml::exportFooter
*
* @return void
*/
@ -157,7 +156,7 @@ class PMA_ExportYaml_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportYaml::exportDBHeader
* Test for PMA\libraries\plugins\export\ExportYaml::exportDBHeader
*
* @return void
*/
@ -169,7 +168,7 @@ class PMA_ExportYaml_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportYaml::exportDBFooter
* Test for PMA\libraries\plugins\export\ExportYaml::exportDBFooter
*
* @return void
*/
@ -181,7 +180,7 @@ class PMA_ExportYaml_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportYaml::exportDBCreate
* Test for PMA\libraries\plugins\export\ExportYaml::exportDBCreate
*
* @return void
*/
@ -193,7 +192,7 @@ class PMA_ExportYaml_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportYaml::exportData
* Test for PMA\libraries\plugins\export\ExportYaml::exportData
*
* @return void
*/

View File

@ -1,20 +1,17 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for TableProperty class
* tests for PMA\libraries\plugins\export\TableProperty class
*
* @package PhpMyAdmin-test
*/
require_once 'libraries/plugins/export/TableProperty.class.php';
require_once 'libraries/plugins/export/ExportCodegen.class.php';
use PMA\libraries\plugins\export\TableProperty;
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/config.default.php';
/**
* tests for TableProperty class
* tests for PMA\libraries\plugins\export\TableProperty class
*
* @package PhpMyAdmin-test
*/
@ -45,7 +42,7 @@ class PMA_TableProperty_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for TableProperty::__construct
* Test for PMA\libraries\plugins\export\TableProperty::__construct
*
* @return void
*/
@ -83,7 +80,7 @@ class PMA_TableProperty_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for TableProperty::getPureType
* Test for PMA\libraries\plugins\export\TableProperty::getPureType
*
* @return void
*/
@ -105,7 +102,7 @@ class PMA_TableProperty_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for TableProperty::isNotNull
* Test for PMA\libraries\plugins\export\TableProperty::isNotNull
*
* @param string $nullable nullable value
* @param string $expected expected output
@ -138,7 +135,7 @@ class PMA_TableProperty_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for TableProperty::isUnique
* Test for PMA\libraries\plugins\export\TableProperty::isUnique
*
* @param string $key key value
* @param string $expected expected output
@ -173,7 +170,7 @@ class PMA_TableProperty_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for TableProperty::getDotNetPrimitiveType
* Test for PMA\libraries\plugins\export\TableProperty::getDotNetPrimitiveType
*
* @param string $type type value
* @param string $expected expected output
@ -214,7 +211,7 @@ class PMA_TableProperty_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for TableProperty::getDotNetObjectType
* Test for PMA\libraries\plugins\export\TableProperty::getDotNetObjectType
*
* @param string $type type value
* @param string $expected expected output
@ -255,7 +252,7 @@ class PMA_TableProperty_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for TableProperty::getIndexName
* Test for PMA\libraries\plugins\export\TableProperty::getIndexName
*
* @return void
*/
@ -278,7 +275,7 @@ class PMA_TableProperty_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for TableProperty::isPK
* Test for PMA\libraries\plugins\export\TableProperty::isPK
*
* @return void
*/
@ -298,7 +295,7 @@ class PMA_TableProperty_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for TableProperty::formatCs
* Test for PMA\libraries\plugins\export\TableProperty::formatCs
*
* @return void
*/
@ -313,7 +310,7 @@ class PMA_TableProperty_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for TableProperty::formatXml
* Test for PMA\libraries\plugins\export\TableProperty::formatXml
*
* @return void
*/
@ -328,7 +325,7 @@ class PMA_TableProperty_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for TableProperty::format
* Test for PMA\libraries\plugins\export\TableProperty::format
*
* @return void
*/