Beispiel #1
0
    /**
     * Gets a core script and starts output buffering work
     */
    require_once './libraries/common.lib.php';
    require_once './libraries/ob.lib.php';
    if ($GLOBALS['cfg']['OBGzip']) {
        $GLOBALS['ob_mode'] = PMA_outBufferModeGet();
        if ($GLOBALS['ob_mode']) {
            PMA_outBufferPre($GLOBALS['ob_mode']);
        }
    }
    require_once './libraries/header_http.inc.php';
    require_once './libraries/header_meta_style.inc.php';
    $title = 'Portable phpMyAdmin';
    // here, the function does not exist with this configuration: $cfg['ServerDefault'] = 0;
    $is_superuser = function_exists('PMA_isSuperuser') && PMA_isSuperuser();
    ?>
	<script>
	// <![CDATA[
	<?php 
    // Add some javascript instructions if required
    if (isset($js_to_run) && $js_to_run == 'functions.js') {
        echo "\n";
        ?>
		// js form validation stuff
		var errorMsg0   = '<?php 
        echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']);
        ?>
';
		var errorMsg1   = '<?php 
        echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']);
<?php

/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * Get user's global privileges and some db-specific privileges
 *
 * @package phpMyAdmin
 */
if (!defined('PHPMYADMIN')) {
    exit;
}
/**
 *
 */
$GLOBALS['is_superuser'] = PMA_isSuperuser();
/**
 * sets privilege information extracted from SHOW GRANTS result
 *
 * Detection for some CREATE privilege.
 *
 * Since MySQL 4.1.2, we can easily detect current user's grants using $userlink
 * (no control user needed) and we don't have to try any other method for
 * detection
 *
 * @todo fix to get really all privileges, not only explicitly defined for this user
 * from MySQL manual: (http://dev.mysql.com/doc/refman/5.0/en/show-grants.html)
 * SHOW GRANTS displays only the privileges granted explicitly to the named
 * account. Other privileges might be available to the account, but they are not
 * displayed. For example, if an anonymous account exists, the named account
 * might be able to use its privileges, but SHOW GRANTS will not display them.
 *
 * Note: this can be called also from the db panel to get the privileges of
 *       a db, in which case we want to keep displaying the tabs of
 *       the Database panel
 */
if (empty($viewing_mode)) {
    $db = $table = '';
}
/**
 * Set parameters for links
 */
$url_query = PMA_generate_common_url($db);
/**
 * Defines the urls to return to in case of error in a sql statement
 */
$err_url = 'main.php' . $url_query;
/**
 * Displays the headers
 */
require_once './libraries/header.inc.php';
/**
 * @global boolean Checks for superuser privileges
 */
$is_superuser = PMA_isSuperuser();
// now, select the mysql db
if ($is_superuser) {
    PMA_DBI_select_db('mysql', $userlink);
}
/**
 * @global array binary log files
 */
$binary_logs = PMA_DBI_fetch_result('SHOW MASTER LOGS', 'Log_name', null, null, PMA_DBI_QUERY_STORE);
    $GLOBALS['grid_edit'] = false;
}
if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS'])) {
    PMA_fatalError(__("GLOBALS overwrite attempt"));
}
/**
 * protect against possible exploits - there is no need to have so much variables
 */
if (count($_REQUEST) > 1000) {
    PMA_fatalError(__('possible exploit'));
}
/**
 * Check for numeric keys
 * (if register_globals is on, numeric key can be found in $GLOBALS)
 */
foreach ($GLOBALS as $key => $dummy) {
    if (is_numeric($key)) {
        PMA_fatalError(__('numeric key detected'));
    }
}
unset($dummy);
// here, the function does not exist with this configuration:
// $cfg['ServerDefault'] = 0;
$GLOBALS['is_superuser'] = function_exists('PMA_isSuperuser') && PMA_isSuperuser();
if (!empty($__redirect) && in_array($__redirect, $goto_whitelist)) {
    /**
     * include subform target page
     */
    include $__redirect;
    exit;
}
Beispiel #5
0
 /**
  * Returns the server tabs as an array
  *
  * @return array Data for generating server tabs
  */
 private function _getServerTabs()
 {
     $is_superuser = function_exists('PMA_isSuperuser') && PMA_isSuperuser();
     $binary_logs = null;
     if (function_exists('PMA_DBI_fetch_result') && (!defined('PMA_DRIZZLE') || defined('PMA_DRIZZLE') && !PMA_DRIZZLE)) {
         $binary_logs = PMA_DBI_fetch_result('SHOW MASTER LOGS', 'Log_name', null, null, PMA_DBI_QUERY_STORE);
     }
     $tabs = array();
     $tabs['databases']['icon'] = 's_db.png';
     $tabs['databases']['link'] = 'server_databases.php';
     $tabs['databases']['text'] = __('Databases');
     $tabs['sql']['icon'] = 'b_sql.png';
     $tabs['sql']['link'] = 'server_sql.php';
     $tabs['sql']['text'] = __('SQL');
     $tabs['status']['icon'] = 's_status.png';
     $tabs['status']['link'] = 'server_status.php';
     $tabs['status']['text'] = __('Status');
     $tabs['status']['active'] = in_array(basename($GLOBALS['PMA_PHP_SELF']), array('server_status.php', 'server_status_advisor.php', 'server_status_monitor.php', 'server_status_queries.php', 'server_status_variables.php'));
     if ($is_superuser && !PMA_DRIZZLE) {
         $tabs['rights']['icon'] = 's_rights.png';
         $tabs['rights']['link'] = 'server_privileges.php';
         $tabs['rights']['text'] = __('Users');
     }
     $tabs['export']['icon'] = 'b_export.png';
     $tabs['export']['link'] = 'server_export.php';
     $tabs['export']['text'] = __('Export');
     $tabs['import']['icon'] = 'b_import.png';
     $tabs['import']['link'] = 'server_import.php';
     $tabs['import']['text'] = __('Import');
     $tabs['settings']['icon'] = 'b_tblops.png';
     $tabs['settings']['link'] = 'prefs_manage.php';
     $tabs['settings']['text'] = __('Settings');
     $tabs['settings']['active'] = in_array(basename($GLOBALS['PMA_PHP_SELF']), array('prefs_forms.php', 'prefs_manage.php'));
     if (!empty($binary_logs)) {
         $tabs['binlog']['icon'] = 's_tbl.png';
         $tabs['binlog']['link'] = 'server_binlog.php';
         $tabs['binlog']['text'] = __('Binary log');
     }
     if ($is_superuser && !PMA_DRIZZLE) {
         $tabs['replication']['icon'] = 's_replication.png';
         $tabs['replication']['link'] = 'server_replication.php';
         $tabs['replication']['text'] = __('Replication');
     }
     $tabs['vars']['icon'] = 's_vars.png';
     $tabs['vars']['link'] = 'server_variables.php';
     $tabs['vars']['text'] = __('Variables');
     $tabs['charset']['icon'] = 's_asci.png';
     $tabs['charset']['link'] = 'server_collations.php';
     $tabs['charset']['text'] = __('Charsets');
     if (defined('PMA_DRIZZLE') && PMA_DRIZZLE) {
         $tabs['plugins']['icon'] = 'b_engine.png';
         $tabs['plugins']['link'] = 'server_plugins.php';
         $tabs['plugins']['text'] = __('Plugins');
     } else {
         $tabs['engine']['icon'] = 'b_engine.png';
         $tabs['engine']['link'] = 'server_engines.php';
         $tabs['engine']['text'] = __('Engines');
     }
     return $tabs;
 }
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 *
 * @package PhpMyAdmin
 */

require_once 'libraries/common.inc.php';

$GLOBALS['js_include'][] = 'server_variables.js';

PMA_AddJSVar('pma_token', $_SESSION[' PMA_token ']);
PMA_AddJSVar('url_query', str_replace('&amp;', '&', PMA_generate_common_url($db)));
PMA_AddJSVar('is_superuser', PMA_isSuperuser() ? true : false);


/**
 * Does the common work
 */
require 'libraries/server_common.inc.php';

/**
 * Required to display documentation links
 */
require 'libraries/server_variables_doc.php';

/**
 * Ajax request
 */

if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
Beispiel #7
0
            printServerTraffic();
            exit;
        case 'variables_table':
            // Prints the variables table
            printVariablesTable();
            exit;
        default:
            break;
    }
}
$server_db_isLocal = strtolower($cfg['Server']['host']) == 'localhost' || $cfg['Server']['host'] == '127.0.0.1' || $cfg['Server']['host'] == '::1';
PMA_AddJSVar('pma_token', $_SESSION[' PMA_token ']);
PMA_AddJSVar('url_query', str_replace('&amp;', '&', PMA_generate_common_url($db)));
PMA_AddJSVar('server_time_diff', 'new Date().getTime() - ' . microtime(true) * 1000, false);
PMA_AddJSVar('server_os', PHP_OS);
PMA_AddJSVar('is_superuser', PMA_isSuperuser());
PMA_AddJSVar('server_db_isLocal', $server_db_isLocal);
PMA_AddJSVar('profiling_docu', PMA_showMySQLDocu('general-thread-states', 'general-thread-states'));
PMA_AddJSVar('explain_docu', PMA_showMySQLDocu('explain-output', 'explain-output'));
/**
 * start output
 */
/**
 * Does the common work
 */
require './libraries/server_common.inc.php';
/**
 * Displays the links
 */
require './libraries/server_links.inc.php';
?>
Beispiel #8
0
PMA_addJSVar(
    'url_query',
    str_replace('&amp;', '&', PMA_generate_common_url($db))
);
PMA_addJSVar(
    'server_time_diff',
    'new Date().getTime() - ' . (microtime(true) * 1000),
    false
);
PMA_addJSVar(
    'server_os',
    PHP_OS
);
PMA_addJSVar(
    'is_superuser',
    PMA_isSuperuser()
);
PMA_addJSVar(
    'server_db_isLocal',
    $server_db_isLocal
);
PMA_addJSVar(
    'profiling_docu',
    PMA_Util::showMySQLDocu(
        'general-thread-states', 'general-thread-states'
    )
);
PMA_addJSVar(
    'explain_docu',
    PMA_Util::showMySQLDocu('explain-output', 'explain-output')
);
Beispiel #9
0
$odd_row = true;
foreach ($serverVars as $name => $value) {
    $has_session_value = isset($serverVarsSession[$name]) && $serverVarsSession[$name] != $value;
    $row_class = ($odd_row ? ' odd' : ' even') . ($has_session_value ? ' diffSession' : '');
    $output .= '<div class="var-row' . $row_class . '">' . '<div class="var-name">';
    // To display variable documentation link
    if (isset($VARIABLE_DOC_LINKS[$name])) {
        $output .= '<span title="' . htmlspecialchars(str_replace('_', ' ', $name)) . '">';
        $output .= PMA_Util::showMySQLDocu($VARIABLE_DOC_LINKS[$name][1], $VARIABLE_DOC_LINKS[$name][1], false, $VARIABLE_DOC_LINKS[$name][2] . '_' . $VARIABLE_DOC_LINKS[$name][0], true);
        $output .= htmlspecialchars(str_replace('_', ' ', $name));
        $output .= '</a>';
        $output .= '</span>';
    } else {
        $output .= htmlspecialchars(str_replace('_', ' ', $name));
    }
    $output .= '</div>' . '<div class="var-value value' . (PMA_isSuperuser() ? ' editable' : '') . '">&nbsp;' . formatVariable($name, $value) . '</div>' . '<div style="clear:both"></div>' . '</div>';
    if ($has_session_value) {
        $output .= '<div class="var-row' . ($odd_row ? ' odd' : ' even') . '">' . '<div class="var-name session">(' . __('Session value') . ')</div>' . '<div class="var-value value">&nbsp;' . formatVariable($name, $serverVarsSession[$name]) . '</div>' . '<div style="clear:both"></div>' . '</div>';
    }
    $odd_row = !$odd_row;
}
$output .= '</div>';
$response->addHtml($output);
/**
 * Format Variable
 *
 * @param string  $name  variable name
 * @param numeric $value variable value
 *
 * @return formatted string
 */
Beispiel #10
0
$scripts->addFile('jqplot/plugins/jqplot.cursor.js');
$scripts->addFile('jqplot/plugins/jqplot.byteFormatter.js');
$scripts->addFile('server_status_monitor.js');
$scripts->addFile('server_status_sorter.js');
/**
 * start output
 */
$ServerStatusData = new PMA_ServerStatusData();
/**
 * Define some data needed on the client side
 */
$input = '<input type="hidden" name="%s" value="%s" />';
$form = '<form id="js_data" class="hide">';
$form .= sprintf($input, 'server_time', microtime(true) * 1000);
$form .= sprintf($input, 'server_os', PHP_OS);
$form .= sprintf($input, 'is_superuser', PMA_isSuperuser());
$form .= sprintf($input, 'server_db_isLocal', $ServerStatusData->db_isLocal);
$form .= '</form>';
/**
 * Define some links used on client side
 */
$links = '<div id="profiling_docu" class="hide">';
$links .= PMA_Util::showMySQLDocu('general-thread-states', 'general-thread-states');
$links .= '</div>';
$links .= '<div id="explain_docu" class="hide">';
$links .= PMA_Util::showMySQLDocu('explain-output', 'explain-output');
$links .= '</div>';
/**
 * Output
 */
$response->addHTML('<div>');