本文整理汇总了PHP中PMA_localisedDate函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_localisedDate函数的具体用法?PHP PMA_localisedDate怎么用?PHP PMA_localisedDate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_localisedDate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_printGitRevision
/**
* Prints details about the current Git commit revision
*/
function PMA_printGitRevision()
{
if (!$GLOBALS['PMA_Config']->get('PMA_VERSION_GIT')) {
PMA_ajaxResponse('', false);
}
// 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') . ')';
}
ob_start();
$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_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_localisedDate(strtotime($author['date'])), '<a href="' . PMA_linkURL('mailto:' . $author['email']) . '">' . htmlspecialchars($author['name']) . '</a>') : ''), 'li_pma_version_git', null, null, null);
$item = ob_get_contents();
ob_end_clean();
PMA_ajaxResponse($item, true);
}
示例2: PMA_exportHeader
/**
* Outputs export header
*
* @return bool Whether it suceeded
*
* @access public
*/
function PMA_exportHeader() {
global $crlf;
global $cfg;
if ($GLOBALS['output_charset_conversion']) {
$charset = $GLOBALS['charset_of_file'];
} else {
$charset = $GLOBALS['charset'];
}
$head = '<?xml version="1.0" encoding="' . $charset . '" ?>' . $crlf
. '<!--' . $crlf
. '-' . $crlf
. '- phpMyAdmin XML Dump' . $crlf
. '- version ' . PMA_VERSION . $crlf
. '- http://www.phpmyadmin.net' . $crlf
. '-' . $crlf
. '- ' . $GLOBALS['strHost'] . ': ' . $cfg['Server']['host'];
if (!empty($cfg['Server']['port'])) {
$head .= ':' . $cfg['Server']['port'];
}
$head .= $crlf
. '- ' . $GLOBALS['strGenTime'] . ': ' . PMA_localisedDate() . $crlf
. '- ' . $GLOBALS['strServerVersion'] . ': ' . substr(PMA_MYSQL_INT_VERSION, 0, 1) . '.' . (int) substr(PMA_MYSQL_INT_VERSION, 1, 2) . '.' . (int) substr(PMA_MYSQL_INT_VERSION, 3) . $crlf
. '- ' . $GLOBALS['strPHPVersion'] . ': ' . phpversion() . $crlf
. '-->' . $crlf . $crlf;
return PMA_exportOutputHandler($head);
}
示例3: PMA_fillTooltip
/**
* fills given tooltip arrays
*
* @uses $cfg['ShowTooltipAliasTB']
* @uses $GLOBALS['strStatCreateTime']
* @uses PMA_localisedDate()
* @uses strtotime()
* @param array $tooltip_truename tooltip data
* @param array $tooltip_aliasname tooltip data
* @param array $table tabledata
*/
function PMA_fillTooltip(&$tooltip_truename, &$tooltip_aliasname, $table)
{
if (empty($table['Comment'])) {
$table['Comment'] = $table['Name'];
} else {
// why?
$table['Comment'] .= ' ';
}
if ($GLOBALS['cfg']['ShowTooltipAliasTB'] && $GLOBALS['cfg']['ShowTooltipAliasTB'] != 'nested') {
$tooltip_truename[$table['Name']] = $table['Comment'];
$tooltip_aliasname[$table['Name']] = $table['Name'];
} else {
$tooltip_truename[$table['Name']] = $table['Name'];
$tooltip_aliasname[$table['Name']] = $table['Comment'];
}
if (isset($table['Create_time']) && !empty($table['Create_time'])) {
$tooltip_aliasname[$table['Name']] .= ', ' . $GLOBALS['strStatCreateTime'] . ': ' . PMA_localisedDate(strtotime($table['Create_time']));
}
if (!empty($table['Update_time'])) {
$tooltip_aliasname[$table['Name']] .= ', ' . $GLOBALS['strStatUpdateTime'] . ': ' . PMA_localisedDate(strtotime($table['Update_time']));
}
if (!empty($table['Check_time'])) {
$tooltip_aliasname[$table['Name']] .= ', ' . $GLOBALS['strStatCheckTime'] . ': ' . PMA_localisedDate(strtotime($table['Check_time']));
}
}
示例4: PMA_exportHeader
/**
* Outputs export header
*
* @return bool Whether it suceeded
*
* @access public
*/
function PMA_exportHeader()
{
global $crlf;
global $cfg;
$head = '% phpMyAdmin LaTeX Dump' . $crlf . '% version ' . PMA_VERSION . $crlf . '% http://www.phpmyadmin.net' . $crlf . '%' . $crlf . '% ' . $GLOBALS['strHost'] . ': ' . $cfg['Server']['host'];
if (!empty($cfg['Server']['port'])) {
$head .= ':' . $cfg['Server']['port'];
}
$head .= $crlf . '% ' . $GLOBALS['strGenTime'] . ': ' . PMA_localisedDate() . $crlf . '% ' . $GLOBALS['strServerVersion'] . ': ' . substr(PMA_MYSQL_INT_VERSION, 0, 1) . '.' . (int) substr(PMA_MYSQL_INT_VERSION, 1, 2) . '.' . (int) substr(PMA_MYSQL_INT_VERSION, 3) . $crlf . '% ' . $GLOBALS['strPHPVersion'] . ': ' . phpversion() . $crlf;
return PMA_exportOutputHandler($head);
}
示例5: fillTooltip
function fillTooltip(&$tooltip_truename, &$tooltip_aliasname, &$tmp)
{
$tooltip_truename[$tmp['Name']] = $GLOBALS['cfg']['ShowTooltipAliasTB'] && $GLOBALS['cfg']['ShowTooltipAliasTB'] != 'nested' ? !empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : $tmp['Name'] : $tmp['Name'];
$tooltip_aliasname[$tmp['Name']] = $GLOBALS['cfg']['ShowTooltipAliasTB'] && $GLOBALS['cfg']['ShowTooltipAliasTB'] != 'nested' ? $tmp['Name'] : (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : $tmp['Name']);
if (isset($tmp['Create_time']) && !empty($tmp['Create_time'])) {
$tooltip_aliasname[$tmp['Name']] .= ', ' . $GLOBALS['strStatCreateTime'] . ': ' . PMA_localisedDate(strtotime($tmp['Create_time']));
}
if (isset($tmp['Update_time']) && !empty($tmp['Update_time'])) {
$tooltip_aliasname[$tmp['Name']] .= ', ' . $GLOBALS['strStatUpdateTime'] . ': ' . PMA_localisedDate(strtotime($tmp['Update_time']));
}
if (isset($tmp['Check_time']) && !empty($tmp['Check_time'])) {
$tooltip_aliasname[$tmp['Name']] .= ', ' . $GLOBALS['strStatCheckTime'] . ': ' . PMA_localisedDate(strtotime($tmp['Check_time']));
}
return true;
}
示例6: PMA_transformation_text_plain__dateformat
function PMA_transformation_text_plain__dateformat($buffer, $options = array(), $meta = '')
{
// possibly use a global transform and feed it with special options:
// include('./libraries/transformations/global.inc.php');
// further operations on $buffer using the $options[] array.
if (!isset($options[0]) || $options[0] == '') {
$options[0] = 0;
}
if (!isset($options[1]) || $options[1] == '') {
$options[1] = $GLOBALS['datefmt'];
}
$timestamp = -1;
// Detect TIMESTAMP(6 | 8 | 10 | 12 | 14), (2 | 4) not supported here.
if (preg_match('/^(\\d{2}){3,7}$/', $buffer)) {
if (strlen($buffer) == 14 || strlen($buffer) == 8) {
$offset = 4;
} else {
$offset = 2;
}
$d = array();
$d['year'] = substr($buffer, 0, $offset);
$d['month'] = substr($buffer, $offset, 2);
$d['day'] = substr($buffer, $offset + 2, 2);
$d['hour'] = substr($buffer, $offset + 4, 2);
$d['minute'] = substr($buffer, $offset + 6, 2);
$d['second'] = substr($buffer, $offset + 8, 2);
if (checkdate($d['month'], $d['day'], $d['year'])) {
$timestamp = mktime($d['hour'], $d['minute'], $d['second'], $d['month'], $d['day'], $d['year']);
}
// If all fails, assume one of the dozens of valid strtime() syntaxes (http://www.gnu.org/manual/tar-1.12/html_chapter/tar_7.html)
} else {
$timestamp = strtotime($buffer);
}
// If all above failed, maybe it's a Unix timestamp already?
if ($timestamp < 0 && preg_match('/^[1-9]\\d{1,9}$/', $buffer)) {
$timestamp = $buffer;
}
// Reformat a valid timestamp
if ($timestamp >= 0) {
$timestamp -= $options[0] * 60 * 60;
$source = $buffer;
$buffer = '<dfn onclick="alert(\'' . $source . '\');" title="' . $source . '">' . PMA_localisedDate($timestamp, $options[1]) . '</dfn>';
}
return $buffer;
}
示例7: PMA_fillTooltip
/**
* fills given tooltip arrays
*
* @param array $tooltip_truename tooltip data
* @param array $tooltip_aliasname tooltip data
* @param array $table tabledata
*/
function PMA_fillTooltip(&$tooltip_truename, &$tooltip_aliasname, $table)
{
if (strstr($table['Comment'], '; InnoDB free') === false) {
if (!strstr($table['Comment'], 'InnoDB free') === false) {
// here we have just InnoDB generated part
$table['Comment'] = '';
}
} else {
// remove InnoDB comment from end, just the minimal part (*? is non greedy)
$table['Comment'] = preg_replace('@; InnoDB free:.*?$@', '', $table['Comment']);
}
// views have VIEW as comment so it's not a real comment put by a user
if ('VIEW' == $table['Comment']) {
$table['Comment'] = '';
}
if (empty($table['Comment'])) {
$table['Comment'] = $table['Name'];
} else {
// why?
$table['Comment'] .= ' ';
}
if ($GLOBALS['cfg']['ShowTooltipAliasTB'] && $GLOBALS['cfg']['ShowTooltipAliasTB'] !== 'nested') {
$tooltip_truename[$table['Name']] = $table['Comment'];
$tooltip_aliasname[$table['Name']] = $table['Name'];
} else {
$tooltip_truename[$table['Name']] = $table['Name'];
$tooltip_aliasname[$table['Name']] = $table['Comment'];
}
if (isset($table['Create_time']) && !empty($table['Create_time'])) {
$tooltip_aliasname[$table['Name']] .= ', ' . __('Creation') . ': ' . PMA_localisedDate(strtotime($table['Create_time']));
}
if (!empty($table['Update_time'])) {
$tooltip_aliasname[$table['Name']] .= ', ' . __('Last update') . ': ' . PMA_localisedDate(strtotime($table['Update_time']));
}
if (!empty($table['Check_time'])) {
$tooltip_aliasname[$table['Name']] .= ', ' . __('Last check') . ': ' . PMA_localisedDate(strtotime($table['Check_time']));
}
}
示例8: PMA_transformation_text_plain__dateformat
/**
*
*/
function PMA_transformation_text_plain__dateformat($buffer, $options = array(), $meta = '')
{
// possibly use a global transform and feed it with special options:
// include './libraries/transformations/global.inc.php';
// further operations on $buffer using the $options[] array.
if (empty($options[0])) {
$options[0] = 0;
}
if (empty($options[2])) {
$options[2] = 'local';
} else {
$options[2] = strtolower($options[2]);
}
if (empty($options[1])) {
if ($options[2] == 'local') {
$options[1] = __('%B %d, %Y at %I:%M %p');
} else {
$options[1] = 'Y-m-d H:i:s';
}
}
$timestamp = -1;
// INT columns will be treated as UNIX timestamps
// and need to be detected before the verification for
// MySQL TIMESTAMP
if ($meta->type == 'int') {
$timestamp = $buffer;
// Detect TIMESTAMP(6 | 8 | 10 | 12 | 14)
// TIMESTAMP (2 | 4) not supported here.
// (Note: prior to MySQL 4.1, TIMESTAMP has a display size, for example
// TIMESTAMP(8) means YYYYMMDD)
} else {
if (preg_match('/^(\\d{2}){3,7}$/', $buffer)) {
if (strlen($buffer) == 14 || strlen($buffer) == 8) {
$offset = 4;
} else {
$offset = 2;
}
$d = array();
$d['year'] = substr($buffer, 0, $offset);
$d['month'] = substr($buffer, $offset, 2);
$d['day'] = substr($buffer, $offset + 2, 2);
$d['hour'] = substr($buffer, $offset + 4, 2);
$d['minute'] = substr($buffer, $offset + 6, 2);
$d['second'] = substr($buffer, $offset + 8, 2);
if (checkdate($d['month'], $d['day'], $d['year'])) {
$timestamp = mktime($d['hour'], $d['minute'], $d['second'], $d['month'], $d['day'], $d['year']);
}
// If all fails, assume one of the dozens of valid strtime() syntaxes (http://www.gnu.org/manual/tar-1.12/html_chapter/tar_7.html)
} else {
if (preg_match('/^[0-9]\\d{1,9}$/', $buffer)) {
$timestamp = (int) $buffer;
} else {
$timestamp = strtotime($buffer);
}
}
}
// If all above failed, maybe it's a Unix timestamp already?
if ($timestamp < 0 && preg_match('/^[1-9]\\d{1,9}$/', $buffer)) {
$timestamp = $buffer;
}
// Reformat a valid timestamp
if ($timestamp >= 0) {
$timestamp -= $options[0] * 60 * 60;
$source = $buffer;
if ($options[2] == 'local') {
$text = PMA_localisedDate($timestamp, $options[1]);
} elseif ($options[2] == 'utc') {
$text = gmdate($options[1], $timestamp);
} else {
$text = 'INVALID DATE TYPE';
}
$buffer = '<dfn onclick="alert(\'' . $source . '\');" title="' . $source . '">' . $text . '</dfn>';
}
return $buffer;
}
示例9: sprintf
echo $strShowStatusReset;
?>
</a>
<a href="<?php
echo $cfg['MySQLManualBase'];
?>
/server-status-variables.html"
target="documentation">MySQL - <?php
echo $strDocu;
?>
</a>
</div>
<p>
<?php
echo sprintf($strServerStatusUptime, PMA_timespanFormat($server_status['Uptime']), PMA_localisedDate($start_time)) . "\n";
?>
</p>
<div id="sectionlinks">
<?php
foreach ($sections as $section_name => $section) {
if (!empty($section['vars']) && !empty($section['title'])) {
echo '<a href="' . PMA_getenv('PHP_SELF') . '?' . PMA_generate_common_url() . '#' . $section_name . '">' . $section['title'] . '</a>' . "\n";
}
}
?>
</div>
<h3><?php
echo $strServerTrafficNotes;
示例10: PMA_generate_common_url
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $available_languages[$lang][2]; ?>" lang="<?php echo $available_languages[$lang][2]; ?>" dir="<?php echo $text_dir; ?>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?>" />
<link rel="icon" href="./favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
<title><?php echo $strSQLResult; ?> - phpMyAdmin <?php echo PMA_VERSION ?></title>
<link rel="stylesheet" type="text/css" href="phpmyadmin.css.php?<?php echo PMA_generate_common_url('', ''); ?>&js_frame=print&nocache=<?php echo $_SESSION['PMA_Config']->getThemeUniqueValue(); ?>" />
</head>
<body bgcolor="#ffffff">
<h1><?php echo $strSQLResult; ?></h1>
<p>
<strong><?php echo $strHost; ?>:</strong> <?php echo $cfg['Server']['verbose'] ? $cfg['Server']['verbose'] : $cfg['Server']['host'] . ((!empty($cfg['Server']['port'])) ? ':' . $cfg['Server']['port'] : ''); ?><br />
<strong><?php echo $strDatabase; ?>:</strong> <?php echo htmlspecialchars($db); ?><br />
<strong><?php echo $strGenTime; ?>:</strong> <?php echo PMA_localisedDate(); ?><br />
<strong><?php echo $strGenBy; ?>:</strong> phpMyAdmin <?php echo PMA_VERSION; ?> / MySQL <?php echo PMA_MYSQL_STR_VERSION; ?><br />
<strong><?php echo $strSQLQuery; ?>:</strong> <?php echo htmlspecialchars($full_sql_query); ?>;
<?php if (isset($num_rows)) { ?><br />
<strong><?php echo $strRows; ?>:</strong> <?php echo $num_rows; ?>
<?php } ?>
</p>
<?php
/**
* Sets a variable to remember headers have been sent
*/
$is_header_sent = TRUE;
?>
示例11: PMA_exportHeader
/**
* Outputs export header
*
* @return bool Whether it succeeded
*
* @access public
*/
function PMA_exportHeader()
{
global $crlf;
global $cfg;
$head = '% phpMyAdmin LaTeX Dump' . $crlf . '% version ' . PMA_VERSION . $crlf . '% http://www.phpmyadmin.net' . $crlf . '%' . $crlf . '% ' . __('Host') . ': ' . $cfg['Server']['host'];
if (!empty($cfg['Server']['port'])) {
$head .= ':' . $cfg['Server']['port'];
}
$head .= $crlf . '% ' . __('Generation Time') . ': ' . PMA_localisedDate() . $crlf . '% ' . __('Server version') . ': ' . PMA_MYSQL_STR_VERSION . $crlf . '% ' . __('PHP Version') . ': ' . phpversion() . $crlf;
return PMA_exportOutputHandler($head);
}
示例12: PMA_generate_common_url
?>
<div id="statuslinks">
<a href="<?php echo
$PMA_PHP_SELF . '?' . PMA_generate_common_url(); ?>"
><?php echo $strRefresh; ?></a>
<a href="<?php echo
$PMA_PHP_SELF . '?flush=STATUS&' . PMA_generate_common_url(); ?>"
><?php echo $strShowStatusReset; ?></a>
<?php echo PMA_showMySQLDocu('server_status_variables','server_status_variables'); ?>
</div>
<p>
<?php
echo sprintf($strServerStatusUptime,
PMA_timespanFormat($server_status['Uptime']),
PMA_localisedDate($start_time)) . "\n";
?>
</p>
<?php
if ($server_master_status_run || $server_slave_status_run) {
$replicationOut = "";
foreach ($replication_types as $type) {
if (${"server_{$type}_status_run"}) {
if ($replicationOut != "") {
$replicationOut .= $strAndSmall . ' ';
}
$replicationOut .= '<b>' . $type . '</b> ';
}
}
echo sprintf('<p>' . $strReplicationStatusInfo . '</p>', $replicationOut);
示例13: PMA_getTableDef
/**
* Returns $table's CREATE definition
*
* @param string the database name
* @param string the table name
* @param string the end of line sequence
* @param string the url to go back in case of error
* @param boolean whether to include creation/update/check dates
*
* @return string resulting schema
*
* @global boolean whether to add 'drop' statements or not
* @global boolean whether to use backquotes to allow the use of special
* characters in database, table and fields names or not
*
* @access public
*/
function PMA_getTableDef($db, $table, $crlf, $error_url, $show_dates = false)
{
global $sql_drop_table;
global $sql_backquotes;
global $cfgRelation;
global $sql_constraints;
global $sql_constraints_query;
// just the text of the query
$schema_create = '';
$auto_increment = '';
$new_crlf = $crlf;
// need to use PMA_DBI_QUERY_STORE with PMA_DBI_num_rows() in mysqli
$result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . PMA_sqlAddslashes($table) . '\'', null, PMA_DBI_QUERY_STORE);
if ($result != FALSE) {
if (PMA_DBI_num_rows($result) > 0) {
$tmpres = PMA_DBI_fetch_assoc($result);
// 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
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 .= PMA_exportComment($GLOBALS['strStatCreateTime'] . ': ' . PMA_localisedDate(strtotime($tmpres['Create_time'])));
$new_crlf = PMA_exportComment() . $crlf;
}
if ($show_dates && isset($tmpres['Update_time']) && !empty($tmpres['Update_time'])) {
$schema_create .= PMA_exportComment($GLOBALS['strStatUpdateTime'] . ': ' . PMA_localisedDate(strtotime($tmpres['Update_time'])));
$new_crlf = PMA_exportComment() . $crlf;
}
if ($show_dates && isset($tmpres['Check_time']) && !empty($tmpres['Check_time'])) {
$schema_create .= PMA_exportComment($GLOBALS['strStatCheckTime'] . ': ' . PMA_localisedDate(strtotime($tmpres['Check_time'])));
$new_crlf = PMA_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_backquote($table, $sql_backquotes) . ';' . $crlf;
}
// Steve Alberty's patch for complete table dump,
// Whether to quote table and fields names or not
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 remove the unbuffered mode.
//$result = PMA_DBI_query('SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_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
// field, nor does the mysqldump command. See MySQL bug 35796
$result = PMA_DBI_query('SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table));
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);
} elseif (strpos($create_query, "(\r ")) {
$create_query = str_replace("\r", $crlf, $create_query);
}
// Should we use IF NOT EXISTS?
if (isset($GLOBALS['sql_if_not_exists'])) {
$create_query = preg_replace('/^CREATE TABLE/', 'CREATE TABLE IF NOT EXISTS', $create_query);
}
// are there any constraints to cut out?
if (preg_match('@CONSTRAINT|FOREIGN[\\s]+KEY@', $create_query)) {
// Split the query into lines, so we can easily handle it. We know lines are separated by $crlf (done few lines above).
$sql_lines = explode($crlf, $create_query);
$sql_count = count($sql_lines);
// lets find first line with constraints
for ($i = 0; $i < $sql_count; $i++) {
if (preg_match('@^[\\s]*(CONSTRAINT|FOREIGN[\\s]+KEY)@', $sql_lines[$i])) {
break;
//.........这里部分代码省略.........
示例14: PMA_getTableDef
/**
* Returns $table's CREATE definition
*
* @param string the database name
* @param string the table name
* @param string the end of line sequence
* @param string the url to go back in case of error
* @param boolean whether to include creation/update/check dates
*
* @return string resulting schema
*
* @global boolean whether to add 'drop' statements or not
* @global boolean whether to use backquotes to allow the use of special
* characters in database, table and fields names or not
*
* @access public
*/
function PMA_getTableDef($db, $table, $crlf, $error_url, $show_dates = false)
{
global $drop;
global $use_backquotes;
global $cfgRelation;
global $sql_constraints;
$schema_create = '';
$auto_increment = '';
$new_crlf = $crlf;
$result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . PMA_sqlAddslashes($table) . '\'');
if ($result != FALSE) {
if (PMA_DBI_num_rows($result) > 0) {
$tmpres = PMA_DBI_fetch_assoc($result);
if (isset($GLOBALS['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 .= $GLOBALS['comment_marker'] . $GLOBALS['strStatCreateTime'] . ': ' . PMA_localisedDate(strtotime($tmpres['Create_time'])) . $crlf;
$new_crlf = $GLOBALS['comment_marker'] . $crlf . $crlf;
}
if ($show_dates && isset($tmpres['Update_time']) && !empty($tmpres['Update_time'])) {
$schema_create .= $GLOBALS['comment_marker'] . $GLOBALS['strStatUpdateTime'] . ': ' . PMA_localisedDate(strtotime($tmpres['Update_time'])) . $crlf;
$new_crlf = $GLOBALS['comment_marker'] . $crlf . $crlf;
}
if ($show_dates && isset($tmpres['Check_time']) && !empty($tmpres['Check_time'])) {
$schema_create .= $GLOBALS['comment_marker'] . $GLOBALS['strStatCheckTime'] . ': ' . PMA_localisedDate(strtotime($tmpres['Check_time'])) . $crlf;
$new_crlf = $GLOBALS['comment_marker'] . $crlf . $crlf;
}
}
PMA_DBI_free_result($result);
}
$schema_create .= $new_crlf;
if (!empty($drop)) {
$schema_create .= 'DROP TABLE IF EXISTS ' . PMA_backquote($table, $use_backquotes) . ';' . $crlf;
}
// Steve Alberty's patch for complete table dump,
// Whether to quote table and fields names or not
if ($use_backquotes) {
PMA_DBI_query('SET SQL_QUOTE_SHOW_CREATE = 1');
} else {
PMA_DBI_query('SET SQL_QUOTE_SHOW_CREATE = 0');
}
$result = PMA_DBI_query('SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table), NULL, PMA_DBI_QUERY_UNBUFFERED);
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);
} elseif (strpos($create_query, "(\r ")) {
$create_query = str_replace("\r", $crlf, $create_query);
}
// Should we use IF NOT EXISTS?
if (isset($GLOBALS['if_not_exists'])) {
$create_query = preg_replace('/^CREATE TABLE/', 'CREATE TABLE IF NOT EXISTS', $create_query);
}
// are there any constraints to cut out?
if (preg_match('@CONSTRAINT|FOREIGN[\\s]+KEY@', $create_query)) {
// Split the query into lines, so we can easily handle it. We know lines are separated by $crlf (done few lines above).
$sql_lines = explode($crlf, $create_query);
$sql_count = count($sql_lines);
// lets find first line with constraints
for ($i = 0; $i < $sql_count; $i++) {
if (preg_match('@CONSTRAINT|FOREIGN[\\s]+KEY@', $sql_lines[$i])) {
break;
}
}
// remove , from the end of create statement
$sql_lines[$i - 1] = preg_replace('@,$@', '', $sql_lines[$i - 1]);
// prepare variable for constraints
if (!isset($sql_constraints)) {
if (isset($GLOBALS['no_constraints_comments'])) {
$sql_constraints = '';
} else {
$sql_constraints = $crlf . $GLOBALS['comment_marker'] . $crlf . $GLOBALS['comment_marker'] . $GLOBALS['strConstraintsForDumped'] . $crlf . $GLOBALS['comment_marker'] . $crlf;
}
}
// comments for current table
if (!isset($GLOBALS['no_constraints_comments'])) {
$sql_constraints .= $crlf . $GLOBALS['comment_marker'] . $crlf . $GLOBALS['comment_marker'] . $GLOBALS['strConstraintsForTable'] . ' ' . PMA_backquote($table) . $crlf . $GLOBALS['comment_marker'] . $crlf;
}
//.........这里部分代码省略.........
示例15: PMA_localisedDate
if (isset($showtable['Update_time'])) {
?>
<tr>
<td><?php echo $strStatUpdateTime; ?></td>
<td align="right">
<?php echo PMA_localisedDate(strtotime($showtable['Update_time'])) . "\n"; ?>
</td>
</tr>
<?php
}
if (isset($showtable['Check_time'])) {
?>
<tr>
<td><?php echo $strStatCheckTime; ?></td>
<td align="right">
<?php echo PMA_localisedDate(strtotime($showtable['Check_time'])) . "\n"; ?>
</td>
</tr>
<?php
}
?>
</table>
</td>
</tr>
</table>
<?php
} // end if ($nonisam == false)
} // end if ($cfg['ShowStats'])
}