get rid of propicon
This commit is contained in:
67
test/core.lib.php
Normal file
67
test/core.lib.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/* $Id: common.lib.php 9832 2007-01-09 09:50:49Z nijel $ */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
/**
|
||||
* Core testing library to wrap phpMyAdmin and add some useful functions.
|
||||
*
|
||||
* @author Michal Čihař <michal@cihar.com>
|
||||
* @package phpMyAdmin-test
|
||||
*/
|
||||
|
||||
/**
|
||||
* Go to root directory.
|
||||
*/
|
||||
chdir('..');
|
||||
|
||||
|
||||
/**
|
||||
* Report failed test.
|
||||
*
|
||||
* @param string function to test
|
||||
* @param string test description
|
||||
* @param string failure description
|
||||
*/
|
||||
function PMA_test_fail($function, $test, $message) {
|
||||
$function = htmlspecialchars($function);
|
||||
$test = htmlspecialchars($test);
|
||||
$message = htmlspecialchars($message);
|
||||
echo <<<EOT
|
||||
<dt>$function ($test)</dt>
|
||||
<dd><strong>Failed:</strong> $message</dd>
|
||||
EOT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Report ok test.
|
||||
*
|
||||
* @param string function to test
|
||||
* @param string test description
|
||||
*/
|
||||
function PMA_test_okay($function, $test) {
|
||||
$function = htmlspecialchars($function);
|
||||
$test = htmlspecialchars($test);
|
||||
echo <<<EOT
|
||||
<dt>$function ($test)</dt>
|
||||
<dd><strong>OK</strong></dd>
|
||||
EOT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function for testing strings.
|
||||
*
|
||||
* @uses PMA_test_okay()
|
||||
* @uses PMA_test_fail()
|
||||
* @param string function to test
|
||||
* @param string test description
|
||||
* @param string actual result
|
||||
* @param string expected result
|
||||
*/
|
||||
function PMA_test_string($function, $test, $received, $expected) {
|
||||
if ($received != $expected) {
|
||||
PMA_test_fail($function, $test, "Strings >$received< and >$expected< do not match");
|
||||
} else {
|
||||
PMA_test_okay($function, $test);
|
||||
}
|
||||
}
|
||||
?>
|
39
test/escape_js_string.php
Normal file
39
test/escape_js_string.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/* $Id: common.lib.php 9832 2007-01-09 09:50:49Z nijel $ */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
/**
|
||||
* Test for javascript escaping.
|
||||
*
|
||||
* @author Michal Čihař <michal@cihar.com>
|
||||
* @package phpMyAdmin-test
|
||||
*/
|
||||
|
||||
/**
|
||||
* Tests core.
|
||||
*/
|
||||
include('./core.lib.php');
|
||||
/**
|
||||
* Include to test.
|
||||
*/
|
||||
include('./libraries/js_escape.lib.php');
|
||||
|
||||
/**
|
||||
* Test java script escaping.
|
||||
*
|
||||
* @uses PMA_escapeJsString()
|
||||
* @uses PMA_test_string()
|
||||
* @param string string to escape
|
||||
* @param string expected result
|
||||
*/
|
||||
function PMA_test_escape($test, $expected) {
|
||||
PMA_test_string('PMA_escapeJsString', $test, PMA_escapeJsString($test), $expected);
|
||||
}
|
||||
|
||||
PMA_test_escape('\';', '\\\';');
|
||||
PMA_test_escape("\r\n'<scrIpt></sCRIPT>", '\r\n\\\'<scrIpt></\' + \'script>');
|
||||
PMA_test_escape('\';[XSS]', '\\\';[XSS]');
|
||||
PMA_test_escape('</SCRIPT></head><body>[HTML]', '</\' + \'script></head><body>[HTML]');
|
||||
PMA_test_escape('"\'\\\'"', '"\\\'\\\\\\\'"');
|
||||
PMA_test_escape("\\''''''''''''\\", "\\\\\'\'\'\'\'\'\'\'\'\'\'\'\\\\");
|
||||
?>
|
@@ -5,6 +5,7 @@
|
||||
* theme test
|
||||
*
|
||||
* @uses libraries/common.lib.php global fnctions
|
||||
* @package phpMyAdmin-test
|
||||
*/
|
||||
|
||||
chdir( '..' );
|
||||
@@ -31,9 +32,9 @@ header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
|
||||
<meta http-equiv="Content-Type"
|
||||
content="text/html; charset=<?php echo $GLOBALS['charset']; ?>" />
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="../css/phpmyadmin.css.php?<?php echo PMA_generate_common_url(); ?>&js_frame=right&nocache=<?php echo $_SESSION['PMA_Config']->getMtime(); ?>" />
|
||||
href="../phpmyadmin.css.php?<?php echo PMA_generate_common_url(); ?>&js_frame=right&nocache=<?php echo $_SESSION['PMA_Config']->getMtime(); ?>" />
|
||||
<link rel="stylesheet" type="text/css" media="print"
|
||||
href="../css/print.css?<?php echo PMA_generate_common_url(); ?>" />
|
||||
href="../print.css" />
|
||||
<script src="../js/functions.js" type="text/javascript"
|
||||
language="javascript"></script>
|
||||
</head>
|
||||
|
Reference in New Issue
Block a user