/** * Sanitizes $message, taking into account our special codes * for formatting. * * If you want to include result in element attribute, you should escape it. * * Examples: * * <p><?php echo PMA_sanitize($foo); ?></p> * * <a title="<?php echo PMA_sanitize($foo, true); ?>">bar</a> * * @uses preg_replace() * @uses strtr() * @param string the message * @param boolean whether to escape html in result * * @return string the sanitized message * * @access public */ function PMA_sanitize($message, $escape = false, $safe = false) { if (!$safe) { $message = strtr($message, array('<' => '<', '>' => '>')); } $replace_pairs = array('[i]' => '<em>', '[/i]' => '</em>', '[em]' => '<em>', '[/em]' => '</em>', '[b]' => '<strong>', '[/b]' => '</strong>', '[strong]' => '<strong>', '[/strong]' => '</strong>', '[tt]' => '<code>', '[/tt]' => '</code>', '[code]' => '<code>', '[/code]' => '</code>', '[kbd]' => '<kbd>', '[/kbd]' => '</kbd>', '[br]' => '<br />', '[/a]' => '</a>', '[sup]' => '<sup>', '[/sup]' => '</sup>'); $message = strtr($message, $replace_pairs); $pattern = '/\\[a@([^"@]*)@([^]"]*)\\]/'; if (preg_match_all($pattern, $message, $founds, PREG_SET_ORDER)) { $valid_links = array('http', './Do', './ur'); foreach ($founds as $found) { // only http... and ./Do... allowed if (!in_array(substr($found[1], 0, 4), $valid_links)) { return $message; } // a-z and _ allowed in target if (!empty($found[2]) && preg_match('/[^a-z_]+/i', $found[2])) { return $message; } } if (substr($found[1], 0, 4) == 'http') { $message = preg_replace($pattern, '<a href="' . PMA_linkURL($found[1]) . '" target="\\2">', $message); } else { $message = preg_replace($pattern, '<a href="\\1" target="\\2">', $message); } } if ($escape) { $message = htmlspecialchars($message); } return $message; }
/** * 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); }
/** * Callback function for replacing [a@link@target] links in bb code. * * @param array $found Array of preg matches * * @return string Replaced string */ public static function replaceBBLink($found) { /* Check for valid link */ if (!Sanitize::checkLink($found[1])) { return $found[0]; } /* a-z and _ allowed in target */ if (!empty($found[3]) && preg_match('/[^a-z_]+/i', $found[3])) { return $found[0]; } /* Construct target */ $target = ''; if (!empty($found[3])) { $target = ' target="' . $found[3] . '"'; if ($found[3] == '_blank') { $target .= ' rel="noopener noreferrer"'; } } /* Construct url */ if (substr($found[1], 0, 4) == 'http') { $url = PMA_linkURL($found[1]); } else { $url = $found[1]; } return '<a href="' . $url . '"' . $target . '>'; }
/** * Does the actual work of each specific transformations plugin. * * @param string $buffer text to be transformed * @param array $options transformation options * @param string $meta meta information * * @return void */ public function applyTransformation($buffer, $options = array(), $meta = '') { $append_part = isset($options[2]) && $options[2] ? '' : $buffer; $transform_options = array('string' => '<a href="' . PMA_linkURL((isset($options[0]) ? $options[0] : '') . $append_part) . '" title="' . (isset($options[1]) ? $options[1] : '') . '" target="_new">' . (isset($options[1]) ? $options[1] : $buffer) . '</a>'); $buffer = PMA_transformation_global_html_replace($buffer, $transform_options); return $buffer; }
/** * */ function PMA_transformation_text_plain__link($buffer, $options = array(), $meta = '') { include_once './libraries/transformations/global.inc.php'; // $transform_options = array ('string' => '<a href="' . (isset($options[0]) ? $options[0] : '') . '%1$s" title="' . (isset($options[1]) ? $options[1] : '%1$s') . '">' . (isset($options[1]) ? $options[1] : '%1$s') . '</a>'); $transform_options = array('string' => '<a href="' . PMA_linkURL((isset($options[0]) ? $options[0] : '') . $buffer) . '" title="' . (isset($options[1]) ? $options[1] : '') . '">' . (isset($options[1]) ? $options[1] : $buffer) . '</a>'); $buffer = PMA_transformation_global_html_replace($buffer, $transform_options); return $buffer; }
/** * Wraps link in <a> tags and replaces argument separator in internal links * to the one returned by PMA_get_arg_separator() * * @param string $link * @param string $text * @return string */ function PMA_lang_link_replace($link, $text) { static $separator; if (!isset($separator)) { $separator = PMA_get_arg_separator('html'); } if (!preg_match('#^https?://#', $link)) { $link = str_replace('&', $separator, $link); } else { $link = PMA_linkURL($link); } return '<a href="' . $link . '">' . $text . '</a>'; }
/** * Callback function for replacing [a@link@target] links in bb code. * * @param array $found Array of preg matches * * @return string Replaced string */ function PMA_replaceBBLink($found) { /* Check for valid link */ if (!PMA_checkLink($found[1])) { return $found[0]; } /* a-z and _ allowed in target */ if (!empty($found[3]) && preg_match('/[^a-z_]+/i', $found[3])) { return $found[0]; } /* Construct target */ $target = ''; if (!empty($found[3])) { $target = ' target="' . $found[3] . '"'; } /* Construct url */ if (substr($found[1], 0, 4) == 'http') { $url = PMA_linkURL($found[1]); } else { $url = $found[1]; } return '<a href="' . $url . '"' . $target . '>'; }
/** * Displays authentication form * * this function MUST exit/quit the application * * @global string $conn_error the last connection error * * @return boolean|void */ public function auth() { global $conn_error; $response = PMA_Response::getInstance(); if ($response->isAjax()) { $response->setRequestStatus(false); // redirect_flag redirects to the login page $response->addJSON('redirect_flag', '1'); if (defined('TESTSUITE')) { return true; } else { exit; } } /* Perform logout to custom URL */ if (!empty($_REQUEST['old_usr']) && !empty($GLOBALS['cfg']['Server']['LogoutURL'])) { PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['LogoutURL']); if (defined('TESTSUITE')) { return true; } else { exit; } } // No recall if blowfish secret is not configured as it would produce // garbage if ($GLOBALS['cfg']['LoginCookieRecall'] && !empty($GLOBALS['cfg']['blowfish_secret'])) { $default_user = $GLOBALS['PHP_AUTH_USER']; $default_server = $GLOBALS['pma_auth_server']; $autocomplete = ''; } else { $default_user = ''; $default_server = ''; // skip the IE autocomplete feature. $autocomplete = ' autocomplete="off"'; } $response->getFooter()->setMinimal(); $header = $response->getHeader(); $header->setBodyId('loginform'); $header->setTitle('phpMyAdmin'); $header->disableMenuAndConsole(); $header->disableWarnings(); if (file_exists(CUSTOM_HEADER_FILE)) { include CUSTOM_HEADER_FILE; } echo ' <div class="container"> <a href="'; echo PMA_linkURL('https://www.phpmyadmin.net/'); echo '" target="_blank" class="logo">'; $logo_image = $GLOBALS['pmaThemeImage'] . 'logo_right.png'; if (@file_exists($logo_image)) { echo '<img src="' . $logo_image . '" id="imLogo" name="imLogo" alt="phpMyAdmin" border="0" />'; } else { echo '<img name="imLogo" id="imLogo" src="' . $GLOBALS['pmaThemeImage'] . 'pma_logo.png' . '" ' . 'border="0" width="88" height="31" alt="phpMyAdmin" />'; } echo '</a> <h1>'; echo sprintf(__('Welcome to %s'), '<bdo dir="ltr" lang="en">phpMyAdmin</bdo>'); echo "</h1>"; // Show error message if (!empty($conn_error)) { PMA_Message::rawError($conn_error)->display(); } elseif (isset($_GET['session_expired']) && intval($_GET['session_expired']) == 1) { PMA_Message::rawError(__('Your session has expired. Please log in again.'))->display(); } echo "<noscript>\n"; PMA_message::error(__("Javascript must be enabled past this point!"))->display(); echo "</noscript>\n"; echo "<div class='hide js-show'>"; // Displays the languages form if (empty($GLOBALS['cfg']['Lang'])) { include_once './libraries/display_select_lang.lib.php'; // use fieldset, don't show doc link echo PMA_getLanguageSelectorHtml(true, false); } echo '</div> <br /> <!-- Login form --> <form method="post" action="index.php" name="login_form"' . $autocomplete . ' class="disableAjax login hide js-show"> <fieldset> <legend>'; echo __('Log in'); echo PMA_Util::showDocu('index'); echo '</legend>'; if ($GLOBALS['cfg']['AllowArbitraryServer']) { echo ' <div class="item"> <label for="input_servername" title="'; echo __('You can enter hostname/IP address and port separated by space.'); echo '">'; echo __('Server:'); echo '</label> <input type="text" name="pma_servername" id="input_servername"'; echo ' value="'; echo htmlspecialchars($default_server); echo '" size="24" class="textfield" title="'; echo __('You can enter hostname/IP address and port separated by space.'); echo '" /> </div>'; } echo '<div class="item"> <label for="input_username">' . __('Username:'******'</label> <input type="text" name="pma_username" id="input_username" ' . 'value="' . htmlspecialchars($default_user) . '" size="24"' . ' class="textfield"/> </div> <div class="item"> <label for="input_password">' . __('Password:'******'</label> <input type="password" name="pma_password" id="input_password"' . ' value="" size="24" class="textfield" /> </div>'; if (count($GLOBALS['cfg']['Servers']) > 1) { echo '<div class="item"> <label for="select_server">' . __('Server Choice:') . '</label> <select name="server" id="select_server"'; if ($GLOBALS['cfg']['AllowArbitraryServer']) { echo ' onchange="document.forms[\'login_form\'].' . 'elements[\'pma_servername\'].value = \'\'" '; } echo '>'; include_once './libraries/select_server.lib.php'; echo PMA_selectServer(false, false); echo '</select></div>'; } else { echo ' <input type="hidden" name="server" value="' . $GLOBALS['server'] . '" />'; } // end if (server choice) // Add captcha input field if reCaptcha is enabled if (!empty($GLOBALS['cfg']['CaptchaLoginPrivateKey']) && !empty($GLOBALS['cfg']['CaptchaLoginPublicKey'])) { // If enabled show captcha to the user on the login screen. echo '<script src="https://www.google.com/recaptcha/api.js?hl=' . $GLOBALS['lang'] . '" async defer></script>'; echo '<div class="g-recaptcha" data-sitekey="' . $GLOBALS['cfg']['CaptchaLoginPublicKey'] . '"></div>'; } echo '</fieldset> <fieldset class="tblFooters"> <input value="' . __('Go') . '" type="submit" id="input_go" />'; $_form_params = array(); if (!empty($GLOBALS['target'])) { $_form_params['target'] = $GLOBALS['target']; } if (!empty($GLOBALS['db'])) { $_form_params['db'] = $GLOBALS['db']; } if (!empty($GLOBALS['table'])) { $_form_params['table'] = $GLOBALS['table']; } // do not generate a "server" hidden field as we want the "server" // drop-down to have priority echo PMA_URL_getHiddenInputs($_form_params, '', 0, 'server'); echo '</fieldset> </form>'; // BEGIN Swekey Integration Swekey_login('input_username', 'input_go'); // END Swekey Integration if ($GLOBALS['error_handler']->hasDisplayErrors()) { echo '<div id="pma_errors">'; $GLOBALS['error_handler']->dispErrors(); echo '</div>'; } echo '</div>'; if (file_exists(CUSTOM_FOOTER_FILE)) { include CUSTOM_FOOTER_FILE; } if (!defined('TESTSUITE')) { exit; } else { return true; } }
echo '<h2>phpMyAdmin</h2>'; echo '<ul>'; $class = null; // We rely on CSP to allow access to http://www.phpmyadmin.net, but IE lacks // support here and does not allow request to http once using https. if ($GLOBALS['cfg']['VersionCheck'] && (!$GLOBALS['PMA_Config']->get('is_https') || PMA_USR_BROWSER_AGENT != 'IE')) { $class = 'jsversioncheck'; } PMA_printListItem(__('Version information:') . ' ' . PMA_VERSION, 'li_pma_version', null, null, null, null, $class); PMA_printListItem(__('Documentation'), 'li_pma_docs', PMA_Util::getDocuLink('index'), null, '_blank'); PMA_printListItem(__('Wiki'), 'li_pma_wiki', PMA_linkURL('http://wiki.phpmyadmin.net/'), null, '_blank'); // does not work if no target specified, don't know why PMA_printListItem(__('Official Homepage'), 'li_pma_homepage', PMA_linkURL('http://www.phpMyAdmin.net/'), null, '_blank'); PMA_printListItem(__('Contribute'), 'li_pma_contribute', PMA_linkURL('http://www.phpmyadmin.net/home_page/improve.php'), null, '_blank'); PMA_printListItem(__('Get support'), 'li_pma_support', PMA_linkURL('http://www.phpmyadmin.net/home_page/support.php'), null, '_blank'); PMA_printListItem(__('List of changes'), 'li_pma_changes', PMA_linkURL('changelog.php'), null, '_blank'); echo ' </ul>'; echo ' </div>'; echo '</div>'; echo '</div>'; /** * Warning if using the default MySQL privileged account */ if ($server != 0 && $cfg['Server']['user'] == 'root' && $cfg['Server']['password'] == '') { trigger_error(__('Your configuration file contains settings (root with no password)' . ' that correspond to the default MySQL privileged account.' . ' Your MySQL server is running with this default, is open to' . ' intrusion, and you really should fix this security hole by' . ' setting a password for user \'root\'.'), E_USER_WARNING); } /** * As we try to handle charsets by ourself, mbstring overloads just * break it, see bug 1063821. */ if (@extension_loaded('mbstring') && @ini_get('mbstring.func_overload') > 1) {
'li_pma_contribute', PMA_linkURL('http://www.phpmyadmin.net/home_page/improve.php'), null, '_blank' ); PMA_printListItem( __('Get support'), 'li_pma_support', PMA_linkURL('http://www.phpmyadmin.net/home_page/support.php'), null, '_blank' ); PMA_printListItem( __('List of changes'), 'li_pma_changes', PMA_linkURL('changelog.php'), null, '_blank' ); ?> </ul> </div> </div> <?php /** * BUG: MSIE needs two <br /> here, otherwise it will not extend the outer div to the * full height of the inner divs */ ?>
/** * Displays authentication form * * this function MUST exit/quit the application * * @global string the last connection error * * @access public */ function PMA_auth() { global $conn_error; /* Perform logout to custom URL */ if (!empty($_REQUEST['old_usr']) && !empty($GLOBALS['cfg']['Server']['LogoutURL'])) { PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['LogoutURL']); exit; } /* No recall if blowfish secret is not configured as it would produce garbage */ if ($GLOBALS['cfg']['LoginCookieRecall'] && !empty($GLOBALS['cfg']['blowfish_secret'])) { $default_user = $GLOBALS['PHP_AUTH_USER']; $default_server = $GLOBALS['pma_auth_server']; $autocomplete = ''; } else { $default_user = ''; $default_server = ''; // skip the IE autocomplete feature. $autocomplete = ' autocomplete="off"'; } $cell_align = $GLOBALS['text_dir'] == 'ltr' ? 'left' : 'right'; // Defines the charset to be used header('Content-Type: text/html; charset=utf-8'); /* HTML header; do not show here the PMA version to improve security */ $page_title = 'phpMyAdmin '; include './libraries/header_meta_style.inc.php'; // if $page_title is set, this script uses it as the title: include './libraries/header_scripts.inc.php'; ?> </head> <body class="loginform"> <?php if (file_exists(CUSTOM_HEADER_FILE)) { include CUSTOM_HEADER_FILE; } ?> <div class="container"> <a href="<?php echo PMA_linkURL('http://www.phpmyadmin.net/'); ?> " target="_blank" class="logo"><?php $logo_image = $GLOBALS['pmaThemeImage'] . 'logo_right.png'; if (@file_exists($logo_image)) { echo '<img src="' . $logo_image . '" id="imLogo" name="imLogo" alt="phpMyAdmin" border="0" />'; } else { echo '<img name="imLogo" id="imLogo" src="' . $GLOBALS['pmaThemeImage'] . 'pma_logo.png' . '" ' . 'border="0" width="88" height="31" alt="phpMyAdmin" />'; } ?> </a> <h1> <?php echo sprintf(__('Welcome to %s'), '<bdo dir="ltr" lang="en">' . $page_title . '</bdo>'); ?> </h1> <?php // Show error message if (!empty($conn_error)) { PMA_Message::rawError($conn_error)->display(); } echo "<noscript>\n"; PMA_message::error(__("Javascript must be enabled past this point"))->display(); echo "</noscript>\n"; echo "<div class='hide js-show'>"; // Displays the languages form if (empty($GLOBALS['cfg']['Lang'])) { include_once './libraries/display_select_lang.lib.php'; // use fieldset, don't show doc link PMA_select_language(true, false); } echo "</div>"; ?> <br /> <!-- Login form --> <form method="post" action="index.php" name="login_form"<?php echo $autocomplete; ?> target="_top" class="login hide js-show"> <fieldset> <legend> <?php echo __('Log in'); echo PMA_showDocu(''); ?> </legend> <?php if ($GLOBALS['cfg']['AllowArbitraryServer']) { ?> <div class="item"> <label for="input_servername" title="<?php echo __('You can enter hostname/IP address and port separated by space.'); ?> "><?php echo __('Server:'); ?> </label> <input type="text" name="pma_servername" id="input_servername" value="<?php echo htmlspecialchars($default_server); ?> " size="24" class="textfield" title="<?php echo __('You can enter hostname/IP address and port separated by space.'); ?> " /> </div> <?php } ?> <div class="item"> <label for="input_username"><?php echo __('Username:'******'Password:'******'cfg']['Servers']) > 1) { ?> <div class="item"> <label for="select_server"><?php echo __('Server Choice'); ?> :</label> <select name="server" id="select_server" <?php if ($GLOBALS['cfg']['AllowArbitraryServer']) { echo ' onchange="document.forms[\'login_form\'].elements[\'pma_servername\'].value = \'\'" '; } echo '>'; include_once './libraries/select_server.lib.php'; PMA_select_server(false, false); echo '</select></div>'; } else { echo ' <input type="hidden" name="server" value="' . $GLOBALS['server'] . '" />'; } // end if (server choice) ?> </fieldset> <fieldset class="tblFooters"> <input value="<?php echo __('Go'); ?> " type="submit" id="input_go" /> <?php $_form_params = array(); if (!empty($GLOBALS['target'])) { $_form_params['target'] = $GLOBALS['target']; } if (!empty($GLOBALS['db'])) { $_form_params['db'] = $GLOBALS['db']; } if (!empty($GLOBALS['table'])) { $_form_params['table'] = $GLOBALS['table']; } // do not generate a "server" hidden field as we want the "server" // drop-down to have priority echo PMA_generate_common_hidden_inputs($_form_params, '', 0, 'server'); ?> </fieldset> </form> <?php // BEGIN Swekey Integration Swekey_login('input_username', 'input_go'); // END Swekey Integration // show the "Cookies required" message only if cookies are disabled // (we previously tried to set some cookies) if (empty($_COOKIE)) { trigger_error(__('Cookies must be enabled past this point.'), E_USER_NOTICE); } if ($GLOBALS['error_handler']->hasDisplayErrors()) { echo '<div>'; $GLOBALS['error_handler']->dispErrors(); echo '</div>'; } ?> </div> <?php if (file_exists(CUSTOM_FOOTER_FILE)) { include CUSTOM_FOOTER_FILE; } ?> <script type="text/javascript"> //<![CDATA[ // show login form in top frame. if (top != self || document.body.className != 'loginform') { window.top.location.href=location; } //]]> </script> </body> </html> <?php exit; }
/** * Get content of documentation page * * @return string */ public function getPageDocumentation() { $output = '<p>' . sprintf(__('Documentation and further information about PBXT' . ' can be found on the %sPrimeBase XT Home Page%s.'), '<a href="' . PMA_linkURL('http://www.primebase.com/xt/') . '" target="_blank">', '</a>') . '</p>' . "\n" . '<h3>' . __('Related Links') . '</h3>' . "\n" . '<ul>' . "\n" . '<li><a href="' . PMA_linkURL('http://pbxt.blogspot.com/') . '" target="_blank">' . __('The PrimeBase XT Blog by Paul McCullagh') . '</a></li>' . "\n" . '</ul>' . "\n"; return $output; }
/** * Returns link to wiki * * @param string $path * @return string */ public function getWikiLink($path) { $opt_name = $this->_getOptName($path); if (substr($opt_name, 0, 7) == 'Servers') { $opt_name = substr($opt_name, 8); if (strpos($opt_name, 'AllowDeny') === 0) { $opt_name = str_replace('_', '_.28', $opt_name) . '.29'; } } $test = substr($path, 0, 6); if ($test == 'Import') { $opt_name = substr($opt_name, 7); if ($opt_name == 'format') { $opt_name = 'format_2'; } } if ($test == 'Export') { $opt_name = substr($opt_name, 7); } return PMA_linkURL('http://wiki.phpmyadmin.net/pma/Config#' . $opt_name); }
/** * Perform login using Swekey. */ function Swekey_login($input_name, $input_go) { $swekeyErr = Swekey_auth_error(); if ($swekeyErr != null) { PMA_Message::error($swekeyErr)->display(); if ($GLOBALS['error_handler']->hasDisplayErrors()) { echo '<div>'; $GLOBALS['error_handler']->dispErrors(); echo '</div>'; } } if (isset($_SESSION['SWEKEY']) && $_SESSION['SWEKEY']['ENABLED']) { echo '<script type="text/javascript">'; if (empty($_SESSION['SWEKEY']['FORCE_USER'])) { echo 'var user = null;'; } else { echo 'var user = "******";'; } ?> function open_swekey_site() { window.open("<?php echo PMA_linkURL('http://phpmyadmin.net/auth_key'); ?> "); } var input_username = document.getElementById("<?php echo $input_name; ?> "); var input_go = document.getElementById("<?php echo $input_go; ?> "); var swekey_status = document.createElement('img'); swekey_status.setAttribute('onclick', 'open_swekey_site()'); swekey_status.setAttribute('style', 'width:8px; height:16px; border:0px; vspace:0px; hspace:0px; frameborder:no'); if (user == null) { swekey_status.setAttribute('src', 'http://artwork.swekey.com/unplugged-8x16.png'); //swekey_status.setAttribute('title', 'No swekey plugged'); input_go.disabled = true; } else { swekey_status.setAttribute('src', 'http://artwork.swekey.com/plugged-8x16.png'); //swekey_status.setAttribute('title', 'swekey plugged'); input_username.value = user; } input_username.readOnly = true; if (input_username.nextSibling == null) { input_username.parentNode.appendChild(swekey_status); } else { input_username.parentNode.insertBefore(swekey_status, input_username.nextSibling); } <?php echo '</script>'; } }
} ?> <li> <label for="filename_template" class="desc"> <?php echo __('File name template:'); $trans = new PMA_Message(); $trans->addMessage(__('@SERVER@ will become the server name')); if ($export_type == 'database' || $export_type == 'table') { $trans->addMessage(__(', @DATABASE@ will become the database name')); if ($export_type == 'table') { $trans->addMessage(__(', @TABLE@ will become the table name')); } } $message = new PMA_Message(__('This value is interpreted using %1$sstrftime%2$s, so you can use time formatting strings. Additionally the following transformations will happen: %3$s. Other text will be kept as is. See the %4$sFAQ%5$s for details.')); $message->addParam('<a href="' . PMA_linkURL(PMA_getPHPDocLink('function.strftime.php')) . '" target="documentation" title="' . __('Documentation') . '">', false); $message->addParam('</a>', false); $message->addParam($trans); $message->addParam('<a href="Documentation.html#faq6_27" target="documentation">', false); $message->addParam('</a>', false); echo PMA_showHint($message); ?> </label> <input type="text" name="filename_template" id="filename_template" <?php echo ' value="'; if (isset($_GET['filename_template'])) { echo htmlspecialchars($_GET['filename_template']); } else { if ($export_type == 'database') { echo htmlspecialchars($GLOBALS['PMA_Config']->getUserValue('pma_db_filename_template', $GLOBALS['cfg']['Export']['file_template_database']));
<?php /* vim: set expandtab sw=4 ts=4 sts=4: */ /** * Displays list of themes. * * @package PhpMyAdmin */ /** * get some globals */ require './libraries/common.inc.php'; $response = PMA_Response::getInstance(); $response->getFooter()->setMinimal(); $header = $response->getHeader(); $header->setBodyId('bodythemes'); $header->setTitle('phpMyAdmin - ' . __('Theme')); $header->disableMenuAndConsole(); $hash = '#pma_' . preg_replace('/([0-9]*)\\.([0-9]*)\\..*/', '\\1_\\2', PMA_VERSION); $url = PMA_linkURL('https://www.phpmyadmin.net/themes/') . $hash; $output = '<h1>phpMyAdmin - ' . __('Theme') . '</h1>'; $output .= '<p>'; $output .= '<a href="' . $url . '" class="_blank">'; $output .= __('Get more themes!'); $output .= '</a>'; $output .= '</p>'; $output .= $_SESSION['PMA_Theme_Manager']->getPrintPreviews(); $response->addHTML($output);
/** * Test for getPage * * @return void */ public function testGetPage() { $this->assertEquals($this->object->getPage('Documentation'), '<p>' . sprintf(__('Documentation and further information about PBXT' . ' can be found on the %sPrimeBase XT Home Page%s.'), '<a href="' . PMA_linkURL('https://mariadb.com/kb/en/mariadb/about-pbxt/') . '" rel="noopener noreferrer" target="_blank">', '</a>') . '</p>' . "\n"); $this->assertEquals($this->object->getPage('NonExistMethod'), false); }
/** * Callback for wrapping links with PMA_linkURL * * @param array $matches List of matched elements form preg_replace_callback * * @return string Replacement value */ private function replaceLinkURL($matches) { return 'href="' . PMA_linkURL($matches[2]) . '" target="_blank"'; }
echo sprintf(__('No themes support; please check your configuration and/or your themes in directory %s.'), $cfg['ThemePath']); ?> '); self.close(); } } // ]]> </script> </head> <body id="bodythemes"> <h1>phpMyAdmin - <?php echo __('Theme / Style'); ?> </h1> <p><a href="<?php echo PMA_linkURL('http://www.phpmyadmin.net/home_page/themes.php'); ?> #pma_<?php echo preg_replace('/([0-9]*)\\.([0-9]*)\\..*/', '\\1_\\2', PMA_VERSION); ?> "><?php echo __('Get more themes!'); ?> </a></p> <?php $_SESSION['PMA_Theme_Manager']->printPreviews(); ?> </body> </html>
/** * Prints Html For Export Options * * @param String $export_type Selected Export Type * * @return string */ function PMA_getHtmlForExportOptionsOutputFormat($export_type) { $html = '<li>'; $html .= '<label for="filename_template" class="desc">'; $html .= __('File name template:'); $trans = new PMA_Message(); $trans->addMessage(__('@SERVER@ will become the server name')); if ($export_type == 'database' || $export_type == 'table') { $trans->addMessage(__(', @DATABASE@ will become the database name')); if ($export_type == 'table') { $trans->addMessage(__(', @TABLE@ will become the table name')); } } $msg = new PMA_Message(__('This value is interpreted using %1$sstrftime%2$s, ' . 'so you can use time formatting strings. ' . 'Additionally the following transformations will happen: %3$s. ' . 'Other text will be kept as is. See the %4$sFAQ%5$s for details.')); $msg->addParam('<a href="' . PMA_linkURL(PMA_getPHPDocLink('function.strftime.php')) . '" target="documentation" title="' . __('Documentation') . '">', false); $msg->addParam('</a>', false); $msg->addParam($trans); $doc_url = PMA_Util::getDocuLink('faq', 'faq6-27'); $msg->addParam('<a href="' . $doc_url . '" target="documentation">', false); $msg->addParam('</a>', false); $html .= PMA_Util::showHint($msg); $html .= '</label>'; $html .= '<input type="text" name="filename_template" id="filename_template" '; $html .= ' value="'; if (isset($_GET['filename_template'])) { $html .= htmlspecialchars($_GET['filename_template']); } else { if ($export_type == 'database') { $html .= htmlspecialchars($GLOBALS['PMA_Config']->getUserValue('pma_db_filename_template', $GLOBALS['cfg']['Export']['file_template_database'])); } elseif ($export_type == 'table') { $html .= htmlspecialchars($GLOBALS['PMA_Config']->getUserValue('pma_table_filename_template', $GLOBALS['cfg']['Export']['file_template_table'])); } else { $html .= htmlspecialchars($GLOBALS['PMA_Config']->getUserValue('pma_server_filename_template', $GLOBALS['cfg']['Export']['file_template_server'])); } } $html .= '"'; $html .= '/>'; $html .= '<input type="checkbox" name="remember_template" '; $html .= 'id="checkbox_remember_template" '; $html .= PMA_exportCheckboxCheck('remember_file_template'); $html .= '/>'; $html .= '<label for="checkbox_remember_template">'; $html .= __('use this for future exports'); $html .= '</label>'; $html .= '</li>'; return $html; }
function getPageDocumentation() { $output = '<p>' . sprintf(__('Documentation and further information about PBMS can be found on %sThe PrimeBase Media Streaming home page%s.'), '<a href="' . PMA_linkURL('http://www.blobstreaming.org/') . '" target="_blank">', '</a>') . '</p>' . "\n" . '<h3>' . __('Related Links') . '</h3>' . "\n" . '<ul>' . "\n" . '<li><a href="' . PMA_linkURL('http://bpbdev.blogspot.com/') . '" target="_blank">' . __('The PrimeBase Media Streaming Blog by Barry Leslie') . '</a></li>' . "\n" . '<li><a href="' . PMA_linkURL('http://www.primebase.com/xt') . '" target="_blank">' . __('PrimeBase XT Home Page') . '</a></li>' . "\n" . '</ul>' . "\n"; return $output; }
/** * Test for getPage * * @return void */ public function testGetPage() { $this->assertEquals($this->object->getPage('Documentation'), '<p>' . sprintf(__('Documentation and further information about PBXT' . ' can be found on the %sPrimeBase XT Home Page%s.'), '<a href="' . PMA_linkURL('http://www.primebase.com/xt/') . '" target="_blank">', '</a>') . '</p>' . "\n" . '<h3>' . __('Related Links') . '</h3>' . "\n" . '<ul>' . "\n" . '<li><a href="' . PMA_linkURL('http://pbxt.blogspot.com/') . '" target="_blank">' . __('The PrimeBase XT Blog by Paul McCullagh') . '</a></li>' . "\n" . '</ul>' . "\n"); $this->assertEquals($this->object->getPage('NonExistMethod'), false); }
/** * Displays a lightbulb hint explaining a known external bug * that affects a functionality * * @param string $functionality localized message explaining the func. * @param string $component 'mysql' (eventually, 'php') * @param string $minimum_version of this component * @param string $bugref bug reference for this component */ function PMA_externalBug($functionality, $component, $minimum_version, $bugref) { if ($component == 'mysql' && PMA_MYSQL_INT_VERSION < $minimum_version) { echo PMA_showHint(sprintf(__('The %s functionality is affected by a known bug, see %s'), $functionality, PMA_linkURL('http://bugs.mysql.com/') . $bugref)); } }
echo '<div class="group pmagroup">'; echo '<h2>phpMyAdmin</h2>'; echo '<ul>'; $class = null; // We rely on CSP to allow access to http://www.phpmyadmin.net, but IE lacks // support here and does not allow request to http once using https. if ($GLOBALS['cfg']['VersionCheck'] && (!$GLOBALS['PMA_Config']->get('is_https') || PMA_USR_BROWSER_AGENT != 'IE')) { $class = 'jsversioncheck'; } PMA_printListItem(__('Version information:') . ' <span class="version">' . PMA_VERSION . '</span>', 'li_pma_version', null, null, null, null, $class); PMA_printListItem(__('Documentation'), 'li_pma_docs', PMA\libraries\Util::getDocuLink('index'), null, '_blank'); PMA_printListItem(__('Wiki'), 'li_pma_wiki', PMA_linkURL('http://wiki.phpmyadmin.net/'), null, '_blank'); // does not work if no target specified, don't know why PMA_printListItem(__('Official Homepage'), 'li_pma_homepage', PMA_linkURL('http://www.phpMyAdmin.net/'), null, '_blank'); PMA_printListItem(__('Contribute'), 'li_pma_contribute', PMA_linkURL('https://www.phpmyadmin.net/contribute/'), null, '_blank'); PMA_printListItem(__('Get support'), 'li_pma_support', PMA_linkURL('https://www.phpmyadmin.net/support/'), null, '_blank'); PMA_printListItem(__('List of changes'), 'li_pma_changes', 'changelog.php' . PMA_URL_getCommon(), null, '_blank'); PMA_printListItem(__('License'), 'li_pma_license', 'license.php' . PMA_URL_getCommon(), null, '_blank'); echo ' </ul>'; echo ' </div>'; echo '</div>'; echo '</div>'; /** * As we try to handle charsets by ourself, mbstring overloads just * break it, see bug 1063821. */ if (@extension_loaded('mbstring') && @ini_get('mbstring.func_overload') > 1) { trigger_error(__('You have enabled mbstring.func_overload in your PHP ' . 'configuration. This option is incompatible with phpMyAdmin ' . 'and might cause some data to be corrupted!'), E_USER_WARNING); } /** * mbstring is used for handling multibytes inside parser, so it is good
echo '<div class="group pmagroup">'; echo '<h2>phpMyAdmin</h2>'; echo '<ul>'; $class = null; // We rely on CSP to allow access to http://www.phpmyadmin.net, but IE lacks // support here and does not allow request to http once using https. if ($GLOBALS['cfg']['VersionCheck'] && (!$GLOBALS['PMA_Config']->get('is_https') || PMA_USR_BROWSER_AGENT != 'IE')) { $class = 'jsversioncheck'; } PMA_printListItem(__('Version information:') . ' <span class="version">' . PMA_VERSION . '</span>', 'li_pma_version', null, null, null, null, $class); PMA_printListItem(__('Documentation'), 'li_pma_docs', PMA_Util::getDocuLink('index'), null, '_blank'); PMA_printListItem(__('Wiki'), 'li_pma_wiki', PMA_linkURL('http://wiki.phpmyadmin.net/'), null, '_blank'); // does not work if no target specified, don't know why PMA_printListItem(__('Official Homepage'), 'li_pma_homepage', PMA_linkURL('http://www.phpMyAdmin.net/'), null, '_blank'); PMA_printListItem(__('Contribute'), 'li_pma_contribute', PMA_linkURL('http://www.phpmyadmin.net/home_page/improve.php'), null, '_blank'); PMA_printListItem(__('Get support'), 'li_pma_support', PMA_linkURL('http://www.phpmyadmin.net/home_page/support.php'), null, '_blank'); PMA_printListItem(__('List of changes'), 'li_pma_changes', 'changelog.php' . PMA_URL_getCommon(), null, '_blank'); echo ' </ul>'; echo ' </div>'; echo '</div>'; echo '</div>'; /** * Warning if using the default MySQL privileged account */ if ($server != 0 && $cfg['Server']['user'] == 'root' && $cfg['Server']['password'] == '') { trigger_error(__('You are connected as \'root\' with no password, which' . ' corresponds to the default MySQL privileged account.' . ' Your MySQL server is running with this default, is open to' . ' intrusion, and you really should fix this security hole by' . ' setting a password for user \'root\'.'), E_USER_WARNING); } /** * As we try to handle charsets by ourself, mbstring overloads just * break it, see bug 1063821. */
/** * @dataProvider providerLinkURL */ public function testPMA_linkURL($link, $url){ $this->assertEquals(PMA_linkURL($link), $url); }
/** * Callback for wrapping links with PMA_linkURL * * @param array $matches List of matched elements form preg_replace_callback * * @return string Replacement value */ private function _replaceLinkURL($matches) { return 'href="' . PMA_linkURL($matches[2]) . '"'; }
<?php /* vim: set expandtab sw=4 ts=4 sts=4: */ /** * Displays list of themes. * * @package PhpMyAdmin */ /** * get some globals */ require './libraries/common.inc.php'; $response = PMA_Response::getInstance(); $response->getFooter()->setMinimal(); $header = $response->getHeader(); $header->setBodyId('bodythemes'); $header->setTitle('phpMyAdmin - ' . __('Theme')); $header->disableMenuAndConsole(); $hash = '#pma_' . preg_replace('/([0-9]*)\\.([0-9]*)\\..*/', '\\1_\\2', PMA_VERSION); $url = PMA_linkURL('http://www.phpmyadmin.net/home_page/themes.php') . $hash; $output = '<h1>phpMyAdmin - ' . __('Theme') . '</h1>'; $output .= '<p>'; $output .= '<a href="' . $url . '" class="_blank">'; $output .= __('Get more themes!'); $output .= '</a>'; $output .= '</p>'; $output .= $_SESSION['PMA_Theme_Manager']->getPrintPreviews(); $response->addHTML($output);
/** * Returns a link to the PHP documentation * * @param string $target anchor in documentation * * @return string the URL * * @access public */ function PMA_getPHPDocLink($target) { /* List of PHP documentation translations */ $php_doc_languages = array('pt_BR', 'zh', 'fr', 'de', 'it', 'ja', 'pl', 'ro', 'ru', 'fa', 'es', 'tr'); $lang = 'en'; if (in_array($GLOBALS['lang'], $php_doc_languages)) { $lang = $GLOBALS['lang']; } return PMA_linkURL('http://php.net/manual/' . $lang . '/' . $target); }
/** * Prepare a lightbulb hint explaining a known external bug * that affects a functionality * * @param string $functionality localized message explaining the func. * @param string $component 'mysql' (eventually, 'php') * @param string $minimum_version of this component * @param string $bugref bug reference for this component * * @return String */ public static function getExternalBug($functionality, $component, $minimum_version, $bugref) { $ext_but_html = ''; if ($component == 'mysql' && PMA_MYSQL_INT_VERSION < $minimum_version) { $ext_but_html .= self::showHint(sprintf(__('The %s functionality is affected by a known bug, see %s'), $functionality, PMA_linkURL('http://bugs.mysql.com/') . $bugref)); } return $ext_but_html; }