本文整理汇总了PHP中PMA_Util::localisedDate方法的典型用法代码示例。如果您正苦于以下问题:PHP PMA_Util::localisedDate方法的具体用法?PHP PMA_Util::localisedDate怎么用?PHP PMA_Util::localisedDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMA_Util
的用法示例。
在下文中一共展示了PMA_Util::localisedDate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_printGitRevision
/**
* Prints details about the current Git commit revision
*
* @return void
*/
function PMA_printGitRevision()
{
if (!$GLOBALS['PMA_Config']->get('PMA_VERSION_GIT')) {
$response = PMA_Response::getInstance();
$response->isSuccess(false);
return;
}
// load revision data from repo
$GLOBALS['PMA_Config']->checkGitRevision();
// if using a remote commit fast-forwarded, link to GitHub
$commit_hash = substr($GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_COMMITHASH'), 0, 7);
$commit_hash = '<strong title="' . htmlspecialchars($GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_MESSAGE')) . '">' . $commit_hash . '</strong>';
if ($GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_ISREMOTECOMMIT')) {
$commit_hash = '<a href="' . PMA_linkURL('https://github.com/phpmyadmin/phpmyadmin/commit/' . $GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_COMMITHASH')) . '" target="_blank">' . $commit_hash . '</a>';
}
$branch = $GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_BRANCH');
if ($GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_ISREMOTEBRANCH')) {
$branch = '<a href="' . PMA_linkURL('https://github.com/phpmyadmin/phpmyadmin/tree/' . $GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_BRANCH')) . '" target="_blank">' . $branch . '</a>';
}
if ($branch !== false) {
$branch = sprintf(__('%1$s from %2$s branch'), $commit_hash, $branch);
} else {
$branch = $commit_hash . ' (' . __('no branch') . ')';
}
$committer = $GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_COMMITTER');
$author = $GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_AUTHOR');
PMA_printListItem(__('Git revision:') . ' ' . $branch . ',<br /> ' . sprintf(__('committed on %1$s by %2$s'), PMA_Util::localisedDate(strtotime($committer['date'])), '<a href="' . PMA_linkURL('mailto:' . $committer['email']) . '">' . htmlspecialchars($committer['name']) . '</a>') . ($author != $committer ? ', <br />' . sprintf(__('authored on %1$s by %2$s'), PMA_Util::localisedDate(strtotime($author['date'])), '<a href="' . PMA_linkURL('mailto:' . $author['email']) . '">' . htmlspecialchars($author['name']) . '</a>') : ''), 'li_pma_version_git', null, null, null);
}
示例2: PMA_getHtmlForServerStateGeneralInfo
/**
* Prints server state General information
*
* @param PMA_ServerStatusData $ServerStatusData Server status data
*
* @return string
*/
function PMA_getHtmlForServerStateGeneralInfo($ServerStatusData)
{
$start_time = $GLOBALS['dbi']->fetchValue('SELECT UNIX_TIMESTAMP() - ' . $ServerStatusData->status['Uptime']);
$retval = '<h3>';
$bytes_received = $ServerStatusData->status['Bytes_received'];
$bytes_sent = $ServerStatusData->status['Bytes_sent'];
$retval .= sprintf(__('Network traffic since startup: %s'), implode(' ', PMA_Util::formatByteDown($bytes_received + $bytes_sent, 3, 1)));
$retval .= '</h3>';
$retval .= '<p>';
$retval .= sprintf(__('This MySQL server has been running for %1$s. It started up on %2$s.'), PMA_Util::timespanFormat($ServerStatusData->status['Uptime']), PMA_Util::localisedDate($start_time)) . "\n";
$retval .= '</p>';
return $retval;
}
示例3: Footer
/**
* This function must be named "Footer" to work with the TCPDF library
*
* @return void
*/
function Footer()
{
// Check if footer for this page already exists
if (!isset($this->footerset[$this->page])) {
$this->SetY(-15);
$this->SetFont(PMA_PDF_FONT, '', 14);
$this->Cell(0, 6, __('Page number:') . ' ' . $this->getAliasNumPage() . '/' . $this->getAliasNbPages(), 'T', 0, 'C');
$this->Cell(0, 6, PMA_Util::localisedDate(), 0, 1, 'R');
$this->SetY(20);
// set footerset
$this->footerset[$this->page] = 1;
}
}
示例4: PMA_getHtmlForServerStateGeneralInfo
/**
* Prints server state General information
*
* @param PMA_ServerStatusData $ServerStatusData Server status data
*
* @return string
*/
function PMA_getHtmlForServerStateGeneralInfo($ServerStatusData)
{
$start_time = $GLOBALS['dbi']->fetchValue('SELECT UNIX_TIMESTAMP() - ' . $ServerStatusData->status['Uptime']);
$retval = '<h3>';
$bytes_received = $ServerStatusData->status['Bytes_received'];
$bytes_sent = $ServerStatusData->status['Bytes_sent'];
$retval .= sprintf(__('Network traffic since startup: %s'), implode(' ', PMA_Util::formatByteDown($bytes_received + $bytes_sent, 3, 1)));
$retval .= '</h3>';
$retval .= '<p>';
$retval .= sprintf(__('This MySQL server has been running for %1$s. It started up on %2$s.'), PMA_Util::timespanFormat($ServerStatusData->status['Uptime']), PMA_Util::localisedDate($start_time)) . "\n";
$retval .= '</p>';
if ($GLOBALS['replication_info']['master']['status'] || $GLOBALS['replication_info']['slave']['status']) {
$retval .= '<p class="notice">';
if ($GLOBALS['replication_info']['master']['status'] && $GLOBALS['replication_info']['slave']['status']) {
$retval .= __('This MySQL server works as <b>master</b> and ' . '<b>slave</b> in <b>replication</b> process.');
} elseif ($GLOBALS['replication_info']['master']['status']) {
$retval .= __('This MySQL server works as <b>master</b> ' . 'in <b>replication</b> process.');
} elseif ($GLOBALS['replication_info']['slave']['status']) {
$retval .= __('This MySQL server works as <b>slave</b> ' . 'in <b>replication</b> process.');
}
$retval .= '</p>';
}
/*
* if the server works as master or slave in replication process,
* display useful information
*/
if ($GLOBALS['replication_info']['master']['status'] || $GLOBALS['replication_info']['slave']['status']) {
$retval .= '<hr class="clearfloat" />';
$retval .= '<h3><a name="replication">';
$retval .= __('Replication status');
$retval .= '</a></h3>';
foreach ($GLOBALS['replication_types'] as $type) {
if (isset($GLOBALS['replication_info'][$type]['status']) && $GLOBALS['replication_info'][$type]['status']) {
$retval .= PMA_getHtmlForReplicationStatusTable($type);
}
}
}
return $retval;
}
示例5: dataDictionaryDoc
/**
* Generates data dictionary pages.
*
* @param array $alltables Tables to document.
*
* @return void
*/
public function dataDictionaryDoc($alltables)
{
// TOC
$this->diagram->addpage($this->orientation);
$this->diagram->Cell(0, 9, __('Table of contents'), 1, 0, 'C');
$this->diagram->Ln(15);
$i = 1;
foreach ($alltables as $table) {
$this->diagram->PMA_links['doc'][$table]['-'] = $this->diagram->AddLink();
$this->diagram->SetX(10);
// $this->diagram->Ln(1);
$this->diagram->Cell(0, 6, __('Page number:') . ' {' . sprintf("%02d", $i) . '}', 0, 0, 'R', 0, $this->diagram->PMA_links['doc'][$table]['-']);
$this->diagram->SetX(10);
$this->diagram->Cell(0, 6, $i . ' ' . $table, 0, 1, 'L', 0, $this->diagram->PMA_links['doc'][$table]['-']);
// $this->diagram->Ln(1);
$fields = $GLOBALS['dbi']->getColumns($this->db, $table);
foreach ($fields as $row) {
$this->diagram->SetX(20);
$field_name = $row['Field'];
$this->diagram->PMA_links['doc'][$table][$field_name] = $this->diagram->AddLink();
//$this->diagram->Cell(
// 0, 6, $field_name, 0, 1,
// 'L', 0, $this->diagram->PMA_links['doc'][$table][$field_name]
//);
}
$i++;
}
$this->diagram->PMA_links['RT']['-'] = $this->diagram->AddLink();
$this->diagram->SetX(10);
$this->diagram->Cell(0, 6, __('Page number:') . ' {00}', 0, 0, 'R', 0, $this->diagram->PMA_links['RT']['-']);
$this->diagram->SetX(10);
$this->diagram->Cell(0, 6, $i . ' ' . __('Relational schema'), 0, 1, 'L', 0, $this->diagram->PMA_links['RT']['-']);
$z = 0;
foreach ($alltables as $table) {
$z++;
$this->diagram->SetAutoPageBreak(true, 15);
$this->diagram->addpage($this->orientation);
$this->diagram->Bookmark($table);
$this->diagram->SetAlias('{' . sprintf("%02d", $z) . '}', $this->diagram->PageNo());
$this->diagram->PMA_links['RT'][$table]['-'] = $this->diagram->AddLink();
$this->diagram->SetLink($this->diagram->PMA_links['doc'][$table]['-'], -1);
$this->diagram->SetFont($this->_ff, 'B', 18);
$this->diagram->Cell(0, 8, $z . ' ' . $table, 1, 1, 'C', 0, $this->diagram->PMA_links['RT'][$table]['-']);
$this->diagram->SetFont($this->_ff, '', 8);
$this->diagram->ln();
$cfgRelation = PMA_getRelationsParam();
$comments = PMA_getComments($this->db, $table);
if ($cfgRelation['mimework']) {
$mime_map = PMA_getMIME($this->db, $table, true);
}
/**
* Gets table information
*/
$showtable = $GLOBALS['dbi']->getTable($this->db, $table)->getStatusInfo();
$show_comment = isset($showtable['Comment']) ? $showtable['Comment'] : '';
$create_time = isset($showtable['Create_time']) ? PMA_Util::localisedDate(strtotime($showtable['Create_time'])) : '';
$update_time = isset($showtable['Update_time']) ? PMA_Util::localisedDate(strtotime($showtable['Update_time'])) : '';
$check_time = isset($showtable['Check_time']) ? PMA_Util::localisedDate(strtotime($showtable['Check_time'])) : '';
/**
* Gets fields properties
*/
$columns = $GLOBALS['dbi']->getColumns($this->db, $table);
// Check if we can use Relations
if (!empty($cfgRelation['relation'])) {
// Find which tables are related with the current one and write it in
// an array
$res_rel = PMA_getForeigners($this->db, $table);
}
// end if
/**
* Displays the comments of the table if MySQL >= 3.23
*/
$break = false;
if (!empty($show_comment)) {
$this->diagram->Cell(0, 3, __('Table comments:') . ' ' . $show_comment, 0, 1);
$break = true;
}
if (!empty($create_time)) {
$this->diagram->Cell(0, 3, __('Creation:') . ' ' . $create_time, 0, 1);
$break = true;
}
if (!empty($update_time)) {
$this->diagram->Cell(0, 3, __('Last update:') . ' ' . $update_time, 0, 1);
$break = true;
}
if (!empty($check_time)) {
$this->diagram->Cell(0, 3, __('Last check:') . ' ' . $check_time, 0, 1);
$break = true;
}
if ($break == true) {
$this->diagram->Cell(0, 3, '', 0, 1);
$this->diagram->Ln();
}
//.........这里部分代码省略.........
示例6: exportHeader
/**
* Outputs export header
*
* @return bool Whether it succeeded
*/
public function exportHeader()
{
global $crlf;
global $cfg;
$head = '% phpMyAdmin LaTeX Dump' . $crlf . '% version ' . PMA_VERSION . $crlf . '% http://www.phpmyadmin.net' . $crlf . '%' . $crlf . '% ' . __('Host:') . ' ' . $cfg['Server']['host'];
if (!empty($cfg['Server']['port'])) {
$head .= ':' . $cfg['Server']['port'];
}
$head .= $crlf . '% ' . __('Generation Time:') . ' ' . PMA_Util::localisedDate() . $crlf . '% ' . __('Server version:') . ' ' . PMA_MYSQL_STR_VERSION . $crlf . '% ' . __('PHP Version:') . ' ' . phpversion() . $crlf;
return PMA_exportOutputHandler($head);
}
示例7: getServerTrafficHtml
/**
* Prints server traffic information
*
* @param Object $ServerStatusData An instance of the PMA_ServerStatusData class
*
* @return string
*/
function getServerTrafficHtml($ServerStatusData)
{
$hour_factor = 3600 / $ServerStatusData->status['Uptime'];
$start_time = PMA_DBI_fetch_value('SELECT UNIX_TIMESTAMP() - ' . $ServerStatusData->status['Uptime']);
$retval = '<h3>';
$retval .= sprintf(__('Network traffic since startup: %s'), implode(' ', PMA_Util::formatByteDown($ServerStatusData->status['Bytes_received'] + $ServerStatusData->status['Bytes_sent'], 3, 1)));
$retval .= '</h3>';
$retval .= '<p>';
$retval .= sprintf(__('This MySQL server has been running for %1$s. It started up on %2$s.'), PMA_Util::timespanFormat($ServerStatusData->status['Uptime']), PMA_Util::localisedDate($start_time)) . "\n";
$retval .= '</p>';
if ($GLOBALS['server_master_status'] || $GLOBALS['server_slave_status']) {
$retval .= '<p class="notice">';
if ($GLOBALS['server_master_status'] && $GLOBALS['server_slave_status']) {
$retval .= __('This MySQL server works as <b>master</b> and ' . '<b>slave</b> in <b>replication</b> process.');
} elseif ($GLOBALS['server_master_status']) {
$retval .= __('This MySQL server works as <b>master</b> ' . 'in <b>replication</b> process.');
} elseif ($GLOBALS['server_slave_status']) {
$retval .= __('This MySQL server works as <b>slave</b> ' . 'in <b>replication</b> process.');
}
$retval .= ' ';
$retval .= __('For further information about replication status on the server, ' . 'please visit the <a href="#replication">replication section</a>.');
$retval .= '</p>';
}
/*
* if the server works as master or slave in replication process,
* display useful information
*/
if ($GLOBALS['server_master_status'] || $GLOBALS['server_slave_status']) {
$retval .= '<hr class="clearfloat" />';
$retval .= '<h3><a name="replication">';
$retval .= __('Replication status');
$retval .= '</a></h3>';
foreach ($GLOBALS['replication_types'] as $type) {
if (isset(${"server_{$type}_status"}) && ${"server_{$type}_status"}) {
PMA_replication_print_status_table($type);
}
}
}
$retval .= '<table id="serverstatustraffic" class="data noclick">';
$retval .= '<thead>';
$retval .= '<tr>';
$retval .= '<th colspan="2">';
$retval .= __('Traffic') . ' ';
$retval .= PMA_Util::showHint(__('On a busy server, the byte counters may overrun, so those statistics ' . 'as reported by the MySQL server may be incorrect.'));
$retval .= '</th>';
$retval .= '<th>ø ' . __('per hour') . '</th>';
$retval .= '</tr>';
$retval .= '</thead>';
$retval .= '<tbody>';
$retval .= '<tr class="odd">';
$retval .= '<th class="name">' . __('Received') . '</th>';
$retval .= '<td class="value">';
$retval .= implode(' ', PMA_Util::formatByteDown($ServerStatusData->status['Bytes_received'], 3, 1));
$retval .= '</td>';
$retval .= '<td class="value">';
$retval .= implode(' ', PMA_Util::formatByteDown($ServerStatusData->status['Bytes_received'] * $hour_factor, 3, 1));
$retval .= '</td>';
$retval .= '</tr>';
$retval .= '<tr class="even">';
$retval .= '<th class="name">' . __('Sent') . '</th>';
$retval .= '<td class="value">';
$retval .= implode(' ', PMA_Util::formatByteDown($ServerStatusData->status['Bytes_sent'], 3, 1));
$retval .= '</td>';
$retval .= '<td class="value"><?php echo';
$retval .= implode(' ', PMA_Util::formatByteDown($ServerStatusData->status['Bytes_sent'] * $hour_factor, 3, 1));
$retval .= '</td>';
$retval .= '</tr>';
$retval .= '<tr class="odd">';
$retval .= '<th class="name">' . __('Total') . '</th>';
$retval .= '<td class="value">';
$retval .= implode(' ', PMA_Util::formatByteDown($ServerStatusData->status['Bytes_received'] + $ServerStatusData->status['Bytes_sent'], 3, 1));
$retval .= '</td>';
$retval .= '<td class="value">';
$retval .= implode(' ', PMA_Util::formatByteDown(($ServerStatusData->status['Bytes_received'] + $ServerStatusData->status['Bytes_sent']) * $hour_factor, 3, 1));
$retval .= '</td>';
$retval .= '</tr>';
$retval .= '</tbody>';
$retval .= '</table>';
$retval .= '<table id="serverstatusconnections" class="data noclick">';
$retval .= '<thead>';
$retval .= '<tr>';
$retval .= '<th colspan="2">' . __('Connections') . '</th>';
$retval .= '<th>ø ' . __('per hour') . '</th>';
$retval .= '<th>%</th>';
$retval .= '</tr>';
$retval .= '</thead>';
$retval .= '<tbody>';
$retval .= '<tr class="odd">';
$retval .= '<th class="name">' . __('max. concurrent connections') . '</th>';
$retval .= '<td class="value">';
$retval .= PMA_Util::formatNumber($ServerStatusData->status['Max_used_connections'], 0);
$retval .= '</td>';
$retval .= '<td class="value">--- </td>';
//.........这里部分代码省略.........
示例8: testLocalisedDate
/**
* localised date test, globals are defined
*
* @param string $a Current timestamp
* @param string $b Format
* @param string $e Expected output
*
* @return void
*
* @dataProvider localisedDateDataProvider
*/
public function testLocalisedDate($a, $b, $e)
{
$this->assertEquals($e, PMA_Util::localisedDate($a, $b));
}
示例9: getTableDef
/**
* 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 $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
*
* @return string resulting schema
*/
public function getTableDef($db, $table, $crlf, $error_url, $show_dates = false, $add_semicolon = true, $view = false)
{
global $sql_drop_table, $sql_backquotes, $sql_constraints, $sql_constraints_query, $sql_drop_foreign_keys;
$schema_create = '';
$auto_increment = '';
$new_crlf = $crlf;
if (isset($GLOBALS['sql_compatibility'])) {
$compat = $GLOBALS['sql_compatibility'];
} else {
$compat = 'NONE';
}
// need to use PMA_DBI_QUERY_STORE with PMA_DBI_num_rows() in mysqli
$result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_Util::backquote($db) . ' LIKE \'' . PMA_Util::sqlAddSlashes($table, true) . '\'', null, PMA_DBI_QUERY_STORE);
if ($result != false) {
if (PMA_DBI_num_rows($result) > 0) {
$tmpres = PMA_DBI_fetch_assoc($result);
if (PMA_DRIZZLE && $show_dates) {
// Drizzle doesn't give Create_time and Update_time in
// SHOW TABLE STATUS, add it
$sql = "SELECT\n TABLE_CREATION_TIME AS Create_time,\n TABLE_UPDATE_TIME AS Update_time\n FROM data_dictionary.TABLES\n WHERE TABLE_SCHEMA = '" . PMA_Util::sqlAddSlashes($db) . "'\n AND TABLE_NAME = '" . PMA_Util::sqlAddSlashes($table) . "'";
$tmpres = array_merge(PMA_DBI_fetch_single_row($sql), $tmpres);
}
// Here we optionally add the AUTO_INCREMENT next value,
// but starting with MySQL 5.0.24, the clause is already included
// in SHOW CREATE TABLE so we'll remove it below
// It's required for Drizzle because SHOW CREATE TABLE uses
// the value from table's creation time
if (isset($GLOBALS['sql_auto_increment']) && !empty($tmpres['Auto_increment'])) {
$auto_increment .= ' AUTO_INCREMENT=' . $tmpres['Auto_increment'] . ' ';
}
if ($show_dates && isset($tmpres['Create_time']) && !empty($tmpres['Create_time'])) {
$schema_create .= $this->_exportComment(__('Creation') . ': ' . PMA_Util::localisedDate(strtotime($tmpres['Create_time'])));
$new_crlf = $this->_exportComment() . $crlf;
}
if ($show_dates && isset($tmpres['Update_time']) && !empty($tmpres['Update_time'])) {
$schema_create .= $this->_exportComment(__('Last update') . ': ' . PMA_Util::localisedDate(strtotime($tmpres['Update_time'])));
$new_crlf = $this->_exportComment() . $crlf;
}
if ($show_dates && isset($tmpres['Check_time']) && !empty($tmpres['Check_time'])) {
$schema_create .= $this->_exportComment(__('Last check') . ': ' . PMA_Util::localisedDate(strtotime($tmpres['Check_time'])));
$new_crlf = $this->_exportComment() . $crlf;
}
}
PMA_DBI_free_result($result);
}
$schema_create .= $new_crlf;
// no need to generate a DROP VIEW here, it was done earlier
if (!empty($sql_drop_table) && !PMA_Table::isView($db, $table)) {
$schema_create .= 'DROP TABLE IF EXISTS ' . PMA_Util::backquote($table, $sql_backquotes) . ';' . $crlf;
}
// Complete table dump,
// Whether to quote table and column names or not
// Drizzle always quotes names
if (!PMA_DRIZZLE) {
if ($sql_backquotes) {
PMA_DBI_query('SET SQL_QUOTE_SHOW_CREATE = 1');
} else {
PMA_DBI_query('SET SQL_QUOTE_SHOW_CREATE = 0');
}
}
// I don't see the reason why this unbuffered query could cause problems,
// because SHOW CREATE TABLE returns only one row, and we free the
// results below. Nonetheless, we got 2 user reports about this
// (see bug 1562533) so I removed the unbuffered mode.
// $result = PMA_DBI_query('SHOW CREATE TABLE ' . backquote($db)
// . '.' . backquote($table), null, PMA_DBI_QUERY_UNBUFFERED);
//
// Note: SHOW CREATE TABLE, at least in MySQL 5.1.23, does not
// produce a displayable result for the default value of a BIT
// column, nor does the mysqldump command. See MySQL bug 35796
$result = PMA_DBI_try_query('SHOW CREATE TABLE ' . PMA_Util::backquote($db) . '.' . PMA_Util::backquote($table));
// an error can happen, for example the table is crashed
$tmp_error = PMA_DBI_getError();
if ($tmp_error) {
return $this->_exportComment(__('in use') . '(' . $tmp_error . ')');
}
if ($result != false && ($row = PMA_DBI_fetch_row($result))) {
$create_query = $row[1];
unset($row);
// Convert end of line chars to one that we want (note that MySQL
// doesn't return query it will accept in all cases)
if (strpos($create_query, "(\r\n ")) {
$create_query = str_replace("\r\n", $crlf, $create_query);
} elseif (strpos($create_query, "(\n ")) {
$create_query = str_replace("\n", $crlf, $create_query);
//.........这里部分代码省略.........
示例10: exportHeader
/**
* Outputs export header. It is the first method to be called, so all
* the required variables are initialized here.
*
* @return bool Whether it succeeded
*/
public function exportHeader()
{
$this->initSpecificVariables();
global $crlf, $cfg, $db;
$table = $this->_getTable();
$tables = $this->_getTables();
$export_struct = isset($GLOBALS['xml_export_functions']) || isset($GLOBALS['xml_export_procedures']) || isset($GLOBALS['xml_export_tables']) || isset($GLOBALS['xml_export_triggers']) || isset($GLOBALS['xml_export_views']);
$export_data = isset($GLOBALS['xml_export_contents']) ? true : false;
if ($GLOBALS['output_charset_conversion']) {
$charset = $GLOBALS['charset'];
} else {
$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 .= $crlf . '- ' . __('Generation Time:') . ' ' . PMA_Util::localisedDate() . $crlf . '- ' . __('Server version:') . ' ' . PMA_MYSQL_STR_VERSION . $crlf . '- ' . __('PHP Version:') . ' ' . phpversion() . $crlf . '-->' . $crlf . $crlf;
$head .= '<pma_xml_export version="1.0"' . ($export_struct ? ' xmlns:pma="http://www.phpmyadmin.net/some_doc_url/"' : '') . '>' . $crlf;
if ($export_struct) {
if (PMA_DRIZZLE) {
$result = $GLOBALS['dbi']->fetchResult("SELECT\n 'utf8' AS DEFAULT_CHARACTER_SET_NAME,\n DEFAULT_COLLATION_NAME\n FROM data_dictionary.SCHEMAS\n WHERE SCHEMA_NAME = '" . PMA_Util::sqlAddSlashes($db) . "'");
} else {
$result = $GLOBALS['dbi']->fetchResult('SELECT `DEFAULT_CHARACTER_SET_NAME`, `DEFAULT_COLLATION_NAME`' . ' FROM `information_schema`.`SCHEMATA` WHERE `SCHEMA_NAME`' . ' = \'' . PMA_Util::sqlAddSlashes($db) . '\' LIMIT 1');
}
$db_collation = $result[0]['DEFAULT_COLLATION_NAME'];
$db_charset = $result[0]['DEFAULT_CHARACTER_SET_NAME'];
$head .= ' <!--' . $crlf;
$head .= ' - Structure schemas' . $crlf;
$head .= ' -->' . $crlf;
$head .= ' <pma:structure_schemas>' . $crlf;
$head .= ' <pma:database name="' . htmlspecialchars($db) . '" collation="' . $db_collation . '" charset="' . $db_charset . '">' . $crlf;
if (count($tables) == 0) {
$tables[] = $table;
}
foreach ($tables as $table) {
// Export tables and views
$result = $GLOBALS['dbi']->fetchResult('SHOW CREATE TABLE ' . PMA_Util::backquote($db) . '.' . PMA_Util::backquote($table), 0);
$tbl = $result[$table][1];
$is_view = $GLOBALS['dbi']->getTable($db, $table)->isView();
if ($is_view) {
$type = 'view';
} else {
$type = 'table';
}
if ($is_view && !isset($GLOBALS['xml_export_views'])) {
continue;
}
if (!$is_view && !isset($GLOBALS['xml_export_tables'])) {
continue;
}
$head .= ' <pma:' . $type . ' name="' . $table . '">' . $crlf;
$tbl = " " . htmlspecialchars($tbl);
$tbl = str_replace("\n", "\n ", $tbl);
$head .= $tbl . ';' . $crlf;
$head .= ' </pma:' . $type . '>' . $crlf;
if (isset($GLOBALS['xml_export_triggers']) && $GLOBALS['xml_export_triggers']) {
// Export triggers
$triggers = $GLOBALS['dbi']->getTriggers($db, $table);
if ($triggers) {
foreach ($triggers as $trigger) {
$code = $trigger['create'];
$head .= ' <pma:trigger name="' . $trigger['name'] . '">' . $crlf;
// Do some formatting
$code = mb_substr(rtrim($code), 0, -3);
$code = " " . htmlspecialchars($code);
$code = str_replace("\n", "\n ", $code);
$head .= $code . $crlf;
$head .= ' </pma:trigger>' . $crlf;
}
unset($trigger);
unset($triggers);
}
}
}
if (isset($GLOBALS['xml_export_functions']) && $GLOBALS['xml_export_functions']) {
// Export functions
$functions = $GLOBALS['dbi']->getProceduresOrFunctions($db, 'FUNCTION');
if ($functions) {
foreach ($functions as $function) {
$head .= ' <pma:function name="' . $function . '">' . $crlf;
// Do some formatting
$sql = $GLOBALS['dbi']->getDefinition($db, 'FUNCTION', $function);
$sql = rtrim($sql);
$sql = " " . htmlspecialchars($sql);
$sql = str_replace("\n", "\n ", $sql);
$head .= $sql . $crlf;
$head .= ' </pma:function>' . $crlf;
}
unset($function);
unset($functions);
}
}
if (isset($GLOBALS['xml_export_procedures']) && $GLOBALS['xml_export_procedures']) {
//.........这里部分代码省略.........
示例11: __
if ($cfg['Server']['verbose']) {
$hostname = $cfg['Server']['verbose'];
} else {
$hostname = $cfg['Server']['host'];
if (!empty($cfg['Server']['port'])) {
$hostname .= $cfg['Server']['port'];
}
}
$versions = "phpMyAdmin " . PMA_VERSION;
$versions .= " / ";
$versions .= "MySQL " . PMA_MYSQL_STR_VERSION;
echo "<h1>" . __('SQL result') . "</h1>";
echo "<p>";
echo "<strong>" . __('Host') . ":</strong> {$hostname}<br />";
echo "<strong>" . __('Database') . ":</strong> " . htmlspecialchars($db) . "<br />";
echo "<strong>" . __('Generation Time') . ":</strong> " . PMA_Util::localisedDate() . "<br />";
echo "<strong>" . __('Generated by') . ":</strong> {$versions}<br />";
echo "<strong>" . __('SQL query') . ":</strong> " . htmlspecialchars($full_sql_query) . ";";
if (isset($num_rows)) {
echo "<br />";
echo "<strong>" . __('Rows') . ":</strong> {$num_rows}";
}
echo "</p>";
} else {
$response = PMA_Response::getInstance();
$header = $response->getHeader();
$scripts = $header->getScripts();
$scripts->addFile('makegrid.js');
$scripts->addFile('sql.js');
unset($message);
if (!$GLOBALS['is_ajax_request']) {
示例12: __
}
if (isset($showtable['Update_time'])) {
echo "\n";
echo '<tr>';
echo '<td>' . __('Last update') . '</td>';
echo '<td class="right">';
echo PMA_Util::localisedDate(strtotime($showtable['Update_time']));
echo '</td>';
echo '</tr>';
}
if (isset($showtable['Check_time'])) {
echo "\n";
echo '<tr>';
echo '<td>' . __('Last check') . '</td>';
echo '<td class="right">';
echo PMA_Util::localisedDate(strtotime($showtable['Check_time']));
echo '</td>';
echo '</tr>';
}
echo "\n";
echo '</table>';
echo '</td>';
echo '</tr>';
echo '</table>';
}
// end if ($nonisam == false)
}
// end if ($cfg['ShowStats'])
}
if ($multi_tables) {
unset($num_rows, $show_comment);
示例13: PMA_getHtmlForOneDate
/**
* Function to get html for one of the db dates
*
* @param string $title the title
* @param string $date which date to display
*
* @return string html content
*/
function PMA_getHtmlForOneDate($title, $date)
{
$html = '<tr>' . '<td class="right">' . $title . '</td>' . '<td class="right">' . PMA_Util::localisedDate(strtotime($date)) . '</td>' . '</tr>';
return $html;
}
示例14: __
<td class="right"><?php
echo PMA_Util::localisedDate(strtotime($sts_data['Update_time']));
?>
</td>
</tr>
<?php
}
if (!empty($sts_data['Check_time'])) {
?>
<tr>
<td class="right"><?php
echo __('Last check') . ': ';
?>
</td>
<td class="right"><?php
echo PMA_Util::localisedDate(strtotime($sts_data['Check_time']));
?>
</td>
</tr>
<?php
}
?>
</table>
<?php
}
?>
</td>
</tr>
<?php
}
?>
示例15: getHtmlForRowStatsTable
/**
* Get HTML snippet for display Row statistics table
*
* @param array $showtable show table array
* @param string $tbl_collation table collation
* @param boolean $is_innodb whether table is innob or not
* @param boolean $mergetable Checks if current table is a merge table
* @param integer $avg_size average size
* @param string $avg_unit average unit
*
* @return string $html_output
*/
function getHtmlForRowStatsTable($showtable, $tbl_collation, $is_innodb, $mergetable, $avg_size, $avg_unit)
{
$odd_row = false;
$html_output = '<table id="tablerowstats" class="data">';
$html_output .= '<caption class="tblHeaders">' . __('Row statistics') . '</caption>';
$html_output .= '<tbody>';
if (isset($showtable['Row_format'])) {
if ($showtable['Row_format'] == 'Fixed') {
$value = __('static');
} elseif ($showtable['Row_format'] == 'Dynamic') {
$value = __('dynamic');
} else {
$value = $showtable['Row_format'];
}
$html_output .= PMA_getHtmlForRowStatsTableRow($odd_row, __('Format'), $value);
$odd_row = !$odd_row;
}
if (!empty($showtable['Create_options'])) {
if ($showtable['Create_options'] == 'partitioned') {
$value = __('partitioned');
} else {
$value = $showtable['Create_options'];
}
$html_output .= PMA_getHtmlForRowStatsTableRow($odd_row, __('Options'), $value);
$odd_row = !$odd_row;
}
if (!empty($tbl_collation)) {
$value = '<dfn title="' . PMA_getCollationDescr($tbl_collation) . '">' . $tbl_collation . '</dfn>';
$html_output .= PMA_getHtmlForRowStatsTableRow($odd_row, __('Collation'), $value);
$odd_row = !$odd_row;
}
if (!$is_innodb && isset($showtable['Rows'])) {
$html_output .= PMA_getHtmlForRowStatsTableRow($odd_row, __('Rows'), PMA_Util::formatNumber($showtable['Rows'], 0));
$odd_row = !$odd_row;
}
if (!$is_innodb && isset($showtable['Avg_row_length']) && $showtable['Avg_row_length'] > 0) {
list($avg_row_length_value, $avg_row_length_unit) = PMA_Util::formatByteDown($showtable['Avg_row_length'], 6, 1);
$html_output .= PMA_getHtmlForRowStatsTableRow($odd_row, __('Row length'), $avg_row_length_value . ' ' . $avg_row_length_unit);
unset($avg_row_length_value, $avg_row_length_unit);
$odd_row = !$odd_row;
}
if (!$is_innodb && isset($showtable['Data_length']) && $showtable['Rows'] > 0 && $mergetable == false) {
$html_output .= PMA_getHtmlForRowStatsTableRow($odd_row, __('Row size'), $avg_size . ' ' . $avg_unit);
$odd_row = !$odd_row;
}
if (isset($showtable['Auto_increment'])) {
$html_output .= PMA_getHtmlForRowStatsTableRow($odd_row, __('Next autoindex'), PMA_Util::formatNumber($showtable['Auto_increment'], 0));
$odd_row = !$odd_row;
}
if (isset($showtable['Create_time'])) {
$html_output .= PMA_getHtmlForRowStatsTableRow($odd_row, __('Creation'), PMA_Util::localisedDate(strtotime($showtable['Create_time'])));
$odd_row = !$odd_row;
}
if (isset($showtable['Update_time'])) {
$html_output .= PMA_getHtmlForRowStatsTableRow($odd_row, __('Last update'), PMA_Util::localisedDate(strtotime($showtable['Update_time'])));
$odd_row = !$odd_row;
}
if (isset($showtable['Check_time'])) {
$html_output .= PMA_getHtmlForRowStatsTableRow($odd_row, __('Last check'), PMA_Util::localisedDate(strtotime($showtable['Check_time'])));
}
$html_output .= '</tbody>' . '</table>';
return $html_output;
}