本文整理汇总了PHP中PMA_jsFormat函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_jsFormat函数的具体用法?PHP PMA_jsFormat怎么用?PHP PMA_jsFormat使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_jsFormat函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHtmlForIndexes
/**
* Show index data
*
* @param string $table The table name
* @param string $schema The schema name
* @param boolean $print_mode Whether the output is for the print mode
*
* @return string HTML for showing index
*
* @access public
*/
public static function getHtmlForIndexes($table, $schema, $print_mode = false)
{
$indexes = Index::getFromTable($table, $schema);
$no_indexes_class = count($indexes) > 0 ? ' hide' : '';
$no_indexes = "<div class='no_indexes_defined{$no_indexes_class}'>";
$no_indexes .= Message::notice(__('No index defined!'))->getDisplay();
$no_indexes .= '</div>';
if (!$print_mode) {
$r = '<fieldset class="index_info">';
$r .= '<legend id="index_header">' . __('Indexes');
$r .= Util::showMySQLDocu('optimizing-database-structure');
$r .= '</legend>';
$r .= $no_indexes;
if (count($indexes) < 1) {
$r .= '</fieldset>';
return $r;
}
$r .= Index::findDuplicates($table, $schema);
} else {
$r = '<h3>' . __('Indexes') . '</h3>';
$r .= $no_indexes;
if (count($indexes) < 1) {
return $r;
}
}
$r .= '<table id="table_index">';
$r .= '<thead>';
$r .= '<tr>';
if (!$print_mode) {
$r .= '<th colspan="2" class="print_ignore">' . __('Action') . '</th>';
}
$r .= '<th>' . __('Keyname') . '</th>';
$r .= '<th>' . __('Type') . '</th>';
$r .= '<th>' . __('Unique') . '</th>';
$r .= '<th>' . __('Packed') . '</th>';
$r .= '<th>' . __('Column') . '</th>';
$r .= '<th>' . __('Cardinality') . '</th>';
$r .= '<th>' . __('Collation') . '</th>';
$r .= '<th>' . __('Null') . '</th>';
$r .= '<th>' . __('Comment') . '</th>';
$r .= '</tr>';
$r .= '</thead>';
$r .= '<tbody>';
$odd_row = true;
foreach ($indexes as $index) {
$row_span = ' rowspan="' . $index->getColumnCount() . '" ';
$r .= '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">';
if (!$print_mode) {
$this_params = $GLOBALS['url_params'];
$this_params['index'] = $index->getName();
$r .= '<td class="edit_index print_ignore';
$r .= ' ajax';
$r .= '" ' . $row_span . '>' . ' <a class="';
$r .= 'ajax';
$r .= '" href="tbl_indexes.php' . PMA_URL_getCommon($this_params) . '">' . Util::getIcon('b_edit.png', __('Edit')) . '</a>' . '</td>' . "\n";
$this_params = $GLOBALS['url_params'];
if ($index->getName() == 'PRIMARY') {
$this_params['sql_query'] = 'ALTER TABLE ' . Util::backquote($table) . ' DROP PRIMARY KEY;';
$this_params['message_to_show'] = __('The primary key has been dropped.');
$js_msg = PMA_jsFormat('ALTER TABLE ' . $table . ' DROP PRIMARY KEY');
} else {
$this_params['sql_query'] = 'ALTER TABLE ' . Util::backquote($table) . ' DROP INDEX ' . Util::backquote($index->getName()) . ';';
$this_params['message_to_show'] = sprintf(__('Index %s has been dropped.'), $index->getName());
$js_msg = PMA_jsFormat('ALTER TABLE ' . $table . ' DROP INDEX ' . $index->getName() . ';');
}
$r .= '<td ' . $row_span . ' class="print_ignore">';
$r .= '<input type="hidden" class="drop_primary_key_index_msg"' . ' value="' . $js_msg . '" />';
$r .= ' <a class="drop_primary_key_index_anchor';
$r .= ' ajax';
$r .= '" href="sql.php' . PMA_URL_getCommon($this_params) . '" >' . Util::getIcon('b_drop.png', __('Drop')) . '</a>' . '</td>' . "\n";
}
if (!$print_mode) {
$r .= '<th ' . $row_span . '>' . htmlspecialchars($index->getName()) . '</th>';
} else {
$r .= '<td ' . $row_span . '>' . htmlspecialchars($index->getName()) . '</td>';
}
$r .= '<td ' . $row_span . '>';
$type = $index->getType();
if (!empty($type)) {
$r .= htmlspecialchars($type);
} else {
$r .= htmlspecialchars($index->getChoice());
}
$r .= '</td>';
$r .= '<td ' . $row_span . '>' . $index->isUnique(true) . '</td>';
$r .= '<td ' . $row_span . '>' . $index->isPacked(true) . '</td>';
foreach ($index->getColumns() as $column) {
if ($column->getSeqInIndex() > 1) {
$r .= '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">';
//.........这里部分代码省略.........
示例2: display
/**
* Outputs HTML for forms
*
* @uses ConfigFile::getInstance()
* @uses ConfigFile::get()
* @uses display_fieldset_bottom()
* @uses display_fieldset_top()
* @uses display_form_bottom()
* @uses display_form_top()
* @uses display_js()
* @uses display_tabs_bottom()
* @uses display_tabs_top()
* @uses js_validate()
* @uses PMA_config_get_validators()
* @uses PMA_jsFormat()
* @uses PMA_lang()
* @param bool $tabbed_form
* @param bool $show_restore_default whether show "restore default" button besides the input field
*/
public function display($tabbed_form = false, $show_restore_default = false)
{
static $js_lang_sent = false;
$js = array();
$js_default = array();
$tabbed_form = $tabbed_form && count($this->forms) > 1;
$validators = PMA_config_get_validators();
display_form_top();
if ($tabbed_form) {
$tabs = array();
foreach ($this->forms as $form) {
$tabs[$form->name] = PMA_lang("Form_{$form->name}");
}
display_tabs_top($tabs);
}
// valdiate only when we aren't displaying a "new server" form
$is_new_server = false;
foreach ($this->forms as $form) {
/* @var $form Form */
if ($form->index === 0) {
$is_new_server = true;
break;
}
}
if (!$is_new_server) {
$this->_validate();
}
// user preferences
$this->_loadUserprefsInfo();
// display forms
foreach ($this->forms as $form) {
/* @var $form Form */
$form_desc = isset($GLOBALS["strConfigForm_{$form->name}_desc"]) ? PMA_lang("Form_{$form->name}_desc") : '';
$form_errors = isset($this->errors[$form->name]) ? $this->errors[$form->name] : null;
display_fieldset_top(PMA_lang("Form_{$form->name}"), $form_desc, $form_errors, array('id' => $form->name));
foreach ($form->fields as $field => $path) {
$work_path = array_search($path, $this->system_paths);
$translated_path = $this->translated_paths[$work_path];
// always true/false for user preferences display
// otherwise null
$userprefs_allow = isset($this->userprefs_keys[$path]) ? !isset($this->userprefs_disallow[$path]) : null;
// display input
$this->_displayFieldInput($form, $field, $path, $work_path, $translated_path, $show_restore_default, $userprefs_allow, $js_default);
// register JS validators for this field
if (isset($validators[$path])) {
js_validate($translated_path, $validators[$path], $js);
}
}
display_fieldset_bottom();
}
if ($tabbed_form) {
display_tabs_bottom();
}
display_form_bottom();
// if not already done, send strings used for valdiation to JavaScript
if (!$js_lang_sent) {
$js_lang_sent = true;
$js_lang = array();
foreach ($this->js_lang_strings as $strName => $strValue) {
$js_lang[] = "'{$strName}': '" . PMA_jsFormat($strValue, false) . '\'';
}
$js[] = "\$.extend(PMA_messages, {\n\t" . implode(",\n\t", $js_lang) . '})';
}
$js[] = "\$.extend(defaultValues, {\n\t" . implode(",\n\t", $js_default) . '})';
display_js($js);
}
示例3: PMA_showMessage
/**
* Displays a message at the top of the "main" (right) frame
*
* @param string the message to display
*
* @global array the configuration array
*
* @access public
*/
function PMA_showMessage($message)
{
global $cfg;
// Sanitizes $message
$message = PMA_sanitize($message);
// Corrects the tooltip text via JS if required
if (!empty($GLOBALS['table']) && $cfg['ShowTooltip']) {
$result = PMA_DBI_try_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], TRUE) . '\'');
if ($result) {
$tbl_status = PMA_DBI_fetch_assoc($result);
$tooltip = empty($tbl_status['Comment']) ? '' : $tbl_status['Comment'] . ' ';
$tooltip .= '(' . $tbl_status['Rows'] . ' ' . $GLOBALS['strRows'] . ')';
PMA_DBI_free_result($result);
$md5_tbl = md5($GLOBALS['table']);
echo "\n";
?>
<script type="text/javascript" language="javascript1.2">
<!--
if (typeof(document.getElementById) != 'undefined'
&& typeof(window.parent.frames['nav']) != 'undefined'
&& typeof(window.parent.frames['nav'].document) != 'undefined' && typeof(window.parent.frames['nav'].document) != 'unknown'
&& (window.parent.frames['nav'].document.getElementById('<?php
echo 'tbl_' . $md5_tbl;
?>
'))
&& typeof(window.parent.frames['nav'].document.getElementById('<?php
echo 'tbl_' . $md5_tbl;
?>
')) != 'undefined'
&& typeof(window.parent.frames['nav'].document.getElementById('<?php
echo 'tbl_' . $md5_tbl;
?>
').title) == 'string') {
window.parent.frames['nav'].document.getElementById('<?php
echo 'tbl_' . $md5_tbl;
?>
').title = '<?php
echo PMA_jsFormat($tooltip, FALSE);
?>
';
}
//-->
</script>
<?php
}
// end if
}
// end if... else if
// Checks if the table needs to be repaired after a TRUNCATE query.
if (isset($GLOBALS['table']) && isset($GLOBALS['sql_query']) && $GLOBALS['sql_query'] == 'TRUNCATE TABLE ' . PMA_backquote($GLOBALS['table'])) {
if (!isset($tbl_status)) {
$result = @PMA_DBI_try_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], TRUE) . '\'');
if ($result) {
$tbl_status = PMA_DBI_fetch_assoc($result);
PMA_DBI_free_result($result);
}
}
if (isset($tbl_status) && (int) $tbl_status['Index_length'] > 1024) {
PMA_DBI_try_query('REPAIR TABLE ' . PMA_backquote($GLOBALS['table']));
}
}
unset($tbl_status);
echo "\n";
?>
<br />
<div align="<?php
echo $GLOBALS['cell_align_left'];
?>
">
<table border="<?php
echo $cfg['Border'];
?>
" cellpadding="5" cellspacing="1">
<tr>
<th<?php
echo $GLOBALS['theme'] != 'original' ? ' class="tblHeaders"' : ' bgcolor="' . $cfg['ThBgcolor'] . '"';
?>
>
<b><?php
echo $message;
?>
</b>
</th>
</tr>
<?php
if ($cfg['ShowSQL'] == TRUE && (!empty($GLOBALS['sql_query']) || !empty($GLOBALS['display_query']))) {
$local_query = !empty($GLOBALS['display_query']) ? $GLOBALS['display_query'] : ($cfg['SQP']['fmtType'] == 'none' && isset($GLOBALS['unparsed_sql']) && $GLOBALS['unparsed_sql'] != '' ? $GLOBALS['unparsed_sql'] : $GLOBALS['sql_query']);
// Basic url query part
$url_qpart = '?' . PMA_generate_common_url(isset($GLOBALS['db']) ? $GLOBALS['db'] : '', isset($GLOBALS['table']) ? $GLOBALS['table'] : '');
echo "\n";
?>
//.........这里部分代码省略.........
示例4: PMA_showMessage
/**
* displays the message and the query
* usually the message is the result of the query executed
*
* @param string $message the message to display
* @param string $sql_query the query to display
* @param string $type the type (level) of the message
* @param boolean $is_view is this a message after a VIEW operation?
*
* @return string
*
* @access public
*/
function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view = false)
{
/*
* PMA_ajaxResponse uses this function to collect the string of HTML generated
* for showing the message. Use output buffering to collect it and return it
* in a string. In some special cases on sql.php, buffering has to be disabled
* and hence we check with $GLOBALS['buffer_message']
*/
if ($GLOBALS['is_ajax_request'] == true && !isset($GLOBALS['buffer_message'])) {
ob_start();
}
global $cfg;
if (null === $sql_query) {
if (!empty($GLOBALS['display_query'])) {
$sql_query = $GLOBALS['display_query'];
} elseif ($cfg['SQP']['fmtType'] == 'none' && !empty($GLOBALS['unparsed_sql'])) {
$sql_query = $GLOBALS['unparsed_sql'];
} elseif (!empty($GLOBALS['sql_query'])) {
$sql_query = $GLOBALS['sql_query'];
} else {
$sql_query = '';
}
}
if (isset($GLOBALS['using_bookmark_message'])) {
$GLOBALS['using_bookmark_message']->display();
unset($GLOBALS['using_bookmark_message']);
}
// Corrects the tooltip text via JS if required
// @todo this is REALLY the wrong place to do this - very unexpected here
if (!$is_view && strlen($GLOBALS['table']) && $cfg['ShowTooltip']) {
$tooltip = PMA_Table::sGetToolTip($GLOBALS['db'], $GLOBALS['table']);
$uni_tbl = PMA_jsFormat($GLOBALS['db'] . '.' . $GLOBALS['table'], false);
echo "\n";
echo '<script type="text/javascript">' . "\n";
echo '//<![CDATA[' . "\n";
echo "if (window.parent.updateTableTitle) window.parent.updateTableTitle('" . $uni_tbl . "', '" . PMA_jsFormat($tooltip, false) . "');" . "\n";
echo '//]]>' . "\n";
echo '</script>' . "\n";
}
// end if ... elseif
// Checks if the table needs to be repaired after a TRUNCATE query.
// @todo what about $GLOBALS['display_query']???
// @todo this is REALLY the wrong place to do this - very unexpected here
if (strlen($GLOBALS['table']) && $GLOBALS['sql_query'] == 'TRUNCATE TABLE ' . PMA_backquote($GLOBALS['table'])) {
if (PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table'], 'Index_length') > 1024 && !PMA_DRIZZLE) {
PMA_DBI_try_query('REPAIR TABLE ' . PMA_backquote($GLOBALS['table']));
}
}
unset($tbl_status);
// In an Ajax request, $GLOBALS['cell_align_left'] may not be defined. Hence,
// check for it's presence before using it
echo '<div id="result_query" align="' . (isset($GLOBALS['cell_align_left']) ? $GLOBALS['cell_align_left'] : '') . '">' . "\n";
if ($message instanceof PMA_Message) {
if (isset($GLOBALS['special_message'])) {
$message->addMessage($GLOBALS['special_message']);
unset($GLOBALS['special_message']);
}
$message->display();
$type = $message->getLevel();
} else {
echo '<div class="' . $type . '">';
echo PMA_sanitize($message);
if (isset($GLOBALS['special_message'])) {
echo PMA_sanitize($GLOBALS['special_message']);
unset($GLOBALS['special_message']);
}
echo '</div>';
}
if ($cfg['ShowSQL'] == true && !empty($sql_query)) {
// Html format the query to be displayed
// If we want to show some sql code it is easiest to create it here
/* SQL-Parser-Analyzer */
if (!empty($GLOBALS['show_as_php'])) {
$new_line = '\\n"<br />' . "\n" . ' . "';
$query_base = htmlspecialchars(addslashes($sql_query));
$query_base = preg_replace('/((\\015\\012)|(\\015)|(\\012))/', $new_line, $query_base);
} else {
$query_base = $sql_query;
}
$query_too_big = false;
if (strlen($query_base) > $cfg['MaxCharactersInDisplayedSQL']) {
// when the query is large (for example an INSERT of binary
// data), the parser chokes; so avoid parsing the query
$query_too_big = true;
$shortened_query_base = nl2br(htmlspecialchars(substr($sql_query, 0, $cfg['MaxCharactersInDisplayedSQL']) . '[...]'));
} elseif (!empty($GLOBALS['parsed_sql']) && $query_base == $GLOBALS['parsed_sql']['raw']) {
// (here, use "! empty" because when deleting a bookmark,
//.........这里部分代码省略.........
示例5: PMA_buildHtmlForDb
/**
* Builds the HTML td elements for one database to display in the list
* of databases from server_databases.php (which can be modified by
* db_create.php)
*
* @param array $current current database
* @param boolean $is_superuser user status
* @param string $url_query url query
* @param array $column_order column order
* @param array $replication_types replication types
* @param array $replication_info replication info
*
* @return array $column_order, $out
*/
function PMA_buildHtmlForDb($current, $is_superuser, $url_query, $column_order, $replication_types, $replication_info)
{
$out = '';
if ($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) {
$out .= '<td class="tool">';
$out .= '<input type="checkbox" name="selected_dbs[]" class="checkall" ' . 'title="' . htmlspecialchars($current['SCHEMA_NAME']) . '" ' . 'value="' . htmlspecialchars($current['SCHEMA_NAME']) . '"';
if ($GLOBALS['dbi']->isSystemSchema($current['SCHEMA_NAME'], true)) {
$out .= ' disabled="disabled"';
}
$out .= ' /></td>';
}
$out .= '<td class="name">' . '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $url_query . '&db=' . urlencode($current['SCHEMA_NAME']) . '" title="' . sprintf(__('Jump to database'), htmlspecialchars($current['SCHEMA_NAME'])) . '">' . ' ' . htmlspecialchars($current['SCHEMA_NAME']) . '</a>' . '</td>';
foreach ($column_order as $stat_name => $stat) {
if (array_key_exists($stat_name, $current)) {
if (is_numeric($stat['footer'])) {
$column_order[$stat_name]['footer'] += $current[$stat_name];
}
if ($stat['format'] === 'byte') {
list($value, $unit) = PMA_Util::formatByteDown($current[$stat_name], 3, 1);
} elseif ($stat['format'] === 'number') {
$value = PMA_Util::formatNumber($current[$stat_name], 0);
} else {
$value = htmlentities($current[$stat_name], 0);
}
$out .= '<td class="value">';
if (isset($stat['description_function'])) {
$out .= '<dfn title="' . $stat['description_function']($current[$stat_name]) . '">';
}
$out .= $value;
if (isset($stat['description_function'])) {
$out .= '</dfn>';
}
$out .= '</td>';
if ($stat['format'] === 'byte') {
$out .= '<td class="unit">' . $unit . '</td>';
}
}
}
foreach ($replication_types as $type) {
if ($replication_info[$type]['status']) {
$out .= '<td class="tool" style="text-align: center;">';
$key = array_search($current["SCHEMA_NAME"], $replication_info[$type]['Ignore_DB']);
if (strlen($key) > 0) {
$out .= PMA_Util::getIcon('s_cancel.png', __('Not replicated'));
} else {
$key = array_search($current["SCHEMA_NAME"], $replication_info[$type]['Do_DB']);
if (strlen($key) > 0 || $replication_info[$type]['Do_DB'][0] == "" && count($replication_info[$type]['Do_DB']) == 1) {
// if ($key != null) did not work for index "0"
$out .= PMA_Util::getIcon('s_success.png', __('Replicated'));
}
}
$out .= '</td>';
}
}
if ($is_superuser && !PMA_DRIZZLE) {
$out .= '<td class="tool">' . '<a onclick="' . 'PMA_commonActions.setDb(\'' . PMA_jsFormat($current['SCHEMA_NAME']) . '\');' . '" href="server_privileges.php?' . $url_query . '&db=' . urlencode($current['SCHEMA_NAME']) . '&checkprivsdb=' . urlencode($current['SCHEMA_NAME']) . '" title="' . sprintf(__('Check privileges for database "%s".'), htmlspecialchars($current['SCHEMA_NAME'])) . '">' . ' ' . PMA_Util::getIcon('s_rights.png', __('Check Privileges')) . '</a></td>';
}
return array($column_order, $out);
}
示例6: echo
?>
</td>
<td width="20%">
<img src="<?php
echo $GLOBALS['pmaThemeImage'] . 'spacer.png';
?>
"
alt="" width="1" height="1" /></td>
<td>
<?php
echo ($val_ordered_current_equals_data ? '<strong>' : '') . '<a href="#" title="' . __('Use this value') . ($val_ordered_current_val_title != '' ? ': ' . $val_ordered_current_val_title : '') . '" onclick="formupdate(\'' . md5($field) . '\', \'' . PMA_jsFormat($val_ordered_current_key, false) . '\'); return false;">' . $val_ordered_current_val . '</a>' . ($val_ordered_current_equals_data ? '</strong>' : '');
?>
</td>
<td nowrap="nowrap">
<?php
echo ($val_ordered_current_equals_data ? '<strong>' : '') . '<a href="#" title="' . __('Use this value') . ($val_ordered_current_val_title != '' ? ': ' . $val_ordered_current_val_title : '') . '" onclick="formupdate(\'' . md5($field) . '\', \'' . PMA_jsFormat($val_ordered_current_key, false) . '\'); return false;">' . htmlspecialchars($val_ordered_current_key) . '</a>' . ($val_ordered_current_equals_data ? '</strong>' : '');
?>
</td>
</tr>
<?php
}
// end while
}
?>
</tbody>
</table>
</body>
</html>
示例7: PMA_getHtmlForImportWithPlugin
/**
* Prints javascript for upload with plugin, upload process bar
*
* @param int $upload_id The selected upload id
*
* @return string
*/
function PMA_getHtmlForImportWithPlugin($upload_id)
{
//some variable for javascript
$ajax_url = "import_status.php?id=" . $upload_id . "&" . PMA_URL_getCommon(array('import_status' => 1), 'text');
$promot_str = PMA_jsFormat(__('The file being uploaded is probably larger than ' . 'the maximum allowed size or this is a known bug in webkit ' . 'based (Safari, Google Chrome, Arora etc.) browsers.'), false);
$statustext_str = PMA_escapeJsString(__('%s of %s'));
$upload_str = PMA_jsFormat(__('Uploading your import file…'), false);
$second_str = PMA_jsFormat(__('%s/sec.'), false);
$remaining_min = PMA_jsFormat(__('About %MIN min. %SEC sec. remaining.'), false);
$remaining_second = PMA_jsFormat(__('About %SEC sec. remaining.'), false);
$processed_str = PMA_jsFormat(__('The file is being processed, please be patient.'), false);
$import_url = PMA_URL_getCommon(array('import_status' => 1), 'text');
//start output
$html = 'var finished = false; ';
$html .= 'var percent = 0.0; ';
$html .= 'var total = 0; ';
$html .= 'var complete = 0; ';
$html .= 'var original_title = ' . 'parent && parent.document ? parent.document.title : false; ';
$html .= 'var import_start; ';
$html .= 'var perform_upload = function () { ';
$html .= 'new $.getJSON( ';
$html .= ' "' . $ajax_url . '", ';
$html .= ' {}, ';
$html .= ' function(response) { ';
$html .= ' finished = response.finished; ';
$html .= ' percent = response.percent; ';
$html .= ' total = response.total; ';
$html .= ' complete = response.complete; ';
$html .= ' if (total==0 && complete==0 && percent==0) { ';
$img_tag = '<img src="' . $GLOBALS['pmaThemeImage'] . 'ajax_clock_small.gif"';
$html .= ' $("#upload_form_status_info").html(\'' . $img_tag . ' width="16" height="16" alt="ajax clock" /> ' . $promot_str . '\'); ';
$html .= ' $("#upload_form_status").css("display", "none"); ';
$html .= ' } else { ';
$html .= ' var now = new Date(); ';
$html .= ' now = Date.UTC( ';
$html .= ' now.getFullYear(), ';
$html .= ' now.getMonth(), ';
$html .= ' now.getDate(), ';
$html .= ' now.getHours(), ';
$html .= ' now.getMinutes(), ';
$html .= ' now.getSeconds()) ';
$html .= ' + now.getMilliseconds() - 1000; ';
$html .= ' var statustext = PMA_sprintf(';
$html .= ' "' . $statustext_str . '", ';
$html .= ' formatBytes( ';
$html .= ' complete, 1, PMA_messages.strDecimalSeparator';
$html .= ' ), ';
$html .= ' formatBytes(';
$html .= ' total, 1, PMA_messages.strDecimalSeparator';
$html .= ' ) ';
$html .= ' ); ';
$html .= ' if ($("#importmain").is(":visible")) { ';
// show progress UI
$html .= ' $("#importmain").hide(); ';
$html .= ' $("#import_form_status") ';
$html .= ' .html(\'<div class="upload_progress">' . '<div class="upload_progress_bar_outer"><div class="percentage">' . '</div><div id="status" class="upload_progress_bar_inner">' . '<div class="percentage"></div></div></div><div>' . '<img src="' . $GLOBALS['pmaThemeImage'] . 'ajax_clock_small.gif" width="16" height="16" alt="ajax clock" /> ' . $upload_str . '</div><div id="statustext"></div></div>\') ';
$html .= ' .show(); ';
$html .= ' import_start = now; ';
$html .= ' } ';
$html .= ' else if (percent > 9 || complete > 2000000) { ';
// calculate estimated time
$html .= ' var used_time = now - import_start; ';
$html .= ' var seconds = ' . 'parseInt(((total - complete) / complete) * used_time / 1000); ';
$html .= ' var speed = PMA_sprintf("' . $second_str . '"';
$html .= ' , formatBytes(complete / used_time * 1000, 1,' . ' PMA_messages.strDecimalSeparator)); ';
$html .= ' var minutes = parseInt(seconds / 60); ';
$html .= ' seconds %= 60; ';
$html .= ' var estimated_time; ';
$html .= ' if (minutes > 0) { ';
$html .= ' estimated_time = "' . $remaining_min . '"';
$html .= ' .replace("%MIN", minutes)';
$html .= ' .replace("%SEC", seconds); ';
$html .= ' } ';
$html .= ' else { ';
$html .= ' estimated_time = "' . $remaining_second . '"';
$html .= ' .replace("%SEC", seconds); ';
$html .= ' } ';
$html .= ' statustext += "<br />" + speed + "<br /><br />" ' . '+ estimated_time; ';
$html .= ' } ';
$html .= ' var percent_str = Math.round(percent) + "%"; ';
$html .= ' $("#status").animate({width: percent_str}, 150); ';
$html .= ' $(".percentage").text(percent_str); ';
// show percent in window title
$html .= ' if (original_title !== false) { ';
$html .= ' parent.document.title ';
$html .= ' = percent_str + " - " + original_title; ';
$html .= ' } ';
$html .= ' else { ';
$html .= ' document.title ';
$html .= ' = percent_str + " - " + original_title; ';
$html .= ' } ';
$html .= ' $("#statustext").html(statustext); ';
$html .= ' } ';
//.........这里部分代码省略.........
示例8: PMA_DBI_select_db
} else {
$lnk3 = '';
$arg3 = '';
$lnk4 = '';
$arg4 = '';
}
// Drop link if allowed
if (!$cfg['AllowUserDropDatabase']) {
// Check if the user is a Superuser
$cfg['AllowUserDropDatabase'] = PMA_DBI_select_db('mysql');
PMA_DBI_select_db($db);
}
if ($cfg['AllowUserDropDatabase']) {
$lnk5 = 'sql.php';
$arg5 = $url_query . '&sql_query=' . urlencode('DROP DATABASE ' . PMA_backquote($db)) . '&zero_rows=' . urlencode(sprintf($strDatabaseHasBeenDropped, htmlspecialchars(PMA_backquote($db)))) . '&goto=main.php&back=db_details' . $sub_part . '.php&reload=1&purge=1';
$att5 = 'onclick="return confirmLinkDropDB(this, \'DROP DATABASE ' . PMA_jsFormat($db) . '\')"';
$class5 = 'Drop';
} else {
$lnk5 = '';
$class5 = 'Drop';
}
/**
* Displays tab links
*/
if ($cfg['LightTabs']) {
echo ' ';
} else {
echo '<table border="0" cellspacing="0" cellpadding="0" width="100%" id="topmenu">' . "\n" . ' <tr>' . "\n" . ' <td class="nav" align="left" nowrap="nowrap" valign="bottom">' . ' <table border="0" cellpadding="0" cellspacing="0"><tr>' . ' <td nowrap="nowrap"><img src="' . $GLOBALS['pmaThemeImage'] . 'spacer.png' . '" width="2" height="1" border="0" alt="" /></td>' . ' <td class="navSpacer"><img src="' . $GLOBALS['pmaThemeImage'] . 'spacer.png' . '" width="1" height="1" border="0" alt="" /></td>';
}
echo PMA_printTab(($GLOBALS['cfg']['MainPageIconic'] ? '<img src="' . $GLOBALS['pmaThemeImage'] . 'b_props.png" width="16" height="16" border="0" hspace="2" align="middle" alt="' . $strStructure . '" />' : '') . $strStructure, 'db_details_structure.php', $url_query);
echo PMA_printTab(($GLOBALS['cfg']['MainPageIconic'] ? '<img src="' . $GLOBALS['pmaThemeImage'] . 'b_sql.png" width="16" height="16" border="0" hspace="2" align="middle" alt="' . $strSQL . '" />' : '') . $strSQL, 'db_details.php', $url_query . '&db_query_force=1');
示例9: setTimeout
else {
setTimeout(perform_upload, 1000);
}
});
}
setTimeout(perform_upload, 1000);
<?php
} else {
// no plugin available
?>
$('#upload_form_status_info').html('<img src="<?php
echo $GLOBALS['pmaThemeImage'];
?>
ajax_clock_small.gif" width="16" height="16" alt="ajax clock" /> <?php
echo PMA_jsFormat(__('Please be patient, the file is being uploaded. Details about the upload are not available.'), false) . $common_functions->showDocu('faq2_9');
?>
');
$('#upload_form_status').css("display", "none");
<?php
}
// else
?>
}); // onclick
}); // domready
//]]>
</script>
<form action="import.php" method="post" enctype="multipart/form-data"
name="import"<?php
if ($_SESSION[$SESSION_KEY]["handler"] != "UploadNoplugin") {
echo ' target="import_upload_iframe"';
示例10: getView
/**
* Show index data
*
* @param string $table The tablename
* @param array $indexes_info Referenced info array
* @param array $indexes_data Referenced data array
* @param boolean $print_mode
* @access public
* @return array Index collection array
*/
public static function getView($table, $schema, $print_mode = false)
{
$indexes = PMA_Index::getFromTable($table, $schema);
if (count($indexes) < 1) {
return PMA_Message::error(__('No index defined!'))->getDisplay();
}
$r = '';
$r .= '<h2>' . __('Indexes') . ': ';
$r .= PMA_showMySQLDocu('optimization', 'optimizing-database-structure');
$r .= '</h2>';
$r .= '<table>';
$r .= '<thead>';
$r .= '<tr>';
if (!$print_mode) {
$r .= '<th colspan="2">' . __('Action') . '</th>';
}
$r .= '<th>' . __('Keyname') . '</th>';
$r .= '<th>' . __('Type') . '</th>';
$r .= '<th>' . __('Unique') . '</th>';
$r .= '<th>' . __('Packed') . '</th>';
$r .= '<th>' . __('Column') . '</th>';
$r .= '<th>' . __('Cardinality') . '</th>';
$r .= '<th>' . __('Collation') . '</th>';
$r .= '<th>' . __('Null') . '</th>';
$r .= '<th>' . __('Comment') . '</th>';
$r .= '</tr>';
$r .= '</thead>';
$r .= '<tbody>';
$odd_row = true;
foreach ($indexes as $index) {
$row_span = ' rowspan="' . $index->getColumnCount() . '" ';
$r .= '<tr class="' . ($odd_row ? 'odd' : 'even') . '">';
if (!$print_mode) {
$this_params = $GLOBALS['url_params'];
$this_params['index'] = $index->getName();
$r .= '<td ' . $row_span . '>' . ' <a href="tbl_indexes.php' . PMA_generate_common_url($this_params) . '">' . PMA_getIcon('b_edit.png', __('Edit')) . '</a>' . '</td>' . "\n";
$this_params = $GLOBALS['url_params'];
if ($index->getName() == 'PRIMARY') {
$this_params['sql_query'] = 'ALTER TABLE ' . PMA_backquote($table) . ' DROP PRIMARY KEY';
$this_params['message_to_show'] = __('The primary key has been dropped');
$js_msg = PMA_jsFormat('ALTER TABLE ' . $table . ' DROP PRIMARY KEY');
} else {
$this_params['sql_query'] = 'ALTER TABLE ' . PMA_backquote($table) . ' DROP INDEX ' . PMA_backquote($index->getName());
$this_params['message_to_show'] = sprintf(__('Index %s has been dropped'), $index->getName());
$js_msg = PMA_jsFormat('ALTER TABLE ' . $table . ' DROP INDEX ' . $index->getName());
}
$r .= '<td ' . $row_span . '>';
$r .= '<input type="hidden" class="drop_primary_key_index_msg" value="' . $js_msg . '" />';
$r .= ' <a ';
if ($GLOBALS['cfg']['AjaxEnable']) {
$r .= 'class="drop_primary_key_index_anchor" ';
}
$r .= ' href="sql.php' . PMA_generate_common_url($this_params) . '" >' . PMA_getIcon('b_drop.png', __('Drop')) . '</a>' . '</td>' . "\n";
}
$r .= '<th ' . $row_span . '>' . htmlspecialchars($index->getName()) . '</th>';
$r .= '<td ' . $row_span . '>' . htmlspecialchars($index->getType()) . '</td>';
$r .= '<td ' . $row_span . '>' . $index->isUnique(true) . '</td>';
$r .= '<td ' . $row_span . '>' . $index->isPacked(true) . '</td>';
foreach ($index->getColumns() as $column) {
if ($column->getSeqInIndex() > 1) {
$r .= '<tr class="' . ($odd_row ? 'odd' : 'even') . '">';
}
$r .= '<td>' . htmlspecialchars($column->getName());
if ($column->getSubPart()) {
$r .= ' (' . $column->getSubPart() . ')';
}
$r .= '</td>';
$r .= '<td>' . htmlspecialchars($column->getCardinality()) . '</td>';
$r .= '<td>' . htmlspecialchars($column->getCollation()) . '</td>';
$r .= '<td>' . htmlspecialchars($column->getNull()) . '</td>';
if ($column->getSeqInIndex() == 1) {
$r .= '<td ' . $row_span . '>' . htmlspecialchars($index->getComments()) . '</td>';
}
$r .= '</tr>';
}
// end foreach $index['Sequences']
$odd_row = !$odd_row;
}
// end while
$r .= '</tbody>';
$r .= '</table>';
if (!$print_mode) {
$r .= PMA_Index::findDuplicates($table, $schema);
}
return $r;
}
示例11: PMA_buildHtmlForDb
function PMA_buildHtmlForDb($current, $is_superuser, $checkall, $url_query, $column_order, $replication_types, $replication_info)
{
$out = '';
if ($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) {
$out .= '<td class="tool">';
$out .= '<input type="checkbox" name="selected_dbs[]" title="' . htmlspecialchars($current['SCHEMA_NAME']) . '" value="' . htmlspecialchars($current['SCHEMA_NAME']) . '" ';
if ($current['SCHEMA_NAME'] != 'mysql' && $current['SCHEMA_NAME'] != 'information_schema') {
$out .= (empty($checkall) ? '' : 'checked="checked" ') . '/>';
} else {
$out .= ' disabled="disabled" />';
}
$out .= '</td>';
}
$out .= '<td class="name">' . ' <a onclick="' . 'if (window.parent.openDb && window.parent.openDb(\'' . PMA_jsFormat($current['SCHEMA_NAME'], false) . '\')) return false;' . '" href="index.php?' . $url_query . '&db=' . urlencode($current['SCHEMA_NAME']) . '" title="' . sprintf(__('Jump to database'), htmlspecialchars($current['SCHEMA_NAME'])) . '" target="_parent">' . ' ' . htmlspecialchars($current['SCHEMA_NAME']) . '</a>' . '</td>';
foreach ($column_order as $stat_name => $stat) {
if (array_key_exists($stat_name, $current)) {
if (is_numeric($stat['footer'])) {
$column_order[$stat_name]['footer'] += $current[$stat_name];
}
if ($stat['format'] === 'byte') {
list($value, $unit) = PMA_formatByteDown($current[$stat_name], 3, 1);
} elseif ($stat['format'] === 'number') {
$value = PMA_formatNumber($current[$stat_name], 0);
} else {
$value = htmlentities($current[$stat_name], 0);
}
$out .= '<td class="value">';
if (isset($stat['description_function'])) {
$out .= '<dfn title="' . $stat['description_function']($current[$stat_name]) . '">';
}
$out .= $value;
if (isset($stat['description_function'])) {
$out .= '</dfn>';
}
$out .= '</td>';
if ($stat['format'] === 'byte') {
$out .= '<td class="unit">' . $unit . '</td>';
}
}
}
foreach ($replication_types as $type) {
if ($replication_info[$type]['status']) {
$out .= '<td class="tool" style="text-align: center;">';
if (strlen(array_search($current["SCHEMA_NAME"], $replication_info[$type]['Ignore_DB'])) > 0) {
$out .= PMA_getIcon('s_cancel.png', __('Not replicated'));
} else {
$key = array_search($current["SCHEMA_NAME"], $replication_info[$type]['Do_DB']);
if (strlen($key) > 0 || $replication_info[$type]['Do_DB'][0] == "" && count($replication_info[$type]['Do_DB']) == 1) {
// if ($key != null) did not work for index "0"
$out .= PMA_getIcon('s_success.png', __('Replicated'));
}
}
$out .= '</td>';
}
}
if ($is_superuser) {
$out .= '<td class="tool">' . '<a onclick="' . 'if (window.parent.setDb) window.parent.setDb(\'' . PMA_jsFormat($current['SCHEMA_NAME']) . '\');' . '" href="./server_privileges.php?' . $url_query . '&checkprivs=' . urlencode($current['SCHEMA_NAME']) . '" title="' . sprintf(__('Check privileges for database "%s".'), htmlspecialchars($current['SCHEMA_NAME'])) . '">' . ' ' . PMA_getIcon('s_rights.png', __('Check Privileges')) . '</a></td>';
}
return array($column_order, $out);
}
示例12: if
if (opener.document.insertForm.elements[element_name]) {
// Edit/Insert form
opener.document.insertForm.elements[element_name].value = key;
self.close();
return false;
} else if (opener.document.insertForm.elements[element_name_alt]) {
// Search form
opener.document.insertForm.elements[element_name_alt].value = key;
self.close();
return false;
}
}
alert('<?php
echo PMA_jsFormat($strWindowNotFound);
?>
');
}
//]]>
</script>
</head>
<body bgcolor="<?php
echo $cfg['LeftBgColor'];
?>
" style="margin-left: 5px; margin-top: 5px; margin-right: 5px; margin-bottom: 0px">
<form action="browse_foreigners.php" method="post">
<fieldset>
<?php
示例13: urlencode
echo $empty_table;
?>
</td>
<td align="center">
<a href="sql.php?<?php
echo $tbl_url_query;
?>
&reload=1&purge=1&sql_query=<?php
echo urlencode($drop_query);
?>
&zero_rows=<?php
echo urlencode($drop_message);
?>
"
onclick="return confirmLink(this, '<?php
echo PMA_jsFormat($drop_query, false);
?>
')">
<?php
echo $titles['Drop'];
?>
</a></td>
<?php
}
// end if (! $db_is_information_schema)
// there is a null value in the ENGINE
// - when the table needs to be repaired, or
// - when it's a view
// so ensure that we'll display "in use" below for a table
// that needs to be repaired
if (isset($each_table['TABLE_ROWS']) && ($each_table['ENGINE'] != null || $table_is_view)) {
示例14: PMA_showMessage
/**
* displays the message and the query
* usually the message is the result of the query executed
*
* @param string $message the message to display
* @param string $sql_query the query to display
* @param string $type the type (level) of the message
* @global array the configuration array
* @uses $cfg
* @access public
*/
function PMA_showMessage($message, $sql_query = null, $type = 'notice')
{
global $cfg;
if (null === $sql_query) {
if (!empty($GLOBALS['display_query'])) {
$sql_query = $GLOBALS['display_query'];
} elseif ($cfg['SQP']['fmtType'] == 'none' && !empty($GLOBALS['unparsed_sql'])) {
$sql_query = $GLOBALS['unparsed_sql'];
} elseif (!empty($GLOBALS['sql_query'])) {
$sql_query = $GLOBALS['sql_query'];
} else {
$sql_query = '';
}
}
// Corrects the tooltip text via JS if required
// @todo this is REALLY the wrong place to do this - very unexpected here
if (strlen($GLOBALS['table']) && $cfg['ShowTooltip']) {
$tooltip = PMA_Table::sGetToolTip($GLOBALS['db'], $GLOBALS['table']);
$uni_tbl = PMA_jsFormat($GLOBALS['db'] . '.' . $GLOBALS['table'], false);
echo "\n";
echo '<script type="text/javascript">' . "\n";
echo '//<![CDATA[' . "\n";
echo "if (window.parent.updateTableTitle) window.parent.updateTableTitle('" . $uni_tbl . "', '" . PMA_jsFormat($tooltip, false) . "');" . "\n";
echo '//]]>' . "\n";
echo '</script>' . "\n";
}
// end if ... elseif
// Checks if the table needs to be repaired after a TRUNCATE query.
// @todo what about $GLOBALS['display_query']???
// @todo this is REALLY the wrong place to do this - very unexpected here
if (strlen($GLOBALS['table']) && $GLOBALS['sql_query'] == 'TRUNCATE TABLE ' . PMA_backquote($GLOBALS['table'])) {
if (PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table'], 'Index_length') > 1024) {
PMA_DBI_try_query('REPAIR TABLE ' . PMA_backquote($GLOBALS['table']));
}
}
unset($tbl_status);
echo '<div align="' . $GLOBALS['cell_align_left'] . '">' . "\n";
if ($message instanceof PMA_Message) {
if (isset($GLOBALS['special_message'])) {
$message->addMessage($GLOBALS['special_message']);
unset($GLOBALS['special_message']);
}
$message->display();
$type = $message->getLevel();
} else {
echo '<div class="' . $type . '">';
echo PMA_sanitize($message);
if (isset($GLOBALS['special_message'])) {
echo PMA_sanitize($GLOBALS['special_message']);
unset($GLOBALS['special_message']);
}
echo '</div>';
}
if ($cfg['ShowSQL'] == true && !empty($sql_query)) {
// Html format the query to be displayed
// If we want to show some sql code it is easiest to create it here
/* SQL-Parser-Analyzer */
if (!empty($GLOBALS['show_as_php'])) {
$new_line = '\\n"<br />' . "\n" . ' . "';
$query_base = htmlspecialchars(addslashes($sql_query));
$query_base = preg_replace('/((\\015\\012)|(\\015)|(\\012))/', $new_line, $query_base);
} else {
$query_base = $sql_query;
}
$query_too_big = false;
if (strlen($query_base) > $cfg['MaxCharactersInDisplayedSQL']) {
// when the query is large (for example an INSERT of binary
// data), the parser chokes; so avoid parsing the query
$query_too_big = true;
$shortened_query_base = nl2br(htmlspecialchars(substr($sql_query, 0, $cfg['MaxCharactersInDisplayedSQL']) . '[...]'));
} elseif (!empty($GLOBALS['parsed_sql']) && $query_base == $GLOBALS['parsed_sql']['raw']) {
// (here, use "! empty" because when deleting a bookmark,
// $GLOBALS['parsed_sql'] is set but empty
$parsed_sql = $GLOBALS['parsed_sql'];
} else {
// Parse SQL if needed
$parsed_sql = PMA_SQP_parse($query_base);
}
// Analyze it
if (isset($parsed_sql)) {
$analyzed_display_query = PMA_SQP_analyze($parsed_sql);
// Here we append the LIMIT added for navigation, to
// enable its display. Adding it higher in the code
// to $sql_query would create a problem when
// using the Refresh or Edit links.
// Only append it on SELECTs.
/**
* @todo what would be the best to do when someone hits Refresh:
* use the current LIMITs ?
//.........这里部分代码省略.........
示例15: testJsFormat
/**
* Test for PMA_jsFormat
*
* @return void
*/
public function testJsFormat()
{
$this->assertEquals("`foo`", PMA_jsFormat('foo'));
}