Remove unused files

This commit is contained in:
2025-04-21 23:33:16 -07:00
parent cc0daa1dfe
commit 96a499d4ec
65 changed files with 1 additions and 5673 deletions

View File

@@ -1,8 +0,0 @@
phpMyAdmin - Credits
====================
Please have a look to the Documentation.txt or
Documentation.html files, or visit
http://www.phpmyadmin.net/home_page/team.php and
http://www.phpmyadmin.net/home_page/about.php

View File

@@ -1,6 +0,0 @@
phpMyAdmin - Installation
=========================
Please have a look to the Documentation.txt or Documentation.html files.

2
README
View File

@@ -1,7 +1,7 @@
phpMyAdmin - Readme phpMyAdmin - Readme
=================== ===================
Version 3.4.11.1 Retro Edition 😎
A set of PHP-scripts to manage MySQL over the web. A set of PHP-scripts to manage MySQL over the web.

View File

@@ -1,37 +0,0 @@
phpMyAdmin - hints for distributing phpMyAdmin
==============================================
This document is intended to give advices to people who want to
redistribute phpMyAdmin inside other software package such as Linux
distribution or some all in one package including web server and MySQL
server.
Generally you can customize some basic aspects (paths to some files and
behavior) in libraries/vendor_config.php.
For example if you want setup script to generate config file in var,
change SETUP_CONFIG_FILE to /var/lib/phpmyadmin/config.inc.php and you
will also probably want to skip directory writable check, so set
SETUP_DIR_WRITABLE to false.
External libraries
------------------
phpMyAdmin includes several external libraries, you might want to
replace them with system ones if they are available, but please note
that you should test whether version you provide is compatible with the
one we ship.
Currently known list of external libraries:
js/jquery
jQuery js framework
js/colorpicker
jQuery based color picker
libraries/php-gettext
php-gettext library
libraries/tcpdf
tcpdf library, modified for our needs!
# vim: et ts=4 sw=4 sts=4 tw=72 spell spelllang=en_us

8
TODO
View File

@@ -1,8 +0,0 @@
phpMyAdmin - Todo
=================
We are currently using the Sourceforge Tracker as Todo list:
http://sourceforge.net/tracker/?atid=377411&group_id=23067&func=browse
-- swix/20010704

View File

@@ -1,20 +0,0 @@
phpMyAdmin Third Party Contributions
====================================
This directory contains various stuff contributed by users that might be
useful to other. There is no guarantee it will work for you.
Current content of this directory:
packaging
Contains files needed for creating packages for various
distributions. Please prefer official packages from your vendor if
possible.
swekey.sample.conf
SweKey authentication configuration example.
htaccess
Sample Apache configuration for limit access for bots.
# vim: expandtab ts=4 sw=4 sts=4 tw=78

View File

@@ -1,19 +0,0 @@
RewriteEngine on
# Allow only GET and POST verbs
RewriteCond %{REQUEST_METHOD} !^(GET|POST)$ [NC,OR]
# Ban Typical Vulnerability Scanners and others
# Kick out Script Kiddies
RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget).* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*(libwww-perl|curl|wget|python|nikto|wkito|pikto|scan|acunetix).* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*(winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner).* [NC,OR]
# Ban Search Engines, Crawlers to your administrative panel
# No reasons to access from bots
# Ultimately Better than the useless robots.txt
# Did google respect robots.txt?
# Try google: intitle:phpMyAdmin intext:"Welcome to phpMyAdmin *.*.*" intext:"Log in" -wiki -forum -forums -questions intext:"Cookies must be enabled"
RewriteCond %{HTTP_USER_AGENT} ^.*(AdsBot-Google|ia_archiver|Scooter|Ask.Jeeves|Baiduspider|Exabot|FAST.Enterprise.Crawler|FAST-WebCrawler|www\.neomo\.de|Gigabot|Mediapartners-Google|Google.Desktop|Feedfetcher-Google|Googlebot|heise-IT-Markt-Crawler|heritrix|ibm.com\cs/crawler|ICCrawler|ichiro|MJ12bot|MetagerBot|msnbot-NewsBlogs|msnbot|msnbot-media|NG-Search|lucene.apache.org|NutchCVS|OmniExplorer_Bot|online.link.validator|psbot0|Seekbot|Sensis.Web.Crawler|SEO.search.Crawler|Seoma.\[SEO.Crawler\]|SEOsearch|Snappy|www.urltrends.com|www.tkl.iis.u-tokyo.ac.jp/~crawler|SynooBot|crawleradmin.t-info@telekom.de|TurnitinBot|voyager|W3.SiteSearch.Crawler|W3C-checklink|W3C_Validator|www.WISEnutbot.com|yacybot|Yahoo-MMCrawler|Yahoo\!.DE.Slurp|Yahoo\!.Slurp|YahooSeeker).* [NC]
RewriteRule .* - [F]

View File

@@ -1,44 +0,0 @@
# This is a typical file used to enable Swekey hardware authentication.
#
# To activate the Swekey authentication add the following line to your config.inc.php file.
# $cfg['Servers'][$i]['auth_swekey_config'] = '/etc/swekey-pma.conf';
# Then rename this file "swekey-pma.conf" and copy it to the /etc directory.
# Add all the Swekey ids you want to grant access to in the file.
# After each Swekey id put the corresponding user name.
#
# If you don't know the id of a Swekey just visit http://www.swekey.com?sel=support
# while your Swekey is connected.
#
# If you need to purchase a Swekey please visit http://phpmyadmin.net/auth_key
# since this link provides funding to PhpMyAdmin.
#
0000000000000000000000000000763A:root
000000000000000000000000000089E4:steve
0000000000000000000000000000231E:scott
#
# It is recommended to include the following lines to contact the
# authentication servers in SSL mode.
#
SERVER_CHECK=https://auth-check-ssl.musbe.net
SERVER_RNDTOKEN=https://auth-rnd-gen-ssl.musbe.net
SERVER_STATUS=https://auth-status-ssl.musbe.net
#
# The path of the root certificate file used to ensure a secure
# communication with the authentication servers in SSL mode.
# If not specified, will use musbe-ca.crt found in your
# phpMyAdmin/libraries/auth/swekey.
#
#CA_FILE=/var/http-root/phpmyadmin/libraries/auth/swekey/musbe-ca.crt
#
# If your server receives many login requests, you can enable the random
# token caching to accelerate the authentication process.
# Token caching is enabled by default.
#
#ENABLE_TOKEN_CACHE=0

View File

@@ -1,9 +0,0 @@
#!/bin/sh
set -e
for file in `find js -name '*.js' -not -name '*min.js'` ; do
mkdir -p sources/`dirname $file`
mv $file sources/$file
java -jar ./scripts/google-javascript-compiler/compiler.jar --js sources/$file --js_output_file $file
done

View File

@@ -1,15 +0,0 @@
#!/usr/bin/perl
#
#
# Configuration converter
# Converts from old-style (Pre-2.3) configuration files to new format found in PMA-2.3
#
# Takes input from STDIN, sends output to STDOUT
#
while(<>)
{ s/\$cfg(\w+)/\$cfg\[\'$1\'\]/g;
print;
}

View File

@@ -1,308 +0,0 @@
#!/bin/sh
#
# vim: expandtab sw=4 ts=4 sts=4:
#
# More documentation about making a release is available at:
# http://wiki.phpmyadmin.net/pma/Releasing
# Fail on undefined variables
set -u
# Fail on failure
set -e
KITS="all-languages english"
COMPRESSIONS="zip-7z tbz txz tgz 7z"
if [ $# -lt 2 ]
then
echo "Usages:"
echo " create-release.sh <version> <from_branch> [--tag]"
echo ""
echo "If --tag is specified, relase tag is automatically created"
echo ""
echo "Examples:"
echo " create-release.sh 2.9.0-rc1 QA_2_9"
echo " create-release.sh 2.9.0 MAINT_2_9_0 --tag"
exit 65
fi
# Checks whether remote branch has local tracking branch
ensure_local_branch() {
if ! git branch | grep -q '^..'"$1"'$' ; then
git branch --track $1 origin/$1
fi
}
# Marks current head of given branch as head of other branch
# Used for STABLE/TESTING tracking
mark_as_release() {
branch=$1
rel_branch=$2
echo "* Marking release as $rel_branch"
ensure_local_branch $rel_branch
git checkout $rel_branch
git merge -s recursive -X theirs $branch
}
# Read required parameters
version=$1
shift
branch=$1
shift
cat <<END
Please ensure you have incremented rc count or version in the repository :
- in libraries/Config.class.php PMA_Config::__constructor() the line
" \$this->set( 'PMA_VERSION', '$version' ); "
- in Documentation.html the 2 lines
" <title>phpMyAdmin $version - Documentation</title> "
" <h1>phpMyAdmin $version Documentation</h1> "
- in README
Continue (y/n)?
END
read do_release
if [ "$do_release" != 'y' ]; then
exit 100
fi
# Ensure we have tracking branch
ensure_local_branch $branch
# Create working copy
mkdir -p release
workdir=release/phpMyAdmin-$version
if [ -d $workdir ] ; then
echo "Working directory '$workdir' already exists, please move it out of way"
exit 1
fi
git clone --local . $workdir
cd $workdir
# Checkout branch
ensure_local_branch $branch
git checkout $branch
# Check release version
if ! grep -q "'PMA_VERSION', '$version'" libraries/Config.class.php ; then
echo "There seems to be wrong version in libraries/Config.class.php!"
exit 2
fi
if ! grep -q "phpMyAdmin $version - Documentation" Documentation.html ; then
echo "There seems to be wrong version in Documentation.html"
exit 2
fi
if ! grep -q "Version $version\$" README ; then
echo "There seems to be wrong version in README"
exit 2
fi
# Cleanup release dir
LC_ALL=C date -u > RELEASE-DATE-${version}
# Building Documentation.txt
echo "* Generating Documentation.txt"
LC_ALL=C w3m -dump Documentation.html > Documentation.txt
# Check for gettext support
if [ -d po ] ; then
GETTEXT=1
else
GETTEXT=0
fi
# Generate mo files
if [ $GETTEXT -eq 1 ] ; then
echo "* Generating mo files"
./scripts/generate-mo
if [ -f ./scripts/remove-incomplete-mo ] ; then
echo "* Removing incomplete translations"
./scripts/remove-incomplete-mo
fi
echo "* Removing gettext source files"
rm -rf po
fi
if [ -f ./scripts/compress-js ] ; then
echo "* Compressing javascript files"
./scripts/compress-js
rm -rf sources
fi
echo "* Removing unneeded files"
# Remove test directory from package to avoid Path disclosure messages
# if someone runs /test/wui.php and there are test failures
rm -rf test
# Remove javascript compiler, no need to ship it
rm -rf scripts/google-javascript-compiler/
# Remove scripts which are not useful for user
for s in compress-js create-release.sh generate-mo mergepo.py php2gettext.sh remove_control_m.sh update-po upload-release pending-po pendingpo.py ; do
rm -f scripts/$s
done
# Remove git metadata
rm -rf .git
find . -name .gitignore -print0 | xargs -0 -r rm -f
cd ..
# Prepare all kits
for kit in $KITS ; do
# Copy all files
name=phpMyAdmin-$version-$kit
cp -r phpMyAdmin-$version $name
# Cleanup translations
cd phpMyAdmin-$version-$kit
scripts/lang-cleanup.sh $kit
rm -f scripts/lang-cleanup.sh
cd ..
# Remove tar file possibly left from previous run
rm -f $name.tar
# Prepare distributions
for comp in $COMPRESSIONS ; do
case $comp in
tbz|tgz|txz)
if [ ! -f $name.tar ] ; then
echo "* Creating $name.tar"
tar cf $name.tar $name
fi
if [ $comp = tbz ] ; then
echo "* Creating $name.tar.bz2"
bzip2 -9k $name.tar
fi
if [ $comp = txz ] ; then
echo "* Creating $name.tar.xz"
xz -9k $name.tar
fi
if [ $comp = tgz ] ; then
echo "* Creating $name.tar.gz"
gzip -9c $name.tar > $name.tar.gz
fi
;;
zip)
echo "* Creating $name.zip"
zip -q -9 -r $name.zip $name
;;
zip-7z)
echo "* Creating $name.zip"
7za a -bd -tzip $name.zip $name > /dev/null
;;
7z)
echo "* Creating $name.7z"
7za a -bd $name.7z $name > /dev/null
;;
*)
echo "WARNING: ignoring compression '$comp', not known!"
;;
esac
# Cleanup
rm -f $name.tar
done
# Remove directory with current dist set
rm -rf $name
done
# Cleanup
rm -rf phpMyAdmin-${version}
echo ""
echo ""
echo ""
echo "Files:"
echo "------"
ls -la *.gz *.zip *.bz2 *.7z
cd ..
if [ $# -gt 0 ] ; then
echo
echo "Additional tasks:"
while [ $# -gt 0 ] ; do
param=$1
case $1 in
--tag)
tagname=RELEASE_`echo $version | tr . _ | tr '[:lower:]' '[:upper:]' | tr -d -`
echo "* Tagging release as $tagname"
git tag -a -m "Released $version" $tagname $branch
if echo $version | grep -q '^2\.11\.' ; then
echo '* 2.11 branch, no STABLE/TESTING update'
else
if echo $version | grep '[a-z_-]' ; then
mark_as_release $branch TESTING
else
# We update both branches here
# As it does not make sense to have older testing than stable
if echo $version | grep -q '^3\.3\.' ; then
echo '* 3.3 branch, no TESTING update'
else
mark_as_release $branch TESTING
fi
mark_as_release $branch STABLE
fi
git checkout master
fi
echo " Dont forget to push tags using: git push --tags"
;;
*)
echo "Unknown parameter: $1!"
exit 1
esac
shift
done
echo
fi
cat <<END
Todo now:
---------
1. If not already done, tag the repository with the new revision number
for a plain release or a release candidate:
version 2.7.0 gets two tags: RELEASE_2_7_0 and STABLE
version 2.7.1-rc1 gets RELEASE_2_7_1RC1 and TESTING
2. prepare a release/phpMyAdmin-$version-notes.html explaining in short the goal of
this release and paste into it the ChangeLog for this release
3. upload the files to SF, you can use scripts/upload-release, eg.:
./scripts/upload-release \$USER $version release
4. add SF news item to phpMyAdmin project
5. announce release on freshmeat (http://freshmeat.net/projects/phpmyadmin/)
6. send a short mail (with list of major changes) to
phpmyadmin-devel@lists.sourceforge.net
phpmyadmin-news@lists.sourceforge.net
phpmyadmin-users@lists.sourceforge.net
Don't forget to update the Description section in the announcement,
based on Documentation.html.
7. increment rc count or version in the repository :
- in libraries/Config.class.php PMA_Config::__constructor() the line
" \$this->set( 'PMA_VERSION', '2.7.1-dev' ); "
- in Documentation.html the 2 lines
" <title>phpMyAdmin 2.2.2-rc1 - Documentation</title> "
" <h1>phpMyAdmin 2.2.2-rc1 Documentation</h1> "
8. add a group for bug tracking this new version, at
https://sourceforge.net/tracker/admin/index.php?group_id=23067&atid=377408&add_group=1
9. the end :-)
END

View File

@@ -1,208 +0,0 @@
-- --------------------------------------------------------
-- SQL Commands to set up the pmadb as described in Documentation.html.
--
-- This file is meant for use with MySQL 5 and above!
--
-- This script expects the user pma to already be existing. If we would put a
-- line here to create him too many users might just use this script and end
-- up with having the same password for the controluser.
--
-- This user "pma" must be defined in config.inc.php (controluser/controlpass)
--
-- Please don't forget to set up the tablenames in config.inc.php
--
-- --------------------------------------------------------
--
-- Database : `phpmyadmin`
--
CREATE DATABASE IF NOT EXISTS `phpmyadmin`
DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
USE phpmyadmin;
-- --------------------------------------------------------
--
-- Privileges
--
-- (activate this statement if necessary)
-- GRANT SELECT, INSERT, DELETE, UPDATE ON `phpmyadmin`.* TO
-- 'pma'@localhost;
-- --------------------------------------------------------
--
-- Table structure for table `pma_bookmark`
--
CREATE TABLE IF NOT EXISTS `pma_bookmark` (
`id` int(11) NOT NULL auto_increment,
`dbase` varchar(255) NOT NULL default '',
`user` varchar(255) NOT NULL default '',
`label` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL default '',
`query` text NOT NULL,
PRIMARY KEY (`id`)
)
ENGINE=MyISAM COMMENT='Bookmarks'
DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
-- --------------------------------------------------------
--
-- Table structure for table `pma_column_info`
--
CREATE TABLE IF NOT EXISTS `pma_column_info` (
`id` int(5) unsigned NOT NULL auto_increment,
`db_name` varchar(64) NOT NULL default '',
`table_name` varchar(64) NOT NULL default '',
`column_name` varchar(64) NOT NULL default '',
`comment` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL default '',
`mimetype` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL default '',
`transformation` varchar(255) NOT NULL default '',
`transformation_options` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`),
UNIQUE KEY `db_name` (`db_name`,`table_name`,`column_name`)
)
ENGINE=MyISAM COMMENT='Column information for phpMyAdmin'
DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
-- --------------------------------------------------------
--
-- Table structure for table `pma_history`
--
CREATE TABLE IF NOT EXISTS `pma_history` (
`id` bigint(20) unsigned NOT NULL auto_increment,
`username` varchar(64) NOT NULL default '',
`db` varchar(64) NOT NULL default '',
`table` varchar(64) NOT NULL default '',
`timevalue` timestamp NOT NULL,
`sqlquery` text NOT NULL,
PRIMARY KEY (`id`),
KEY `username` (`username`,`db`,`table`,`timevalue`)
)
ENGINE=MyISAM COMMENT='SQL history for phpMyAdmin'
DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
-- --------------------------------------------------------
--
-- Table structure for table `pma_pdf_pages`
--
CREATE TABLE IF NOT EXISTS `pma_pdf_pages` (
`db_name` varchar(64) NOT NULL default '',
`page_nr` int(10) unsigned NOT NULL auto_increment,
`page_descr` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL default '',
PRIMARY KEY (`page_nr`),
KEY `db_name` (`db_name`)
)
ENGINE=MyISAM COMMENT='PDF relation pages for phpMyAdmin'
DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
-- --------------------------------------------------------
--
-- Table structure for table `pma_relation`
--
CREATE TABLE IF NOT EXISTS `pma_relation` (
`master_db` varchar(64) NOT NULL default '',
`master_table` varchar(64) NOT NULL default '',
`master_field` varchar(64) NOT NULL default '',
`foreign_db` varchar(64) NOT NULL default '',
`foreign_table` varchar(64) NOT NULL default '',
`foreign_field` varchar(64) NOT NULL default '',
PRIMARY KEY (`master_db`,`master_table`,`master_field`),
KEY `foreign_field` (`foreign_db`,`foreign_table`)
)
ENGINE=MyISAM COMMENT='Relation table'
DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
-- --------------------------------------------------------
--
-- Table structure for table `pma_table_coords`
--
CREATE TABLE IF NOT EXISTS `pma_table_coords` (
`db_name` varchar(64) NOT NULL default '',
`table_name` varchar(64) NOT NULL default '',
`pdf_page_number` int(11) NOT NULL default '0',
`x` float unsigned NOT NULL default '0',
`y` float unsigned NOT NULL default '0',
PRIMARY KEY (`db_name`,`table_name`,`pdf_page_number`)
)
ENGINE=MyISAM COMMENT='Table coordinates for phpMyAdmin PDF output'
DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
-- --------------------------------------------------------
--
-- Table structure for table `pma_table_info`
--
CREATE TABLE IF NOT EXISTS `pma_table_info` (
`db_name` varchar(64) NOT NULL default '',
`table_name` varchar(64) NOT NULL default '',
`display_field` varchar(64) NOT NULL default '',
PRIMARY KEY (`db_name`,`table_name`)
)
ENGINE=MyISAM COMMENT='Table information for phpMyAdmin'
DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
-- --------------------------------------------------------
--
-- Table structure for table `pma_designer_coords`
--
CREATE TABLE IF NOT EXISTS `pma_designer_coords` (
`db_name` varchar(64) NOT NULL default '',
`table_name` varchar(64) NOT NULL default '',
`x` INT,
`y` INT,
`v` TINYINT,
`h` TINYINT,
PRIMARY KEY (`db_name`,`table_name`)
)
ENGINE=MyISAM COMMENT='Table coordinates for Designer'
DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
-- --------------------------------------------------------
--
-- Table structure for table `pma_tracking`
--
CREATE TABLE IF NOT EXISTS `pma_tracking` (
`db_name` varchar(64) collate utf8_bin NOT NULL,
`table_name` varchar(64) collate utf8_bin NOT NULL,
`version` int(10) unsigned NOT NULL,
`date_created` datetime NOT NULL,
`date_updated` datetime NOT NULL,
`schema_snapshot` text collate utf8_bin NOT NULL,
`schema_sql` text collate utf8_bin,
`data_sql` longtext collate utf8_bin,
`tracking` set('UPDATE','REPLACE','INSERT','DELETE','TRUNCATE','CREATE DATABASE','ALTER DATABASE','DROP DATABASE','CREATE TABLE','ALTER TABLE','RENAME TABLE','DROP TABLE','CREATE INDEX','DROP INDEX','CREATE VIEW','ALTER VIEW','DROP VIEW') collate utf8_bin default NULL,
`tracking_active` int(1) unsigned NOT NULL default '1',
PRIMARY KEY (`db_name`,`table_name`,`version`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin ROW_FORMAT=COMPACT;
-- --------------------------------------------------------
--
-- Table structure for table `pma_userconfig`
--
CREATE TABLE IF NOT EXISTS `pma_userconfig` (
`username` varchar(64) NOT NULL,
`timevalue` timestamp NOT NULL,
`config_data` text NOT NULL,
PRIMARY KEY (`username`)
)
ENGINE=MyISAM COMMENT='User preferences storage for phpMyAdmin'
DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;

View File

@@ -1,103 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Parser BUG decoder
*
* This is the parser bug decoder system
* Throw the bug data in teh query box, and hit submit for output.
*
* Copyright 2002 Robin Johnson <robbat2@users.sourceforge.net>
*
* @package phpMyAdmin-debug
*/
/**
* Displays the form
*/
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<link rel="icon" href="./favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>phpMyAdmin - Parser BUG decoder</title>
<style type="text/css">
<!--
body, p {
font-family: Arial, Helvetica, sans-serif;
font-size: medium;
}
h1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: large;
font-weight: bold;
color: #000066;
}
//-->
</style>
</head>
<body bgcolor="#FFFFFF">
<h1>Parser BUG decoder</h1>
<br />
<form method="post" action="./decode_bug.php">
<input type="hidden" name="bar" value="<?php echo rand(); ?>" />
Encoded bug report:<br />
<textarea name="bug_encoded" cols="72" rows="10"></textarea>
<br /><br />
<input type="submit" />
</form>
<hr />
<?php
/**
* If the form has been submitted -> decodes the bug report
*/
/**
* Display the decoded bug report in ASCII format
*
* @param string the text data
*
* @return string the text enclosed by "<pre>...</pre>" tags
*
* @access public
*/
function PMA_printDecodedBug($textdata)
{
return '<pre>' . htmlspecialchars($textdata) . '</pre><br />';
} // end of the "PMA_printDecodedBug()" function
if (!empty($_POST) && isset($_POST['bug_encoded'])) {
$bug_encoded = $_POST['bug_encoded'];
}
if (!empty($bug_encoded) && is_string($bug_encoded)) {
if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
$bug_encoded = stripslashes($bug_encoded);
}
$bug_encoded = preg_replace('/[[:space:]]/', '', $bug_encoded);
$bug_decoded = base64_decode($bug_encoded);
if (substr($bug_encoded, 0, 2) == 'eN') {
if (function_exists('gzuncompress')) {
$result = PMA_printDecodedBug(gzuncompress($bug_decoded));
} else {
$result = 'Error: &quot;gzuncompress()&quot; is unavailable!' . "\n";
}
} else {
$result = PMA_printDecodedBug($bug_decoded);
} // end if... else...
echo '<p>Decoded:</p>' . "\n"
. $result . "\n";
} // end if
?>
</body>
</html>

View File

@@ -1,25 +0,0 @@
#!/bin/sh
if [ x$1 = x--quiet ] ; then
stats=""
shift
else
stats="--statistics"
fi
compile() {
lang=`echo $1 | sed 's@po/\(.*\)\.po@\1@'`
if [ ! -z "$stats" ] ; then
echo -n "$lang: "
fi
mkdir -p locale/$lang/LC_MESSAGES
msgfmt $stats --check -o locale/$lang/LC_MESSAGES/phpmyadmin.mo $1
}
if [ ! -z "$1" ] ; then
compile po/$1.po
exit 0
fi
for x in po/*.po ; do
compile $x
done

View File

@@ -1,202 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -1,261 +0,0 @@
/*
* Copyright 2009 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//
// Contents
//
The Closure Compiler performs checking, instrumentation, and
optimizations on JavaScript code. The purpose of this README is to
explain how to build and run the Closure Compiler.
The Closure Compiler requires Java 6 or higher.
http://www.java.com/
//
// Building The Closure Compiler
//
There are three ways to get a Closure Compiler executable.
1) Use one we built for you.
Pre-built Closure binaries can be found at
http://code.google.com/p/closure-compiler/downloads/list
2) Check out the source and build it with Apache Ant.
First, check out the full source tree of the Closure Compiler. There
are instructions on how to do this at the project site.
http://code.google.com/p/closure-compiler/source/checkout
Apache Ant is a cross-platform build tool.
http://ant.apache.org/
At the root of the source tree, there is an Ant file named
build.xml. To use it, navigate to the same directory and type the
command
ant jar
This will produce a jar file called "build/compiler.jar".
3) Check out the source and build it with Eclipse.
Eclipse is a cross-platform IDE.
http://www.eclipse.org/
Under Eclipse's File menu, click "New > Project ..." and create a
"Java Project." You will see an options screen. Give the project a
name, select "Create project from existing source," and choose the
root of the checked-out source tree as the existing directory. Verify
that you are using JRE version 6 or higher.
Eclipse can use the build.xml file to discover rules. When you
navigate to the build.xml file, you will see all the build rules in
the "Outline" pane. Run the "jar" rule to build the compiler in
build/compiler.jar.
//
// Running The Closure Compiler
//
Once you have the jar binary, running the Closure Compiler is straightforward.
On the command line, type
java -jar compiler.jar
This starts the compiler in interactive mode. Type
var x = 17 + 25;
then hit "Enter", then hit "Ctrl-Z" (on Windows) or "Ctrl-D" (on Mac or Linux)
and "Enter" again. The Compiler will respond:
var x=42;
The Closure Compiler has many options for reading input from a file,
writing output to a file, checking your code, and running
optimizations. To learn more, type
java -jar compiler.jar --help
You can read more detailed documentation about the many flags at
http://code.google.com/closure/compiler/docs/gettingstarted_app.html
//
// Compiling Multiple Scripts
//
If you have multiple scripts, you should compile them all together with
one compile command.
java -jar compiler.jar --js=in1.js --js=in2.js ... --js_output_file=out.js
The Closure Compiler will concatenate the files in the order they're
passed at the command line.
If you need to compile many, many scripts together, you may start to
run into problems with managing dependencies between scripts. You
should check out the Closure Library. It contains functions for
enforcing dependencies between scripts, and a tool called calcdeps.py
that knows how to give scripts to the Closure Compiler in the right
order.
http://code.google.com/p/closure-library/
//
// Licensing
//
Unless otherwise stated, all source files are licensed under
the Apache License, Version 2.0.
-----
Code under:
src/com/google/javascript/rhino
test/com/google/javascript/rhino
URL: http://www.mozilla.org/rhino
Version: 1.5R3, with heavy modifications
License: Netscape Public License and MPL / GPL dual license
Description: A partial copy of Mozilla Rhino. Mozilla Rhino is an
implementation of JavaScript for the JVM. The JavaScript parser and
the parse tree data structures were extracted and modified
significantly for use by Google's JavaScript compiler.
Local Modifications: The packages have been renamespaced. All code not
relavant to parsing has been removed. A JSDoc parser and static typing
system have been added.
-----
Code in:
lib/libtrunk_rhino_parser_jarjared.jar
Rhino
URL: http://www.mozilla.org/rhino
Version: Trunk
License: Netscape Public License and MPL / GPL dual license
Description: Mozilla Rhino is an implementation of JavaScript for the JVM.
Local Modifications: None. We've used JarJar to renamespace the code
post-compilation. See:
http://code.google.com/p/jarjar/
-----
Code in:
lib/args4j_deploy.jar
Args4j
URL: https://args4j.dev.java.net/
Version: 2.0.9
License: MIT
Description:
args4j is a small Java class library that makes it easy to parse command line
options/arguments in your CUI application.
Local Modifications: None.
-----
Code in:
lib/google_common_deploy.jar
Guava Libraries
URL: http://code.google.com/p/guava-libraries/
Version: Trunk
License: Apache License 2.0
Description: Google's core Java libraries.
Local Modifications: None.
-----
Code in:
lib/hamcrest-core-1.1.jar
Hamcrest
URL: http://code.google.com/p/hamcrest
License: BSD
License File: LICENSE
Description:
Provides a library of matcher objects (also known as constraints or
predicates) allowing 'match' rules to be defined declaratively, to be used in
other frameworks. Typical scenarios include testing frameworks, mocking
libraries and UI validation rules.
Local modifications:
The original jars contained both source code and compiled classes.
hamcrest-core-1.1.jar just contains the compiled classes.
----
Code in:
lib/junit.jar
JUnit
URL: http://sourceforge.net/projects/junit/
Version: 4.5
License: Common Public License 1.0
Description: A framework for writing and running automated tests in Java.
Local Modifications: None.
---
Code in:
lib/protobuf_deploy.jar
Protocol Buffers
URL: http://code.google.com/p/protobuf/
Version: 2.2.0a
License: New BSD License
Description: Supporting libraries for protocol buffers,
an encoding of structured data.
Local Modifications: None
---
Code in:
lib/ant_deploy.jar
URL: http://ant.apache.org/bindownload.cgi
Version: 1.6.5
License: Apache License 2.0
Description:
Ant is a Java based build tool. In theory it is kind of like "make"
without make's wrinkles and with the full portability of pure java code.
Local Modifications:
Modified apache-ant-1.6.5/bin/ant to look in the ant.runfiles directory

View File

@@ -1,41 +0,0 @@
#!/bin/sh
#
# vim: expandtab sw=4 ts=4 sts=4:
#
# Script for removing language selection from phpMyAdmin
if [ $# -lt 1 ] ; then
echo "Usage: lang-cleanup.sh type"
echo "Type can be one of:"
echo " all-languages - nothing will be done"
echo " english - no translations will be kept"
echo " langcode - keeps language"
echo
echo "Languages can be scpecified multiple times"
exit 1
fi
# Expression for find
match=""
for type in "$@" ; do
case $type in
all-languages)
exit 0
;;
english)
rm -rf po
rm -rf locale
exit 0
;;
*)
match="$match -and -not -name $type.po -and -not -path locale/$type/LC_MESSAGES/phpmyadmin.mo"
;;
esac
done
# Delete unvanted languages
find po locale -type f $match -print0 | xargs -0r rm
# Delete empty directories
rmdir --ignore-fail-on-non-empty locale/*/*
rmdir --ignore-fail-on-non-empty locale/*

View File

@@ -1,29 +0,0 @@
#!/usr/bin/python
import polib
import sys
po = polib.pofile(sys.argv[1])
poupdate = polib.pofile(sys.argv[2])
for origentry in po.fuzzy_entries():
for updateentry in poupdate.translated_entries():
if origentry.msgctxt is None and origentry.msgid == updateentry.msgid:
origentry.msgstr = updateentry.msgstr
origentry.flags.remove('fuzzy')
break
if origentry.msgctxt == updateentry.msgctxt and origentry.msgid == updateentry.msgid:
origentry.msgstr = updateentry.msgstr
origentry.flags.remove('fuzzy')
break
for origentry in po.untranslated_entries():
for updateentry in poupdate.translated_entries():
if origentry.msgctxt is None and origentry.msgid == updateentry.msgid:
origentry.msgstr = updateentry.msgstr
break
if origentry.msgctxt == updateentry.msgctxt and origentry.msgid == updateentry.msgid:
origentry.msgstr = updateentry.msgstr
break
po.save()

View File

@@ -1,152 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Single signon for phpMyAdmin using OpenID
*
* This is just example how to use single signon with phpMyAdmin, it is
* not intended to be perfect code and look, only shows how you can
* integrate this functionality in your application.
*
* It uses OpenID pear package, see http://pear.php.net/package/OpenID
*
* User first authenticates using OpenID and based on content of $AUTH_MAP
* the login information is passed to phpMyAdmin in session data.
*
* @package phpMyAdmin
* @subpackage Example
*/
require_once 'OpenID/RelyingParty.php';
/**
* Map of authenticated users to MySQL user/password pairs.
*/
$AUTH_MAP = array(
'http://launchpad.net/~username' => array(
'user' => 'root',
'password' => '',
),
);
/**
* Simple function to show HTML page with given content.
*/
function show_page($contents) {
header('Content-Type: text/html; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<link rel="icon" href="../favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<title>phpMyAdmin OpenID signon example</title>
</head>
<body>
<?php
if (isset($_SESSION) && isset($_SESSION['PMA_single_signon_error_message'])) {
echo '<p class="error">' . $_SESSION['PMA_single_signon_message'] . '</p>';
unset($_SESSION['PMA_single_signon_message']);
}
echo $contents;
?>
</body>
</html>
<?php
}
/* Need to have cookie visible from parent directory */
session_set_cookie_params(0, '/', '', 0);
/* Create signon session */
$session_name = 'SignonSession';
session_name($session_name);
session_start();
// Determine realm and return_to
$base = 'http';
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
$base .= 's';
}
$base .= '://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'];
$realm = $base . '/';
$returnTo = $base . dirname($_SERVER['PHP_SELF']);
if ($returnTo[strlen($returnTo) - 1] != '/') {
$returnTo .= '/';
}
$returnTo .= 'openid.php';
/* Display form */
if (!count($_GET) && !count($_POST) || isset($_GET['phpMyAdmin'])) {
/* Show simple form */
$content = '<form action="openid.php" method="post">
OpenID: <input type="text" name="identifier" /><br />
<input type="submit" name="start" />
</form>
</body>
</html>';
show_page($content);
exit;
}
/* Grab identifier */
if (isset($_POST['identifier'])) {
$identifier = $_POST['identifier'];
} else if (isset($_SESSION['identifier'])) {
$identifier = $_SESSION['identifier'];
} else {
$identifier = null;
}
/* Create OpenID object */
try {
$o = new OpenID_RelyingParty($returnTo, $realm, $identifier);
} catch (OpenID_Exception $e) {
$contents = "<div class='relyingparty_results'>\n";
$contents .= "<pre>" . $e->getMessage() . "</pre>\n";
$contents .= "</div class='relyingparty_results'>";
show_page($contents);
exit;
}
/* Redirect to OpenID provider */
if (isset($_POST['start'])) {
try {
$authRequest = $o->prepare();
} catch (OpenID_Exception $e) {
$contents = "<div class='relyingparty_results'>\n";
$contents .= "<pre>" . $e->getMessage() . "</pre>\n";
$contents .= "</div class='relyingparty_results'>";
show_page($contents);
exit;
}
$url = $authRequest->getAuthorizeURL();
header("Location: $url");
exit;
} else {
/* Grab query string */
if (!count($_POST)) {
list(, $queryString) = explode('?', $_SERVER['REQUEST_URI']);
} else {
// I hate php sometimes
$queryString = file_get_contents('php://input');
}
/* Check reply */
$message = new OpenID_Message($queryString, OpenID_Message::FORMAT_HTTP);
$id = $message->get('openid.claimed_id');
if (!empty($id) && isset($AUTH_MAP[$id])) {
$_SESSION['PMA_single_signon_user'] = $AUTH_MAP[$id]['user'];
$_SESSION['PMA_single_signon_password'] = $AUTH_MAP[$id]['password'];
session_write_close();
/* Redirect to phpMyAdmin (should use absolute URL here!) */
header('Location: ../index.php');
} else {
show_page('<p>User not allowed!</p>');
exit;
}
}

View File

@@ -1,7 +0,0 @@
#!/bin/sh
# vim: expandtab sw=4 ts=4 sts=4:
LOCS=`ls po/*.po.pending | sed 's@.*/\(.*\)\.po\.pending@\1@'`
for loc in $LOCS ; do
./scripts/pendingpo.py po/$loc.po po/$loc.po.pending
done

View File

@@ -1,31 +0,0 @@
#!/usr/bin/python
'''
Script to automatically merge pending translations from Pootle into po files.
It only accepts those, which are not translated or fuzzy.
'''
import polib
import sys
po = polib.pofile(sys.argv[1])
poupdate = polib.pofile(sys.argv[2])
for updateentry in poupdate:
msgid = updateentry.msgid.split('\n', 1)[1]
if msgid == updateentry.msgstr:
continue
origentry = po.find(msgid)
if origentry is None:
continue
if origentry.msgstr == '' or 'fuzzy' in origentry.flags:
origentry.msgstr = updateentry.msgstr
try:
origentry.msgstr_plural = updateentry.msgstr_plural
except AttributeError:
pass
if 'fuzzy' in origentry.flags:
origentry.flags.remove('fuzzy')
po.save()

View File

@@ -1,116 +0,0 @@
#!/bin/sh
set -e
mkdir -p po
sed "
s/' ;/';/;
/to translate/D;
/\$allow_recoding/D;
s/\$byteUnits = array('\(.*\)', '\(.*\)', '\(.*\)', '\(.*\)', '\(.*\)', '\(.*\)', '\(.*\)');/\$str_B = '\1';\n\$str_KiB = '\2';\n\$str_MiB = '\3';\n\$str_GiB = '\4';\n\$str_TiB = '\5';\n\$str_PiB = '\6';\n\$str_EiB = '\7';/;
s/\$day_of_week = array('\(.*\)', '\(.*\)', '\(.*\)', '\(.*\)', '\(.*\)', '\(.*\)', '\(.*\)');/\$str_Sun = '\1';\n\$str_Mon = '\2';\n\$str_Tue = '\3';\n\$str_Wed = '\4';\n\$str_Thu = '\5';\n\$str_Fri = '\6';\n\$str_Sat = '\7';\n/;
s/\(\$month = array('.*', '.*', '.*', '.*', '.*', '.*',\) '\(.*\)', '\(.*\)', '\(.*\)', '\(.*\)', '\(.*\)', '\(.*\)');/\1\n\$str_Jul = '\2';\n\$str_Aug = '\3';\n\$str_Sep = '\4';\n\$str_Oct = '\5';\n\$str_Nov = '\6';\n\$str_Dec = '\7';\n/;
s/\$month = array('\(.*\)', '\(.*\)', '\(.*\)', '\(.*\)', '\(.*\)', '\(.*\)',/\$str_Jan = '\1';\n\$str_Feb = '\2';\n\$str_Mar = '\3';\n\$str_Apr = '\4';\n\$str_May = '\5';\n\$str_Jun = '\6';\n/;
" < lang/english-utf-8.inc.php > po/english.php
for lang in lang/*.inc.php ; do
loc=`basename $lang | sed 's/-utf-8.inc.php//'`
# Unfold arrays, delete not translated strings
sed "
s/' ;/';/;
/to translate/D;
/^\/\//D;
/\$allow_recoding/D;
s/\$byteUnits *= *array('\(.*\)', *'\(.*\)', *'\(.*\)', *'\(.*\)', *'\(.*\)', *'\(.*\)', *'\(.*\)');/\$str_B = '\1';\n\$str_KiB = '\2';\n\$str_MiB = '\3';\n\$str_GiB = '\4';\n\$str_TiB = '\5';\n\$str_PiB = '\6';\n\$str_EiB = '\7';/;
s/\$day_of_week *= *array('\(.*\)', *'\(.*\)', *'\(.*\)', *'\(.*\)', *'\(.*\)', *'\(.*\)', *'\(.*\)');/\$str_Sun = '\1';\n\$str_Mon = '\2';\n\$str_Tue = '\3';\n\$str_Wed = '\4';\n\$str_Thu = '\5';\n\$str_Fri = '\6';\n\$str_Sat = '\7';\n/;
s/\(\$month *= *array('.*', *'.*', *'.*', *'.*', *'.*', *'.*',\) '\(.*\)', *'\(.*\)', *'\(.*\)', *'\(.*\)', *'\(.*\)', *'\(.*\)');/\1\n\$str_Jul = '\2';\n\$str_Aug = '\3';\n\$str_Sep = '\4';\n\$str_Oct = '\5';\n\$str_Nov = '\6';\n\$str_Dec = '\7';\n/;
s/\$month *= *array('\(.*\)', *'\(.*\)', *'\(.*\)', *'\(.*\)', *'\(.*\)', *'\(.*\)',/\$str_Jan = '\1';\n\$str_Feb = '\2';\n\$str_Mar = '\3';\n\$str_Apr = '\4';\n\$str_May = '\5';\n\$str_Jun = '\6';\n/;
" < $lang > po/$loc.php
case $loc in
afrikaans) langcode='af';;
arabic) langcode='ar';;
azerbaijani) langcode='az';;
bangla) langcode='bn';;
belarusian_cyrillic) langcode='be';;
belarusian_latin) langcode='be@latin';;
bulgarian) langcode='bg';;
bosnian) langcode='bs';;
catalan) langcode='ca';;
czech) langcode='cs';;
danish) langcode='da';;
german) langcode='de';;
greek) langcode='el';;
english) langcode='en';;
english-gb) langcode='en_GB';;
spanish) langcode='es';;
estonian) langcode='et';;
basque) langcode='eu';;
persian) langcode='fa';;
finnish) langcode='fi';;
french) langcode='fr';;
galician) langcode='gl';;
hebrew) langcode='he';;
hindi) langcode='hi';;
croatian) langcode='hr';;
hungarian) langcode='hu';;
indonesian) langcode='id';;
italian) langcode='it';;
japanese) langcode='ja';;
korean) langcode='ko';;
georgian) langcode='ka';;
lithuanian) langcode='lt';;
latvian) langcode='lv';;
macedonian_cyrillic) langcode='mk';;
mongolian) langcode='mn';;
malay) langcode='ms';;
dutch) langcode='nl';;
norwegian) langcode='nb';;
polish) langcode='pl';;
brazilian_portuguese) langcode='pt_BR';;
portuguese) langcode='pt';;
romanian) langcode='ro';;
russian) langcode='ru';;
sinhala) langcode='si';;
slovak) langcode='sk';;
slovenian) langcode='sl';;
albanian) langcode='sq';;
serbian_latin) langcode='sr@latin';;
serbian_cyrillic) langcode='sr';;
swedish) langcode='sv';;
thai) langcode='th';;
turkish) langcode='tr';;
tatarish) langcode='tt';;
ukrainian) langcode='uk';;
chinese_traditional) langcode='zh_TW';;
chinese_simplified) langcode='zh_CN';;
uzbek_cyrillic) langcode='uz';;
uzbek_latin) langcode='uz@latin';;
*) echo "Wrong loc: $loc"; exit 1;;
esac
echo "$loc -> $langcode"
if [ $langcode = en ] ; then
php2po -i po/english.php -o po/phpmyadmin-update.pot -P
sed -i '
s/PACKAGE VERSION/phpMyAdmin 3.4/;
s/Report-Msgid-Bugs-To: .*\\n/Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\\n/;
' po/phpmyadmin-update.pot
else
php2po -t po/english.php -i po/$loc.php -o po/$langcode-update.po
sed -i "
s/PACKAGE VERSION/phpMyAdmin 3.4/;
/, fuzzy/D;
s/LANGUAGE <LL@li.org>/$loc <$langcode@li.org>/;
s/YEAR-MO-DA HO:MI+ZONE/`date +'%Y-%m-%d %H:%M%z'`/;
s/FULL NAME <EMAIL@ADDRESS>/Automatically generated/;
s/Report-Msgid-Bugs-To: .*\\\\n/Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\\\\n/;
" po/$langcode-update.po
./scripts/mergepo.py po/$langcode.po po/$langcode-update.po
msgmerge -U -C po/$langcode-update.po po/$langcode.po po/phpmyadmin.pot
rm po/$langcode-update.po po/$loc.php
fi
done
rm po/english.php po/phpmyadmin-update.pot

View File

@@ -1,66 +0,0 @@
#!/bin/sh
#
# Removes mo files for incomplete translations
#
set -e
#
# How many percent needs to be translated
#
THRESHOLD=40
#
# Generated output file
#
TMPOUTPUTFILE=libraries/language_stats.inc.php.tmp
OUTPUTFILE=libraries/language_stats.inc.php
if [ ! -z "$1" ] ; then
THRESHOLD=$1
fi
echo '<?php' > $TMPOUTPUTFILE
echo '/* Automatically generated file, do not edit! */' >> $TMPOUTPUTFILE
echo '/* Generated by scripts/remove-incomplete-mo */' >> $TMPOUTPUTFILE
echo '' >> $TMPOUTPUTFILE
echo '$GLOBALS["language_stats"] = array (' >> $TMPOUTPUTFILE
check() {
TMPOUTPUTFILE=$2
lang=`echo $1 | sed 's@po/\(.*\)\.po@\1@'`
STATS=`LC_ALL=C msgfmt --statistics -o /dev/null $1 2>&1`
if echo $STATS | grep -q ' translated ' ; then
TRANSLATED=`echo $STATS | sed 's/\(^\|.* \)\([0-9]*\) translated.*/\2/'`
else
TRANSLATED=0
fi
if echo $STATS | grep -q ' fuzzy ' ; then
FUZZY=`echo $STATS | sed 's/\(^\|.* \)\([0-9]*\) fuzzy.*/\2/'`
else
FUZZY=0
fi
if echo $STATS | grep -q ' untranslated ' ; then
UNTRANSLATED=`echo $STATS | sed 's/\(^\|.* \)\([0-9]*\) untranslated.*/\2/'`
else
UNTRANSLATED=0
fi
PERCENT=`expr 100 \* $TRANSLATED / \( $TRANSLATED + $FUZZY + $UNTRANSLATED \) || true`
echo " '$lang' => $PERCENT," >> $TMPOUTPUTFILE
if [ $PERCENT -lt $THRESHOLD ] ; then
echo "Removing $lang, only $PERCENT%"
rm -f locale/$lang/LC_MESSAGES/phpmyadmin.mo
rmdir locale/$lang/LC_MESSAGES
rmdir locale/$lang
fi
}
for x in po/*.po ; do
check $x $TMPOUTPUTFILE
done
echo ');' >> $TMPOUTPUTFILE
echo '?>' >> $TMPOUTPUTFILE
mv $TMPOUTPUTFILE $OUTPUTFILE

View File

@@ -1,22 +0,0 @@
#!/bin/sh
#
#
# Script to remove ^M from files for DOS <-> UNIX conversions
#
if [ $# != 1 ]
then
echo "Usage: remove_control_m.sh <extension of files>"
echo ""
echo "Example: remove_control_m.sh php3"
exit
fi
for i in `find . -name "*.$1"`
do
echo $i
tr -d '\015' < $i > ${i}.new
rm $i
mv ${i}.new $i
done;

View File

@@ -1,64 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Single signon for phpMyAdmin
*
* This is just example how to use single signon with phpMyAdmin, it is
* not intended to be perfect code and look, only shows how you can
* integrate this functionality in your application.
*
* @package phpMyAdmin
* @subpackage Example
*/
/* Need to have cookie visible from parent directory */
session_set_cookie_params(0, '/', '', 0);
/* Create signon session */
$session_name = 'SignonSession';
session_name($session_name);
session_start();
/* Was data posted? */
if (isset($_POST['user'])) {
/* Store there credentials */
$_SESSION['PMA_single_signon_user'] = $_POST['user'];
$_SESSION['PMA_single_signon_password'] = $_POST['password'];
$_SESSION['PMA_single_signon_host'] = $_POST['host'];
$_SESSION['PMA_single_signon_port'] = $_POST['port'];
/* Update another field of server configuration */
$_SESSION['PMA_single_signon_cfgupdate'] = array('verbose' => 'Signon test');
$id = session_id();
/* Close that session */
session_write_close();
/* Redirect to phpMyAdmin (should use absolute URL here!) */
header('Location: ../index.php');
} else {
/* Show simple form */
header('Content-Type: text/html; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<link rel="icon" href="../favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<title>phpMyAdmin single signon example</title>
</head>
<body>
<?php
if (isset($_SESSION['PMA_single_signon_error_message'])) {
echo '<p class="error">' . $_SESSION['PMA_single_signon_error_message'] . '</p>';
}
?>
<form action="signon.php" method="post">
Username: <input type="text" name="user" /><br />
Password: <input type="password" name="password" /><br />
Host: (will use the one from config.inc.php by default) <input type="text" name="host" /><br />
Port: (will use the one from config.inc.php by default) <input type="text" name="port" /><br />
<input type="submit" />
</form>
</body>
</html>
<?php
}
?>

View File

@@ -1,39 +0,0 @@
#!/bin/sh
# vim: expandtab sw=4 ts=4 sts=4:
export LC_COLLATE=C
LOCS=`ls po/*.po | sed 's@.*/\(.*\)\.po@\1@'`
xgettext \
-d phpmyadmin \
--msgid-bugs-address=phpmyadmin-devel@lists.sourceforge.net \
-o po/phpmyadmin.pot \
--language=PHP \
--add-comments=l10n \
--add-location \
--debug \
--keyword=__ --keyword=_pgettext:1c,2 --keyword=_ngettext:1,2 \
--copyright-holder="phpMyAdmin devel team" \
`find . -name '*.php' | sort`
ver=`sed -n "/PMA_VERSION', '/ s/.*PMA_VERSION', '\(.*\)'.*/\1/p" libraries/Config.class.php`
sed -i '
s/SOME DESCRIPTIVE TITLE/phpMyAdmin translation/;
s/PACKAGE/phpMyAdmin/;
s/(C) YEAR/(C) 2003 - '`date +%Y`'/;
s/VERSION/'$ver'/;
' po/phpmyadmin.pot
for loc in $LOCS ; do
sed -i '
s/SOME DESCRIPTIVE TITLE/phpMyAdmin translation/;
s/PACKAGE/phpMyAdmin/;
s/(C) YEAR/(C) 2003 - '`date +%Y`'/;
s/VERSION/'$ver'/;
s/Project-Id-Version: phpMyAdmin .*/Project-Id-Version: phpMyAdmin '$ver'\\n"/;
' po/$loc.po
if [ -f ../localized_docs/po/$loc.po ] ; then
msgmerge --previous -C ../localized_docs/po/$loc.po -U po/$loc.po po/phpmyadmin.pot
else
msgmerge --previous -U po/$loc.po po/phpmyadmin.pot
fi
done

View File

@@ -1,27 +0,0 @@
#!/bin/sh
# vim: expandtab sw=4 ts=4 sts=4:
if [ ! -d "$1" ] ; then
echo 'Usage: update-po-foreign DIR'
echo 'Updates po files based on po files in DIR'
exit 1
fi
export LC_COLLATE=C
LOCS=`ls po/*.po | sed 's@.*/\(.*\)\.po@\1@'`
ver=`sed -n "/PMA_VERSION', '/ s/.*PMA_VERSION', '\(.*\)'.*/\1/p" libraries/Config.class.php`
for loc in $LOCS ; do
if [ ! -f "$1/$loc.po" ] ; then
continue
fi
sed -i '
s/SOME DESCRIPTIVE TITLE/phpMyAdmin translation/;
s/PACKAGE/phpMyAdmin/;
s/(C) YEAR/(C) 2003 - '`date +%Y`'/;
s/VERSION/'$ver'/;
s/Project-Id-Version: phpMyAdmin .*/Project-Id-Version: phpMyAdmin '$ver'\\n"/;
' po/$loc.po
msgmerge --previous -C "$1/$loc.po" -U po/$loc.po po/phpmyadmin.pot
done

View File

@@ -1,222 +0,0 @@
#!/usr/bin/perl
#
#
# upgrade.pl - automatic phpmyadmin upgrader
#
#
# 2005-05-08, swix@users.sourceforge.net:
# - created script
#
# 2005-10-29 swix@users.sourceforge.net:
# - some fixes & improvements
#
use strict;
my $source_url = "http://phpmyadmin.net/home_page/version.php";
#
# usage
#
if (!$ARGV[0] || (($ARGV[0] eq "--force") && !$ARGV[1])) {
print "\n";
print "usage: $0 [--force] <target_directory>\n\n";
print " The location specified by <target_directory> will be backed up and replaced\n";
print " by the latest stable version of phpMyAdmin.\n";
print " Your config.inc.php file will be preserved.\n\n";
exit(0);
}
my $forced;
my $targetdirectory;
if ($ARGV[0] eq "--force") {
$forced = 1;
$targetdirectory = $ARGV[1];
} else {
$forced = 0;
$targetdirectory = $ARGV[0];
}
if ($targetdirectory =~ /^(.*)\/$/) {
# remove trailing slash, if any
$targetdirectory = $1;
}
if (!-d $targetdirectory) {
print "error: target directory ($targetdirectory) does not exists\n";
exit(0);
}
if (!-f "$targetdirectory/config.inc.php") {
print "error: target directory doesn't seem to contain phpMyAdmin\n";
exit(0);
}
#
# get current release information
#
my $version;
my $filename;
my $directory;
my $releasedate;
my @urls;
my @today;
my $installedversion;
if (open(LATEST, "wget -o /dev/null -O - $source_url|")) {
$version = <LATEST>; chomp($version);
$releasedate = <LATEST>; chomp($releasedate);
$filename = "phpMyAdmin-" . $version . "-all-languages.tar.gz";
$directory = "phpMyAdmin-" . $version . "-all-languages";
my $i = 0;
while (my $line = <LATEST>) {
chomp($line);
if ($line =~ /http/) {
$urls[$i++] = $line;
}
}
close(LATEST);
} else {
print "error: open of $source_url failed.\n";
exit(0);
}
if (-d $directory) {
print "error: target directory ($directory) already exists, exiting\n";
exit(0);
}
#
# check the installed version
#
if (open(DEFINES, $targetdirectory .'/libraries/Config.class.php')) {
my $versionStatus = 0;
$installedversion = "unknownversion";
while (my $line = <DEFINES>) {
next unless $line =~ /'PMA_VERSION',\ '(.*)?'\);$/;
$installedversion = $1;
# take care of "pl", "rc" and "dev": dev < rc < pl
my $converted_installedversion = $installedversion;
$converted_installedversion =~ s/dev/aaa/g;
$converted_installedversion =~ s/rc/bbb/g;
$converted_installedversion =~ s/pl/ccc/g;
my $converted_version = $version;
$converted_version =~ s/dev/aaa/g;
$converted_version =~ s/rc/bbb/g;
$converted_version =~ s/pl/ccc/g;
if ($converted_installedversion gt $converted_version && !$forced) {
print "Local version ($installedversion) newer than latest stable release ($version), not updating. (use \"--force\")\n";
exit(0);
} elsif ($installedversion eq $version && !$forced) {
print "Local version ($version) already up to date, not updating (you can use \"--force\")\n";
exit(0);
} else {
$versionStatus = 1;
}
}
if (!$versionStatus && !$forced) {
print "Old version could not be identified, not updating (use \"--force\" if you are sure) \n";
exit(0);
}
}
#
# ask for confirmation
#
print "\n";
print "phpMyAdmin upgrade summary:\n";
print "---------------------------\n";
print " phpMyAdmin Path: $targetdirectory\n";
print " Installed version: $installedversion\n";
print " Upgraded version: $version\n\n";
print "Proceed with upgrade? [Y/n] ";
my $kbdinput = <STDIN>; chomp($kbdinput);
if (lc(substr($kbdinput,0,1)) ne "y" && length($kbdinput) >= 1) {
print "Aborting.\n";
exit(0);
} else {
print "Proceeding...\n\n";
}
#
# get file
#
if (!-f $filename) {
print "getting phpMyAdmin $version\n";
foreach my $url (@urls) {
print "trying $url...\n";
system("wget -o /dev/null $url");
if (-f $filename) {
print "-> ok\n";
last;
}
}
} else {
print "already got $filename, not downloading\n";
}
if (!-f $filename) {
print "error: $filename download failed\n";
exit(0);
}
#
# setup
#
print "installing...\n";
system("tar xzf $filename");
if (!$directory) {
print "error: $directory still not exists after untar...\n";
exit(0);
}
@today = localtime(time); $today[4]++; $today[5]+=1900;
my $timestamp = sprintf("%04d%02d%02d%02d%02d", $today[5], $today[4], $today[3], $today[2], $today[1]);
my $backupdir = $targetdirectory . "-" . $timestamp . "-" . $installedversion;
print "- backup directory: $backupdir\n";
system("cp $directory/config.inc.php $directory/config.inc-dist.php");
print "- original distribution config.inc.php renamed to config.inc-dist.php\n";
system("cp $targetdirectory/config.inc.php $directory/config.inc.php");
print "- previous config.inc.php copied to the new setup\n";
system("mv $targetdirectory $backupdir");
system("mv $directory $targetdirectory");
system("rm $filename");
print "\ndone! phpMyAdmin $version installed in $targetdirectory\n";
print "backup of your old installation in $backupdir\n";
print "Enjoy! :-)\n\n";

View File

@@ -1,144 +0,0 @@
-- -------------------------------------------------------------
-- SQL Commands to upgrade pmadb for normal phpMyAdmin operation
-- with MySQL 4.1.2 and above.
--
-- This file is meant for use with MySQL 4.1.2 and above!
-- For older MySQL releases, please use create_tables.sql
--
-- If you are running one MySQL 4.1.0 or 4.1.1, please create the tables using
-- create_tables.sql, then use this script.
--
-- Please don't forget to set up the tablenames in config.inc.php
--
-- --------------------------------------------------------
--
-- Database : `phpmyadmin`
--
ALTER DATABASE `phpmyadmin`
DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
USE phpmyadmin;
-- --------------------------------------------------------
--
-- Table structure for table `pma_bookmark`
--
ALTER TABLE `pma_bookmark`
DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
ALTER TABLE `pma_bookmark`
CHANGE `dbase` `dbase` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
ALTER TABLE `pma_bookmark`
CHANGE `user` `user` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
ALTER TABLE `pma_bookmark`
CHANGE `label` `label` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';
ALTER TABLE `pma_bookmark`
CHANGE `query` `query` TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL;
-- --------------------------------------------------------
--
-- Table structure for table `pma_column_info`
--
ALTER TABLE `pma_column_info`
DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
ALTER TABLE `pma_column_info`
CHANGE `db_name` `db_name` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
ALTER TABLE `pma_column_info`
CHANGE `table_name` `table_name` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
ALTER TABLE `pma_column_info`
CHANGE `column_name` `column_name` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
ALTER TABLE `pma_column_info`
CHANGE `comment` `comment` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';
ALTER TABLE `pma_column_info`
CHANGE `mimetype` `mimetype` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';
ALTER TABLE `pma_column_info`
CHANGE `transformation` `transformation` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
ALTER TABLE `pma_column_info`
CHANGE `transformation_options` `transformation_options` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
-- --------------------------------------------------------
--
-- Table structure for table `pma_history`
--
ALTER TABLE `pma_history`
DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
ALTER TABLE `pma_history`
CHANGE `username` `username` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
ALTER TABLE `pma_history`
CHANGE `db` `db` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
ALTER TABLE `pma_history`
CHANGE `table` `table` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
ALTER TABLE `pma_history`
CHANGE `sqlquery` `sqlquery` TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL;
-- --------------------------------------------------------
--
-- Table structure for table `pma_pdf_pages`
--
ALTER TABLE `pma_pdf_pages`
DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
ALTER TABLE `pma_pdf_pages`
CHANGE `db_name` `db_name` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
ALTER TABLE `pma_pdf_pages`
CHANGE `page_descr` `page_descr` VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL default '';
-- --------------------------------------------------------
--
-- Table structure for table `pma_relation`
--
ALTER TABLE `pma_relation`
DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
ALTER TABLE `pma_relation`
CHANGE `master_db` `master_db` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
ALTER TABLE `pma_relation`
CHANGE `master_table` `master_table` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
ALTER TABLE `pma_relation`
CHANGE `master_field` `master_field` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
ALTER TABLE `pma_relation`
CHANGE `foreign_db` `foreign_db` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
ALTER TABLE `pma_relation`
CHANGE `foreign_table` `foreign_table` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
ALTER TABLE `pma_relation`
CHANGE `foreign_field` `foreign_field` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
-- --------------------------------------------------------
--
-- Table structure for table `pma_table_coords`
--
ALTER TABLE `pma_table_coords`
DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
ALTER TABLE `pma_table_coords`
CHANGE `db_name` `db_name` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
ALTER TABLE `pma_table_coords`
CHANGE `table_name` `table_name` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
-- --------------------------------------------------------
--
-- Table structure for table `pma_table_info`
--
ALTER TABLE `pma_table_info`
DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
ALTER TABLE `pma_table_info`
CHANGE `db_name` `db_name` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
ALTER TABLE `pma_table_info`
CHANGE `table_name` `table_name` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
ALTER TABLE `pma_table_info`
CHANGE `display_field` `display_field` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';

View File

@@ -1,34 +0,0 @@
#!/bin/sh
set -e
set -u
if [ $# -lt 2 ] ; then
echo 'Usage: upload-release USERNAME VERSION [DIR]'
echo 'Must be called in directory with binaries or with path'
exit 1
fi
USER=$1
REL=$2
if [ $# -gt 2 ] ; then
cd "$3"
fi
sftp $USER,phpmyadmin@frs.sourceforge.net <<EOT
cd /home/frs/project/p/ph/phpmyadmin/phpMyAdmin
mkdir $REL
cd $REL
put phpMyAdmin-$REL-all-languages.tar.bz2
put phpMyAdmin-$REL-english.tar.bz2
put phpMyAdmin-$REL-all-languages.tar.xz
put phpMyAdmin-$REL-english.tar.xz
put phpMyAdmin-$REL-all-languages.tar.gz
put phpMyAdmin-$REL-english.tar.gz
put phpMyAdmin-$REL-all-languages.zip
put phpMyAdmin-$REL-english.zip
put phpMyAdmin-$REL-all-languages.7z
put phpMyAdmin-$REL-english.7z
put phpMyAdmin-$REL-notes.html
EOT

View File

@@ -1,38 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* runs all defined Selenium tests
*
* @package phpMyAdmin-test
*/
/**
*
*/
require_once 'PHPUnit/Framework.php';
require_once 'PHPUnit/TextUI/TestRunner.php';
require_once './PmaSeleniumTestCase.php';
require_once './PmaSeleniumLoginTest.php';
require_once './PmaSeleniumXssTest.php';
require_once './PmaSeleniumPrivilegesTest.php';
class AllSeleniumTests
{
public static function main()
{
$parameters = array();
PHPUnit_TextUI_TestRunner::run(self::suite(), $parameters);
}
public static function suite()
{
$suite = new PHPUnit_Framework_TestSuite('phpMyAdmin');
$suite->addTestSuite('PmaSeleniumLoginTest');
$suite->addTestSuite('PmaSeleniumXssTest');
$suite->addTestSuite('PmaSeleniumPrivilegesTest');
return $suite;
}
}
?>

View File

@@ -1,97 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* runs all defined tests
*
* @package phpMyAdmin-test
*/
/**
*
*/
if (! defined('PMA_MAIN_METHOD')) {
define('PMA_MAIN_METHOD', 'AllTests::main');
chdir('..');
}
// required to not die() in some libraries
define('PHPMYADMIN', true);
// just add $_SESSION array once, so no need to test for existance evrywhere to get rid of NOtices about this
if (empty($_SESSION)) {
$_SESSION = array();
}
/**
*
*/
require_once 'PHPUnit/Framework.php';
require_once 'PHPUnit/TextUI/TestRunner.php';
//require_once 'PHPUnit/Util/TestDox/ResultPrinter.php.';
require_once './test/FailTest.php';
require_once './test/PMA_get_real_size_test.php';
require_once './test/PMA_sanitize_test.php';
require_once './test/PMA_pow_test.php';
require_once './test/Environment_test.php';
require_once './test/PMA_escapeJsString_test.php';
require_once './test/PMA_isValid_test.php';
require_once './test/PMA_transformation_getOptions_test.php';
require_once './test/PMA_STR_sub_test.php';
require_once './test/PMA_generateCommonUrl_test.php';
require_once './test/PMA_blowfish_test.php';
require_once './test/PMA_escapeMySqlWildcards_test.php';
require_once './test/PMA_showHint_test.php';
require_once './test/PMA_formatNumberByteDown_test.php';
require_once './test/PMA_localisedDateTimespan_test.php';
require_once './test/PMA_cache_test.php';
require_once './test/PMA_quoting_slashing_test.php';
require_once './test/PMA_stringOperations_test.php';
require_once './test/PMA_printableBitValue_test.php';
require_once './test/PMA_foreignKeySupported_test.php';
require_once './test/PMA_headerLocation_test.php';
require_once './test/PMA_Message_test.php';
require_once './test/PMA_whichCrlf_test.php';
require_once './test/PMA_SQL_parser_data_test.php';
class AllTests
{
public static function main()
{
$parameters = array();
//$parameters['testdoxHTMLFile'] = true;
//$parameters['printer'] = PHPUnit_Util_TestDox_ResultPrinter::factory('HTML');
//$parameters['printer'] = PHPUnit_Util_TestDox_ResultPrinter::factory('Text');
PHPUnit_TextUI_TestRunner::run(self::suite(), $parameters);
}
public static function suite()
{
$suite = new PHPUnit_Framework_TestSuite('phpMyAdmin');
//$suite->addTestSuite('FailTest');
$suite->addTestSuite('Environment_test');
$suite->addTestSuite('PMA_get_real_size_test');
$suite->addTestSuite('PMA_sanitize_test');
$suite->addTestSuite('PMA_pow_test');
$suite->addTestSuite('PMA_escapeJsString_test');
$suite->addTestSuite('PMA_isValid_test');
$suite->addTestSuite('PMA_transformation_getOptions_test');
$suite->addTestSuite('PMA_STR_sub_test');
$suite->addTestSuite('PMA_generate_common_url_test');
$suite->addTestSuite('PMA_blowfish_test');
$suite->addTestSuite('PMA_escapeMySqlWildcards_test');
$suite->addTestSuite('PMA_showHint_test');
$suite->addTestSuite('PMA_formatNumberByteDown_test');
$suite->addTestSuite('PMA_localisedDateTimespan_test');
$suite->addTestSuite('PMA_cache_test');
$suite->addTestSuite('PMA_quoting_slashing_test');
$suite->addTestSuite('PMA_stringOperations_test');
$suite->addTestSuite('PMA_printableBitValue_test');
$suite->addTestSuite('PMA_foreignKeySupported_test');
$suite->addTestSuite('PMA_headerLocation_test');
$suite->addTestSuite('PMA_Message_test');
$suite->addTestSuite('PMA_whichCrlf_test');
return $suite;
}
}
?>

View File

@@ -1,35 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for environment like OS, PHP, modules, ...
*
* @package phpMyAdmin-test
*/
/**
*
*/
require_once 'PHPUnit/Framework.php';
/**
* @package phpMyAdmin-test
*/
class Environment_test extends PHPUnit_Framework_TestCase
{
public function testPhpVersion()
{
$this->assertTrue(version_compare('5.2', phpversion(), '<='),
'phpMyAdmin requires PHP 5.2 or above');
}
public function testMySQL()
{
$this->markTestIncomplete();
}
public function testSession()
{
$this->markTestIncomplete();
}
}
?>

View File

@@ -1,24 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for PMA_get_real_size()
*
* @package phpMyAdmin-test
*/
/**
*
*/
require_once 'PHPUnit/Framework.php';
/**
* @package phpMyAdmin-test
*/
class FailTest extends PHPUnit_Framework_TestCase
{
public function testFail()
{
$this->assertEquals(0, 1);
}
}
?>

View File

@@ -1,388 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Test for PMA_Message class
*
*/
/**
* Tests core.
*/
require_once 'PHPUnit/Framework.php';
require_once 'PHPUnit/Extensions/OutputTestCase.php';
/**
* Include to test.
*/
require_once './libraries/Message.class.php';
/**
* Test class PMA_Message.
*
* @package phpMyAdmin-test
*/
class PMA_Message_test extends PHPUnit_Extensions_OutputTestCase
{
/**
* @var PMA_Message
* @access protected
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
$this->object = new PMA_Message;
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*
* @access protected
*/
protected function tearDown()
{
}
/**
* to String casting test
*/
public function test__toString()
{
$this->object->setMessage('test<&>', true);
$this->assertEquals('test&lt;&amp;&gt;', (string)$this->object);
}
/**
* test success method
*/
public function testSuccess()
{
$this->object = new PMA_Message('test<&>', PMA_Message::SUCCESS);
$this->assertEquals($this->object, PMA_Message::success('test<&>'));
$this->assertEquals('Your SQL query has been executed successfully', PMA_Message::success()->getString());
}
/**
* test error method
*/
public function testError()
{
$this->object = new PMA_Message('test<&>', PMA_Message::ERROR);
$this->assertEquals($this->object, PMA_Message::error('test<&>'));
$this->assertEquals('Error', PMA_Message::error()->getString());
}
/**
* test notice method
*/
public function testNotice()
{
$this->object = new PMA_Message('test<&>', PMA_Message::NOTICE);
$this->assertEquals($this->object, PMA_Message::notice('test<&>'));
}
/**
* test rawError method
*/
public function testRawError()
{
$this->object = new PMA_Message('', PMA_Message::ERROR);
$this->object->setMessage('test<&>');
$this->assertEquals($this->object, PMA_Message::rawError('test<&>'));
}
/**
* test rawWarning method
*/
public function testRawWarning()
{
$this->object = new PMA_Message('', PMA_Message::WARNING);
$this->object->setMessage('test<&>');
$this->assertEquals($this->object, PMA_Message::rawWarning('test<&>'));
}
/**
* test rawNotice method
*/
public function testRawNotice()
{
$this->object = new PMA_Message('', PMA_Message::NOTICE);
$this->object->setMessage('test<&>');
$this->assertEquals($this->object, PMA_Message::rawNotice('test<&>'));
}
/**
* test rawSuccess method
*/
public function testRawSuccess()
{
$this->object = new PMA_Message('', PMA_Message::SUCCESS);
$this->object->setMessage('test<&>');
$this->assertEquals($this->object, PMA_Message::rawSuccess('test<&>'));
}
/**
* testing isSuccess method
*/
public function testIsSuccess()
{
$this->assertFalse($this->object->isSuccess());
$this->assertTrue($this->object->isSuccess(true));
}
/**
* testing isNotice method
*/
public function testIsNotice()
{
$this->assertTrue($this->object->isNotice());
$this->object->isError(true);
$this->assertFalse($this->object->isNotice());
$this->assertTrue($this->object->isNotice(true));
}
/**
* testing isError method
*/
public function testIsError()
{
$this->assertFalse($this->object->isError());
$this->assertTrue($this->object->isError(true));
}
/**
* testign setter of message
*/
public function testSetMessage()
{
$this->object->setMessage('test&<>', false);
$this->assertEquals('test&<>', $this->object->getMessage());
$this->object->setMessage('test&<>', true);
$this->assertEquals('test&amp;&lt;&gt;', $this->object->getMessage());
}
/**
* testing setter of string
*/
public function testSetString()
{
$this->object->setString('test&<>', false);
$this->assertEquals('test&<>', $this->object->getString());
$this->object->setString('test&<>', true);
$this->assertEquals('test&amp;&lt;&gt;', $this->object->getString());
}
/**
* testing add param method
*/
public function testAddParam()
{
$this->object->addParam(PMA_Message::notice('test'));
$this->assertEquals(array(PMA_Message::notice('test')), $this->object->getParams());
$this->object->addParam('test', true);
$this->assertEquals(array(PMA_Message::notice('test'), 'test'), $this->object->getParams());
$this->object->addParam('test', false);
$this->assertEquals(array(PMA_Message::notice('test'), 'test', PMA_Message::notice('test')), $this->object->getParams());
}
/**
* testing add string method
*/
public function testAddString()
{
$this->object->addString('test', '*');
$this->assertEquals(array('*', PMA_Message::notice('test')), $this->object->getAddedMessages());
$this->object->addString('test', '');
$this->assertEquals(array('*', PMA_Message::notice('test'), '', PMA_Message::notice('test')), $this->object->getAddedMessages());
}
/**
* testing add messages method
*/
public function testAddMessages()
{
$this->object->addMessages(array('test', PMA_Message::rawWarning('test')), '&');
$this->assertEquals(array('&', PMA_Message::rawNotice('test'), '&', PMA_Message::rawWarning('test')), $this->object->getAddedMessages());
}
/**
* testing add message method
*/
public function testAddMessage()
{
$this->object->addMessage('test', '');
$this->assertEquals(array(PMA_Message::rawNotice('test')), $this->object->getAddedMessages());
$this->object->addMessage('test');
$this->assertEquals(array(PMA_Message::rawNotice('test'), ' ', PMA_Message::rawNotice('test')), $this->object->getAddedMessages());
$this->object->addMessage(PMA_Message::rawWarning('test'), '&');
$this->assertEquals(array(PMA_Message::rawNotice('test'), ' ', PMA_Message::rawNotice('test'), '&', PMA_Message::rawWarning('test')), $this->object->getAddedMessages());
}
/**
* testing setter of params
*/
public function testSetParams()
{
$this->object->setParams('test&<>');
$this->assertEquals('test&<>', $this->object->getParams());
$this->object->setParams('test&<>', true);
$this->assertEquals('test&amp;&lt;&gt;', $this->object->getParams());
}
/**
* testing sanitize method
*/
public function testSanitize()
{
$this->object->setString('test&string<>', false);
$this->assertEquals('test&amp;string&lt;&gt;', PMA_Message::sanitize($this->object));
$this->assertEquals(array('test&amp;string&lt;&gt;', 'test&amp;string&lt;&gt;'), PMA_Message::sanitize(array($this->object, $this->object)));
}
public function decodeBBDataProvider()
{
return array(
array('[i]test[/i][i]aa[i/][em]test[/em]', '<em>test</em><em>aa[i/]<em>test</em>'),
array('[b]test[/b][strong]test[/strong]', '<strong>test</strong><strong>test</strong>'),
array('[tt]test[/tt][code]test[/code]', '<code>test</code><code>test</code>'),
array('[kbd]test[/kbd][br][sup]test[/sup]', '<kbd>test</kbd><br /><sup>test</sup>')
);
}
/**
* testing decodeBB method
* @dataProvider decodeBBDataProvider
*/
public function testDecodeBB($actual, $expected)
{
$this->assertEquals($expected, PMA_Message::decodeBB($actual));
}
/**
* testing format method
*/
public function testFormat()
{
$this->assertEquals('test string', PMA_Message::format('test string'));
$this->assertEquals('test string', PMA_Message::format('test string', 'a'));
$this->assertEquals('test string', PMA_Message::format('test string', array()));
$this->assertEquals('test string', PMA_Message::format('%s string', array('test')));
}
/**
* testing getHash method
*/
public function testGetHash()
{
$this->object->setString('<&>test', false);
$this->object->setMessage('<&>test', false);
$this->assertEquals(md5(PMA_Message::NOTICE . '<&>test<&>test'), $this->object->getHash());
}
/**
* getMessage test - with empty message and with non-empty string - not key in globals
* additional params are defined
*/
public function testGetMessageWithoutMessageWithStringWithParams()
{
$this->object->setMessage('');
$this->object->setString('test string %s %s');
$this->object->addParam('test param 1');
$this->object->addParam('test param 2');
$this->assertEquals('test string test param 1 test param 2', $this->object->getMessage());
}
/**
* getMessage test - with empty message and with empty string
*/
public function testGetMessageWithoutMessageWithEmptyString()
{
$this->object->setMessage('');
$this->object->setString('');
$this->assertEquals('', $this->object->getMessage());
}
/**
* getMessage test - with empty message and with string, which is key to GLOBALS
* additional messages are defined
*/
public function testGetMessageWithoutMessageWithGlobalStringWithAddMessages()
{
$GLOBALS['key'] = 'test message';
$this->object->setMessage('');
$this->object->setString('key');
$this->object->addMessage('test message 2', ' - ');
$this->object->addMessage('test message 3', '&');
$this->assertEquals('test message - test message 2&test message 3', $this->object->getMessage());
unset($GLOBALS['key']);
}
/**
* getMessage test - message is defined
* message with BBCode defined
*/
public function testGetMessageWithMessageWithBBCode()
{
$this->object->setMessage('[kbd]test[/kbd] [a@./Documentation.html#cfg_Example@_blank]test[/a]');
$this->assertEquals('<kbd>test</kbd> <a href="./Documentation.html#cfg_Example" target="_blank">test</a>', $this->object->getMessage());
}
/**
* getLevel test
*/
public function testGetLevel()
{
$this->assertEquals('notice', $this->object->getLevel());
$this->object->setNumber(PMA_Message::SUCCESS);
$this->assertEquals('success', $this->object->getLevel());
$this->object->setNumber(PMA_Message::ERROR);
$this->assertEquals('error', $this->object->getLevel());
}
/**
* testing display method (output string and _is_displayed varible)
*/
public function testDisplay()
{
$this->assertFalse($this->object->isDisplayed());
$this->object->setMessage('Test Message');
$this->expectOutputString('<div class="notice">Test Message</div>');
$this->object->display();
$this->assertTrue($this->object->isDisplayed());
}
/**
* getDisplay test
*/
public function testGetDisplay()
{
$this->object->setMessage('Test Message');
$this->assertEquals('<div class="notice">Test Message</div>', $this->object->getDisplay());
}
/**
* isDisplayed test
*/
public function testIsDisplayed()
{
$this->assertFalse($this->object->isDisplayed(false));
$this->assertTrue($this->object->isDisplayed(true));
$this->assertTrue($this->object->isDisplayed(false));
}
}
?>

View File

@@ -1,68 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for correctness of SQL parser data
*
* @package phpMyAdmin-test
*/
/**
* Tests core.
*/
require_once 'PHPUnit/Framework.php';
define('PHPMYADMIN', 1);
/**
* Include to test.
*/
require_once './libraries/sqlparser.data.php';
/**
* Test for sorting of the arrays
*
* @package phpMyAdmin-test
*/
class PMA_SQL_parser_data_test extends PHPUnit_Framework_TestCase
{
private function assertSorted($array)
{
$copy = $array;
sort($copy);
$difference = array_diff_assoc($array, $copy);
$this->assertEquals($difference, array());
}
private function assertParserData($name)
{
$this->assertSorted($GLOBALS[$name]);
$this->assertEquals(count($GLOBALS[$name]), $GLOBALS[$name . '_cnt']);
}
public function testPMA_SQPdata_function_name()
{
$this->assertParserData('PMA_SQPdata_function_name');
}
public function testPMA_SQPdata_column_attrib()
{
$this->assertParserData('PMA_SQPdata_column_attrib');
}
public function testPMA_SQPdata_reserved_word()
{
$this->assertParserData('PMA_SQPdata_reserved_word');
}
public function testPMA_SQPdata_forbidden_word()
{
$this->assertParserData('PMA_SQPdata_forbidden_word');
}
public function testPMA_SQPdata_column_type()
{
$this->assertParserData('PMA_SQPdata_column_type');
}
}
?>

View File

@@ -1,263 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for correctness of SQL parser
*
* @package phpMyAdmin-test
*/
/**
* Tests core.
*/
require_once 'PHPUnit/Framework.php';
define('PHPMYADMIN', 1);
define('TESTSUITE', 1);
$GLOBALS['charset'] = 'utf-8';
function __($s) {
return $s;
}
/**
* Include to test.
*/
require_once './libraries/sqlparser.lib.php';
/**
* Test for SQL parser
*
* @package phpMyAdmin-test
*/
class PMA_SQL_parser_test extends PHPUnit_Framework_TestCase
{
private function assertParser($sql, $expected, $error = '')
{
$parsed_sql = PMA_SQP_parse($sql);
$this->assertEquals(PMA_SQP_getErrorString(), $error);
$this->assertEquals($parsed_sql, $expected);
}
public function testParse_1()
{
$this->assertParser('SELECT 1;', array (
'raw' => 'SELECT 1;',
0 =>
array (
'type' => 'alpha_reservedWord',
'data' => 'SELECT',
'pos' => 6,
'forbidden' => true,
),
1 =>
array (
'type' => 'digit_integer',
'data' => '1',
'pos' => 8,
),
2 =>
array (
'type' => 'punct_queryend',
'data' => ';',
'pos' => 0,
),
'len' => 3,
));
}
public function testParse_2()
{
$this->assertParser('SELECT * from aaa;', array (
'raw' => 'SELECT * from aaa;',
0 =>
array (
'type' => 'alpha_reservedWord',
'data' => 'SELECT',
'pos' => 6,
'forbidden' => true,
),
1 =>
array (
'type' => 'punct',
'data' => '*',
'pos' => 0,
),
2 =>
array (
'type' => 'alpha_reservedWord',
'data' => 'from',
'pos' => 13,
'forbidden' => true,
),
3 =>
array (
'type' => 'alpha_identifier',
'data' => 'aaa',
'pos' => 17,
'forbidden' => false,
),
4 =>
array (
'type' => 'punct_queryend',
'data' => ';',
'pos' => 0,
),
'len' => 5,
));
}
public function testParse_3()
{
$this->assertParser('SELECT * from `aaa`;', array (
'raw' => 'SELECT * from `aaa`;',
0 =>
array (
'type' => 'alpha_reservedWord',
'data' => 'SELECT',
'pos' => 6,
'forbidden' => true,
),
1 =>
array (
'type' => 'punct',
'data' => '*',
'pos' => 0,
),
2 =>
array (
'type' => 'alpha_reservedWord',
'data' => 'from',
'pos' => 13,
'forbidden' => true,
),
3 =>
array (
'type' => 'quote_backtick',
'data' => '`aaa`',
'pos' => 0,
),
4 =>
array (
'type' => 'punct_queryend',
'data' => ';',
'pos' => 0,
),
'len' => 5,
));
}
public function testParse_4()
{
$this->assertParser('SELECT * from `aaa;', array (
'raw' => 'SELECT * from `aaa`;',
0 =>
array (
'type' => 'alpha_reservedWord',
'data' => 'SELECT',
'pos' => 6,
'forbidden' => true,
),
1 =>
array (
'type' => 'punct',
'data' => '*',
'pos' => 0,
),
2 =>
array (
'type' => 'alpha_reservedWord',
'data' => 'from',
'pos' => 13,
'forbidden' => true,
),
3 =>
array (
'type' => 'quote_backtick',
'data' => '`aaa`',
'pos' => 0,
),
4 =>
array (
'type' => 'punct_queryend',
'data' => ';',
'pos' => 0,
),
'len' => 5,
));
}
public function testParse_5()
{
$this->assertParser('SELECT * FROM `a_table` tbla INNER JOIN b_table` tblb ON tblb.id = tbla.id WHERE tblb.field1 != tbla.field1`;', array (
'raw' => 'SELECT * FROM `a_table` tbla INNER JOIN b_table` tblb ON tblb.id = tbla.id WHERE tblb.field1 != tbla.field1`;',
0 =>
array (
'type' => 'alpha_reservedWord',
'data' => 'SELECT',
'pos' => 6,
'forbidden' => true,
),
1 =>
array (
'type' => 'punct',
'data' => '*',
'pos' => 0,
),
2 =>
array (
'type' => 'alpha_reservedWord',
'data' => 'FROM',
'pos' => 13,
'forbidden' => true,
),
3 =>
array (
'type' => 'quote_backtick',
'data' => '`a_table`',
'pos' => 0,
),
4 =>
array (
'type' => 'alpha_identifier',
'data' => 'tbla',
'pos' => 28,
'forbidden' => false,
),
5 =>
array (
'type' => 'alpha_reservedWord',
'data' => 'INNER',
'pos' => 34,
'forbidden' => true,
),
6 =>
array (
'type' => 'alpha_reservedWord',
'data' => 'JOIN',
'pos' => 39,
'forbidden' => true,
),
7 =>
array (
'type' => 'alpha_identifier',
'data' => 'b_table',
'pos' => 47,
'forbidden' => false,
),
8 =>
array (
'type' => 'quote_backtick',
'data' => '` tblb ON tblb.id = tbla.id WHERE tblb.field1 != tbla.field1`',
'pos' => 0,
),
9 =>
array (
'type' => 'punct_queryend',
'data' => ';',
'pos' => 0,
),
'len' => 10,
));
}
}
?>

View File

@@ -1,51 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for PMA_pow()
*
* @package phpMyAdmin-test
*/
/**
*
*/
require_once 'PHPUnit/Framework.php';
$match = array();
preg_match('@^([0-9]{1,2})(?:.([0-9]{1,2})(?:.([0-9]{1,2}))?)?@',
phpversion(), $match);
if (isset($match) && ! empty($match[1])) {
if (! isset($match[2])) {
$match[2] = 0;
}
if (! isset($match[3])) {
$match[3] = 0;
}
/**
* @ignore
*/
define('PMA_PHP_INT_VERSION',
(int) sprintf('%d%02d%02d', $match[1], $match[2], $match[3]));
} else {
/**
* @ignore
*/
define('PMA_PHP_INT_VERSION', 0);
}
$GLOBALS['charset'] = 'UTF-8';
require_once './libraries/string.lib.php';
/**
* @package phpMyAdmin-test
*/
class PMA_STR_sub_test extends PHPUnit_Framework_TestCase
{
public function testMultiByte()
{
$this->assertEquals('čšě',
PMA_substr('čšěčščěš', 0, 3));
}
}
?>

View File

@@ -1,59 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Test for blowfish encryption.
*
* @package phpMyAdmin-test
*/
/**
* Tests core.
*/
require_once 'PHPUnit/Framework.php';
/**
* Include to test.
*/
require_once './libraries/blowfish.php';
/**
* Test java script escaping.
*
* @package phpMyAdmin-test
*/
class PMA_blowfish_test extends PHPUnit_Framework_TestCase
{
public function testEncryptDecryptNumbers()
{
$secret = '$%ÄüfuDFRR';
$string = '12345678';
$this->assertEquals($string,
PMA_blowfish_decrypt(PMA_blowfish_encrypt($string, $secret), $secret));
}
public function testEncryptDecryptChars()
{
$secret = '$%ÄüfuDFRR';
$string = 'abcDEF012!"§$%&/()=?`´"\',.;:-_#+*~öäüÖÄÜ^°²³';
$this->assertEquals($string,
PMA_blowfish_decrypt(PMA_blowfish_encrypt($string, $secret), $secret));
}
public function testEncrypt()
{
$secret = '$%ÄüfuDFRR';
$decrypted = '12345678';
$encrypted = 'kO/kc4j/nyk=';
$this->assertEquals($encrypted, PMA_blowfish_encrypt($decrypted, $secret));
}
public function testDecrypt()
{
$secret = '$%ÄüfuDFRR';
$encrypted = 'kO/kc4j/nyk=';
$decrypted = '12345678';
$this->assertEquals($decrypted, PMA_blowfish_decrypt($encrypted, $secret));
}
}
?>

View File

@@ -1,103 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Test for caching data in session
*
* @package phpMyAdmin-test
* @version $Id: PMA_cache_test.php
*/
/**
* Tests core.
*/
require_once 'PHPUnit/Framework.php';
/**
* Include to test.
*/
require_once './libraries/common.lib.php';
/**
* Test cache.
*
*/
class PMA_cache_test extends PHPUnit_Framework_TestCase
{
/**
* @var array temporary variable for globals array
*/
protected $tmpGlobals;
/**
* @var array temporary variable for session array
*/
protected $tmpSession;
/**
* storing globals and session
*/
public function setUp()
{
$this->tmpGlobals = $GLOBALS;
$this->tmpSession = $_SESSION;
}
/**
* Test if cached data is available after set
*/
public function testCacheExists()
{
$GLOBALS['server'] = 'server';
PMA_cacheSet('test_data', 5, true);
PMA_cacheSet('test_data_2', 5, true);
$this->assertTrue(PMA_cacheExists('test_data', true));
$this->assertTrue(PMA_cacheExists('test_data_2', 'server'));
$this->assertFalse(PMA_cacheExists('fake_data_2', true));
}
/**
* Test if cacheGet does not return data for non existing caache entries
*/
public function testCacheGet()
{
$GLOBALS['server'] = 'server';
PMA_cacheSet('test_data', 5, true);
PMA_cacheSet('test_data_2', 5, true);
$this->assertNotNull(PMA_cacheGet('test_data', true));
$this->assertNotNull(PMA_cacheGet('test_data_2', 'server'));
$this->assertNull(PMA_cacheGet('fake_data_2', true));
}
/**
* Test retrieval of cached data
*/
public function testCacheSetGet()
{
$GLOBALS['server'] = 'server';
PMA_cacheSet('test_data', 25, true);
PMA_cacheSet('test_data', 5, true);
$this->assertEquals(5, $_SESSION['cache']['server_server']['test_data']);
PMA_cacheSet('test_data_3', 3, true);
$this->assertEquals(3, $_SESSION['cache']['server_server']['test_data_3']);
}
/**
* Test clearing cached values
*/
public function testCacheUnSet()
{
$GLOBALS['server'] = 'server';
PMA_cacheSet('test_data', 25, true);
PMA_cacheSet('test_data_2', 25, true);
PMA_cacheUnset('test_data', true);
$this->assertArrayNotHasKey('test_data', $_SESSION['cache']['server_server']);
PMA_cacheUnset('test_data_2', true);
$this->assertArrayNotHasKey('test_data_2', $_SESSION['cache']['server_server']);
}
}
?>

View File

@@ -1,57 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Test for javascript escaping.
*
* @package phpMyAdmin-test
*/
/**
* Tests core.
*/
require_once 'PHPUnit/Framework.php';
/**
* Include to test.
*/
require_once './libraries/js_escape.lib.php';
/**
* Test java script escaping.
*
* @package phpMyAdmin-test
*/
class PMA_escapeJsString_test extends PHPUnit_Framework_TestCase
{
public function testEscape_1()
{
$this->assertEquals('\\\';', PMA_escapeJsString('\';'));
}
public function testEscape_2()
{
$this->assertEquals('\r\n\\\'<scrIpt></\' + \'script>', PMA_escapeJsString("\r\n'<scrIpt></sCRIPT>"));
}
public function testEscape_3()
{
$this->assertEquals('\\\';[XSS]', PMA_escapeJsString('\';[XSS]'));
}
public function testEscape_4()
{
$this->assertEquals('</\' + \'script></head><body>[HTML]', PMA_escapeJsString('</SCRIPT></head><body>[HTML]'));
}
public function testEscape_5()
{
$this->assertEquals('"\\\'\\\\\\\'"', PMA_escapeJsString('"\'\\\'"'));
}
public function testEscape_6()
{
$this->assertEquals("\\\\\'\'\'\'\'\'\'\'\'\'\'\'\\\\", PMA_escapeJsString("\\''''''''''''\\"));
}
}
?>

View File

@@ -1,59 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Test for MySQL Wildcards escaping/unescaping
*
* @package phpMyAdmin-test
*/
/**
* Tests core.
*/
require_once 'PHPUnit/Framework.php';
/**
* Include to test.
*/
require_once './libraries/common.lib.php';
/**
* Test MySQL escaping.
*
*/
class PMA_escapeMySqlWildcards_test extends PHPUnit_Framework_TestCase
{
public function escapeDataProvider() {
return array(
array('\_test', '_test'),
array('\_\\', '_\\'),
array('\\_\%', '_%'),
array('\\\_', '\_'),
array('\\\_\\\%', '\_\%'),
array('\_\\%\_\_\%', '_%__%'),
array('\%\_', '%_'),
array('\\\%\\\_', '\%\_')
);
}
/**
* PMA_escape_mysql_wildcards tests
* @dataProvider escapeDataProvider
*/
public function testEscape($a, $b)
{
$this->assertEquals($a, PMA_escape_mysql_wildcards($b));
}
/**
* PMA_unescape_mysql_wildcards tests
* @dataProvider escapeDataProvider
*/
public function testUnEscape($a, $b)
{
$this->assertEquals($b, PMA_unescape_mysql_wildcards($a));
}
}
?>

View File

@@ -1,46 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Test for supporting foreign key
*
* @package phpMyAdmin-test
*/
/**
* Tests core.
*/
require_once 'PHPUnit/Framework.php';
/**
* Include to test.
*/
require_once './libraries/common.lib.php';
/**
* Test supported foreign key.
*
*/
class PMA_foreignKeySupported_test extends PHPUnit_Framework_TestCase
{
/**
* data provider for foreign key supported test
*/
public function foreignkeySupportedDataProvider() {
return array(
array('MyISAM', false),
array('innodb', true),
array('pBxT', true)
);
}
/**
* foreign key supported test
* @dataProvider foreignkeySupportedDataProvider
*/
public function testForeignkeySupported($a, $e) {
$this->assertEquals($e, PMA_foreignkey_supported($a));
}
}
?>

View File

@@ -1,112 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Test for format number and byte
*
* @package phpMyAdmin-test
* @version $Id: PMA_formatNumberByteDown_test.php
*/
/**
* Tests core.
*/
require_once 'PHPUnit/Framework.php';
/**
* Include to test.
*/
require_once './libraries/common.lib.php';
/**
* Test formating number and byte.
*
*/
class PMA_formatNumberByteDown_test extends PHPUnit_Framework_TestCase
{
/**
* temporary variable for globals array
*/
protected $tmpGlobals;
/**
* temporary variable for session array
*/
protected $tmpSession;
/**
* storing globals and session
*/
public function setUp() {
$this->tmpGlobals = $GLOBALS;
$this->tmpSession = $_SESSION;
}
/**
* recovering globals and session
*/
public function tearDown() {
$GLOBALS = $this->tmpGlobals;
$_SESSION = $this->tmpSession;
}
/**
* format number data provider
*/
public function formatNumberDataProvider() {
return array(
array(10, 2, 2, '10,00 '),
array(100, 2, 0, '100 '),
array(100, 2, 2, '0,10 k'),
array(-1000.454, 4, 2, '-1 000,45 '),
array(0.00003, 3, 2, '0,03 m'),
array(0.003, 3, 3, '0,003 '),
array(-0.003, 6, 0, '-3 m'),
array(100.98, 0, 2, '100,98')
);
}
/**
* format number test, globals are defined
* @dataProvider formatNumberDataProvider
*/
public function testFormatNumber($a, $b, $c, $e) {
$this->assertEquals($e, (string)PMA_formatNumber($a, $b, $c, false));
}
/**
* format byte down data provider
*/
public function formatByteDownDataProvider() {
return array(
array(10, 2, 2, array('10', 'B')),
array(100, 2, 0, array('0', 'KB')),
array(100, 3, 0, array('100', 'B')),
array(100, 2, 2, array('0,10', 'KB')),
array(1034, 3, 2, array('1,01', 'KB')),
array(100233, 3, 3, array('97,884', 'KB')),
array(2206451, 1, 2, array('2,10', 'MB'))
);
}
/**
* format byte test, globals are defined
* @dataProvider formatByteDownDataProvider
*/
public function testFormatByteDown($a, $b, $c, $e) {
$result = PMA_formatByteDown($a, $b, $c);
$result[0] = trim($result[0]);
$this->assertEquals($e, $result);
}
}
?>

View File

@@ -1,146 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for PMA_generate_common_url()
*
* @package phpMyAdmin-test
*/
/**
*
*/
require_once 'PHPUnit/Framework.php';
require_once './libraries/core.lib.php';
require_once './libraries/url_generating.lib.php';
/**
* @package phpMyAdmin-test
*/
class PMA_generate_common_url_test extends PHPUnit_Framework_TestCase
{
public function setUp()
{
unset($_COOKIE['pma_lang'], $_COOKIE['pma_collation_connection']);
}
public function testOldStyle()
{
$GLOBALS['server'] = 'x';
$GLOBALS['lang'] = 'x';
$GLOBALS['collation_connection'] = 'x';
$_SESSION[' PMA_token '] = 'x';
$GLOBALS['cfg']['ServerDefault'] = 'y';
$separator = PMA_get_arg_separator();
$expected = 'server=x' . htmlentities($separator)
. 'lang=x' . htmlentities($separator)
. 'collation_connection=x' . htmlentities($separator)
. 'token=x'
;
$expected = 'db=db'
. htmlentities($separator) . 'table=table'
. htmlentities($separator) . $expected;
$this->assertEquals($expected, PMA_generate_common_url('db', 'table'));
}
public function testOldStyleDbOnly()
{
$GLOBALS['server'] = 'x';
$GLOBALS['lang'] = 'x';
$GLOBALS['collation_connection'] = 'x';
$_SESSION[' PMA_token '] = 'x';
$GLOBALS['cfg']['ServerDefault'] = 'y';
$separator = PMA_get_arg_separator();
$expected = 'server=x' . htmlentities($separator)
. 'lang=x' . htmlentities($separator)
. 'collation_connection=x' . htmlentities($separator)
. 'token=x'
;
$expected = 'db=db'
. htmlentities($separator) . $expected;
$this->assertEquals($expected, PMA_generate_common_url('db'));
}
public function testNewStyle()
{
$GLOBALS['server'] = 'x';
$GLOBALS['lang'] = 'x';
$GLOBALS['collation_connection'] = 'x';
$_SESSION[' PMA_token '] = 'x';
$GLOBALS['cfg']['ServerDefault'] = 'y';
$separator = PMA_get_arg_separator();
$expected = 'server=x' . htmlentities($separator)
. 'lang=x' . htmlentities($separator)
. 'collation_connection=x' . htmlentities($separator)
. 'token=x'
;
$expected = '?db=db'
. htmlentities($separator) . 'table=table'
. htmlentities($separator) . $expected;
$params = array('db' => 'db', 'table' => 'table');
$this->assertEquals($expected, PMA_generate_common_url($params));
}
public function testOldStyleWithAlternateSeparator()
{
$GLOBALS['server'] = 'x';
$GLOBALS['lang'] = 'x';
$GLOBALS['collation_connection'] = 'x';
$_SESSION[' PMA_token '] = 'x';
$GLOBALS['cfg']['ServerDefault'] = 'y';
$separator = PMA_get_arg_separator();
$expected = 'server=x' . $separator
. 'lang=x' . $separator
. 'collation_connection=x' . $separator
. 'token=x'
;
$expected = 'db=db' . $separator . 'table=table' . $separator . $expected;
$this->assertEquals($expected, PMA_generate_common_url('db', 'table', '&'));
}
public function testOldStyleWithAlternateSeparatorDbOnly()
{
$GLOBALS['server'] = 'x';
$GLOBALS['lang'] = 'x';
$GLOBALS['collation_connection'] = 'x';
$_SESSION[' PMA_token '] = 'x';
$GLOBALS['cfg']['ServerDefault'] = 'y';
$separator = PMA_get_arg_separator();
$expected = 'server=x' . $separator
. 'lang=x' . $separator
. 'collation_connection=x' . $separator
. 'token=x'
;
$expected = 'db=db' . $separator . $expected;
$this->assertEquals($expected, PMA_generate_common_url('db', '', '&'));
}
public function testDefault()
{
$GLOBALS['server'] = 'x';
$GLOBALS['lang'] = 'x';
$GLOBALS['collation_connection'] = 'x';
$_SESSION[' PMA_token '] = 'x';
$GLOBALS['cfg']['ServerDefault'] = 'y';
$separator = PMA_get_arg_separator();
$expected = 'server=x' . htmlentities($separator)
. 'lang=x' . htmlentities($separator)
. 'collation_connection=x' . htmlentities($separator)
. 'token=x'
;
$this->assertEquals($expected, PMA_generate_common_url());
}
}
?>

View File

@@ -1,45 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for PMA_get_real_size()
*
* @package phpMyAdmin-test
*/
/**
*
*/
require_once 'PHPUnit/Framework.php';
require_once './libraries/core.lib.php';
/**
* @package phpMyAdmin-test
*/
class PMA_get_real_size_test extends PHPUnit_Framework_TestCase
{
public function testNull()
{
$this->assertEquals(0, PMA_get_real_size('0'));
}
public function testKilobyte()
{
$this->assertEquals(1024, PMA_get_real_size('1kb'));
}
public function testKilobyte2()
{
$this->assertEquals(1024 * 1024, PMA_get_real_size('1024k'));
}
public function testMegabyte()
{
$this->assertEquals(8 * 1024 * 1024, PMA_get_real_size('8m'));
}
public function testGigabyte()
{
$this->assertEquals(12 * 1024 * 1024 * 1024, PMA_get_real_size('12gb'));
}
}
?>

View File

@@ -1,304 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Test for PMA_sendHeaderLocation
*
*/
/**
* Tests core.
*/
require_once 'PHPUnit/Framework.php';
require_once 'PHPUnit/Extensions/OutputTestCase.php';
/**
* Include to test.
*/
require_once './libraries/common.lib.php';
require_once './libraries/url_generating.lib.php';
require_once './libraries/core.lib.php';
require_once './libraries/select_lang.lib.php';
/**
* Test function sending headers.
* Warning - these tests set constants, so it can interfere with other tests
* If you have runkit extension, then it is possible to back changes made on constants
* rest of options can be tested only with apd, when functions header and headers_sent are redefined
* rename_function() of header and headers_sent may cause CLI error report in Windows XP (but tests are done correctly)
* additional functions which were created during tests must be stored to coverage test e.g.
*
* <code>rename_function('headers_sent', 'headers_sent'.str_replace(array('.', ' '),array('', ''),microtime()));</code>
*
* @package phpMyAdmin-test
*/
class PMA_headerLocation_test extends PHPUnit_Extensions_OutputTestCase
{
protected $oldIISvalue;
protected $oldSIDvalue;
protected $runkitExt;
protected $apdExt;
public function __construct()
{
parent::__construct();
$this->runkitExt = false;
if (function_exists("runkit_constant_redefine"))
$this->runkitExt = true;
$this->apdExt = false;
if (function_exists("rename_function"))
$this->apdExt = true;
if ($this->apdExt && !$GLOBALS['test_header']) {
// using apd extension to overriding header and headers_sent functions for test purposes
$GLOBALS['test_header'] = 1;
// rename_function() of header and headers_sent may cause CLI error report in Windows XP
rename_function('header', 'test_header');
rename_function('headers_sent', 'test_headers_sent');
// solution from: http://unixwars.com/2008/11/29/override_function-in-php/ to overriding more than one function
$substs = array(
'header' => 'if (isset($GLOBALS["header"])) $GLOBALS["header"] .= $a; else $GLOBALS["header"] = $a;',
'headers_sent' => 'return false;'
);
$args = array(
'header' => '$a',
'headers_sent' => ''
);
foreach ($substs as $func => $ren_func) {
if (function_exists("__overridden__"))
rename_function("__overridden__", str_replace(array('.', ' '),array('', ''),microtime()));
override_function($func, $args[$func], $substs[$func]);
rename_function("__overridden__", str_replace(array('.', ' '),array('', ''),microtime()));
}
}
}
public function __destruct()
{
// rename_function may causes CLI error report in Windows XP, but nothing more happen
if ($this->apdExt && $GLOBALS['test_header']) {
$GLOBALS['test_header'] = 0;
rename_function('header', 'header'.str_replace(array('.', ' '),array('', ''),microtime()));
rename_function('headers_sent', 'headers_sent'.str_replace(array('.', ' '),array('', ''),microtime()));
rename_function('test_header', 'header');
rename_function('test_headers_sent', 'headers_sent');
}
}
public function setUp()
{
// cleaning constants
if ($this->runkitExt) {
$this->oldIISvalue = 'non-defined';
if (defined('PMA_IS_IIS')) {
$this->oldIISvalue = PMA_IS_IIS;
runkit_constant_redefine('PMA_IS_IIS', NULL);
}
else {
runkit_constant_add('PMA_IS_IIS', NULL);
}
$this->oldSIDvalue = 'non-defined';
if (defined('SID')) {
$this->oldSIDvalue = SID;
runkit_constant_redefine('SID', NULL);
}
else {
runkit_constant_add('SID', NULL);
}
}
}
public function tearDown()
{
// cleaning constants
if ($this->runkitExt) {
if ($this->oldIISvalue != 'non-defined')
runkit_constant_redefine('PMA_IS_IIS', $this->oldIISvalue);
elseif (defined('PMA_IS_IIS')) {
runkit_constant_remove('PMA_IS_IIS');
}
if ($this->oldSIDvalue != 'non-defined')
runkit_constant_redefine('SID', $this->oldSIDvalue);
elseif (defined('SID')) {
runkit_constant_remove('SID');
}
}
if ($this->apdExt)
unset($GLOBALS['header']);
}
public function testSendHeaderLocationWithSidUrlWithQuestionMark()
{
if ($this->runkitExt && $this->apdExt) {
runkit_constant_redefine('SID', md5('test_hash'));
$testUri = 'http://testurl.com/test.php?test=test';
$separator = PMA_get_arg_separator();
$header = 'Location: ' . $testUri . $separator . SID;
PMA_sendHeaderLocation($testUri); // sets $GLOBALS['header']
$this->assertEquals($header, $GLOBALS['header']);
} else {
$this->markTestSkipped('Cannot redefine constant/function - missing APD or/and runkit extension');
}
}
public function testSendHeaderLocationWithSidUrlWithoutQuestionMark()
{
if ($this->runkitExt && $this->apdExt) {
runkit_constant_redefine('SID', md5('test_hash'));
$testUri = 'http://testurl.com/test.php';
$separator = PMA_get_arg_separator();
$header = 'Location: ' . $testUri . '?' . SID;
PMA_sendHeaderLocation($testUri); // sets $GLOBALS['header']
$this->assertEquals($header, $GLOBALS['header']);
} else {
$this->markTestSkipped('Cannot redefine constant/function - missing APD or/and runkit extension');
}
}
public function testSendHeaderLocationWithoutSidWithIis()
{
if ($this->runkitExt && $this->apdExt) {
runkit_constant_redefine('PMA_IS_IIS', true);
runkit_constant_add('PMA_COMING_FROM_COOKIE_LOGIN', true);
$testUri = 'http://testurl.com/test.php';
$separator = PMA_get_arg_separator();
$header = 'Refresh: 0; ' . $testUri;
PMA_sendHeaderLocation($testUri); // sets $GLOBALS['header']
// cleaning constant
runkit_constant_remove('PMA_COMING_FROM_COOKIE_LOGIN');
$this->assertEquals($header, $GLOBALS['header']);
} else {
$this->markTestSkipped('Cannot redefine constant/function - missing APD or/and runkit extension');
}
}
public function testSendHeaderLocationWithoutSidWithoutIis()
{
if ($this->apdExt) {
$testUri = 'http://testurl.com/test.php';
$header = 'Location: ' . $testUri;
PMA_sendHeaderLocation($testUri); // sets $GLOBALS['header']
$this->assertEquals($header, $GLOBALS['header']);
} else {
$this->markTestSkipped('Cannot redefine constant/function - missing APD or/and runkit extension');
}
}
public function testSendHeaderLocationIisLongUri()
{
if (defined('PMA_IS_IIS') && $this->runkitExt)
runkit_constant_redefine('PMA_IS_IIS', true);
elseif (!defined('PMA_IS_IIS'))
define('PMA_IS_IIS', true);
else
$this->markTestSkipped('Cannot redefine constant/function - missing APD or/and runkit extension');
// over 600 chars
$testUri = 'http://testurl.com/test.php?testlonguri=over600chars&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test&test=test';
$testUri_html = htmlspecialchars($testUri);
$testUri_js = PMA_escapeJsString($testUri);
$header = "<html><head><title>- - -</title>\n" .
"<meta http-equiv=\"expires\" content=\"0\">\n" .
"<meta http-equiv=\"Pragma\" content=\"no-cache\">\n" .
"<meta http-equiv=\"Cache-Control\" content=\"no-cache\">\n" .
"<meta http-equiv=\"Refresh\" content=\"0;url=" . $testUri_html . "\">\n" .
"<script type=\"text/javascript\">\n".
"//<![CDATA[\n" .
"setTimeout(\"window.location = unescape('\"" . $testUri_js . "\"')\", 2000);\n" .
"//]]>\n" .
"</script>\n" .
"</head>\n" .
"<body>\n" .
"<script type=\"text/javascript\">\n" .
"//<![CDATA[\n" .
"document.write('<p><a href=\"" . $testUri_html . "\">" . 'test link' . "</a></p>');\n" .
"//]]>\n" .
"</script></body></html>\n";
$this->expectOutputString($header);
PMA_sendHeaderLocation($testUri);
}
/**
* other output tests
*/
public function testWriteReloadNavigation()
{
$GLOBALS['reload'] = true;
$GLOBALS['db'] = 'test_db';
$url = './navigation.php?db='.$GLOBALS['db'] . '&lang=en-utf-8&convcharset=utf-8';
$write = PHP_EOL . '<script type="text/javascript">' . PHP_EOL .
'//<![CDATA[' . PHP_EOL .
'if (typeof(window.parent) != \'undefined\'' . PHP_EOL .
' && typeof(window.parent.frame_navigation) != \'undefined\'' . PHP_EOL .
' && window.parent.goTo) {' . PHP_EOL .
' window.parent.goTo(\'' . $url . '\');' . PHP_EOL .
'}' . PHP_EOL .
'//]]>' . PHP_EOL .
'</script>' . PHP_EOL;
$this->expectOutputString($write);
PMA_reloadNavigation();
$this->assertFalse(isset($GLOBALS['reload']));
unset($GLOBALS['db']);
}
}
?>

View File

@@ -1,49 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for PMA_ifSetOr()
*
* @package phpMyAdmin-test
*/
/**
*
*/
require_once 'PHPUnit/Framework.php';
require_once './libraries/core.lib.php';
/**
* @package phpMyAdmin-test
*/
class PMA_ifSetOr_test extends PHPUnit_Framework_TestCase
{
public function testVarSet()
{
$default = 'foo';
$in = 'bar';
$out = PMA_ifSetOr($in, $default);
$this->assertEquals($in, $out);
}
public function testVarSetWrongType()
{
$default = 'foo';
$in = 'bar';
$out = PMA_ifSetOr($in, $default, 'boolean');
$this->assertEquals($out, $default);
}
public function testVarNotSet()
{
$default = 'foo';
// $in is not set!
$out = PMA_ifSetOr($in, $default);
$this->assertEquals($out, $default);
}
public function testVarNotSetNoDefault()
{
// $in is not set!
$out = PMA_ifSetOr($in);
$this->assertEquals($out, null);
}
}
?>

View File

@@ -1,114 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for PMA_pow()
*
* @package phpMyAdmin-test
*/
/**
*
*/
require_once 'PHPUnit/Framework.php';
require_once './libraries/core.lib.php';
/**
* @package phpMyAdmin-test
*/
class PMA_isValid_test extends PHPUnit_Framework_TestCase
{
public function testVarNotSetAfterTest()
{
PMA_isValid($var);
$this->assertFalse(isset($var));
}
public function testNotSet()
{
$this->assertFalse(PMA_isValid($var));
}
public function testEmptyString()
{
$var = '';
$this->assertFalse(PMA_isValid($var));
}
public function testNotEmptyString()
{
$var = '0';
$this->assertTrue(PMA_isValid($var));
}
public function testZero()
{
$var = 0;
$this->assertTrue(PMA_isValid($var));
}
public function testNullFail()
{
$var = null;
$this->assertFalse(PMA_isValid($var));
}
public function testNotSetArray()
{
$this->assertFalse(PMA_isValid($array['x']));
}
public function testScalarString()
{
$var = 'string';
$this->assertTrue(PMA_isValid($var, 'scalar'));
}
public function testScalarInt()
{
$var = 1;
$this->assertTrue(PMA_isValid($var, 'scalar'));
}
public function testScalarFloat()
{
$var = 1.1;
$this->assertTrue(PMA_isValid($var, 'scalar'));
}
public function testScalarBool()
{
$var = true;
$this->assertTrue(PMA_isValid($var, 'scalar'));
}
public function testNotScalarArray()
{
$var = array('test');
$this->assertFalse(PMA_isValid($var, 'scalar'));
}
public function testNotScalarNull()
{
$var = null;
$this->assertFalse(PMA_isValid($var, 'scalar'));
}
public function testNumericInt()
{
$var = 1;
$this->assertTrue(PMA_isValid($var, 'numeric'));
}
public function testNumericFloat()
{
$var = 1.1;
$this->assertTrue(PMA_isValid($var, 'numeric'));
}
public function testNumericZero()
{
$var = 0;
$this->assertTrue(PMA_isValid($var, 'numeric'));
}
public function testNumericString()
{
$var = '+0.1';
$this->assertTrue(PMA_isValid($var, 'numeric'));
}
public function testValueInArray()
{
$var = 'a';
$this->assertTrue(PMA_isValid($var, array('a', 'b', )));
}
public function testValueNotInArray()
{
$var = 'c';
$this->assertFalse(PMA_isValid($var, array('a', 'b', )));
}
}
?>

View File

@@ -1,109 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Test for generating localised date or timespan expression
*
* @package phpMyAdmin-test
* @version $Id: PMA_localisedDateTimespan_test.php
*/
/**
* Tests core.
*/
require_once 'PHPUnit/Framework.php';
/**
* Include to test.
*/
require_once './libraries/common.lib.php';
/**
* Test localised date or timespan expression.
*
*/
class PMA_localisedDateTimespan_test extends PHPUnit_Framework_TestCase
{
/**
* temporary variable for globals array
*/
protected $tmpGlobals;
/**
* temporary variable for session array
*/
protected $tmpSession;
/**
* temporary variable for timezone info
*/
protected $tmpTimezone;
/**
* storing globals and session
*/
public function setUp() {
$this->tmpGlobals = $GLOBALS;
$this->tmpSession = $_SESSION;
$this->tmpTimezone = date_default_timezone_get();
date_default_timezone_set('Europe/London');
}
/**
* recovering globals and session
*/
public function tearDown() {
$GLOBALS = $this->tmpGlobals;
$_SESSION = $this->tmpSession;
date_default_timezone_set($this->tmpTimezone);
}
/**
* data provider for localised date test
*/
public function localisedDateDataProvider() {
return array(
array(1227455558, '', 'Nov 23, 2008 at 03:52 PM'),
array(1227455558, '%Y-%m-%d %H:%M:%S %a', '2008-11-23 15:52:38 Sun')
);
}
/**
* localised date test, globals are defined
* @dataProvider localisedDateDataProvider
*/
public function testLocalisedDate($a, $b, $e) {
$this->assertEquals($e, PMA_localisedDate($a, $b));
}
/**
* data provider for localised timestamp test
*/
public function timespanFormatDataProvider() {
return array(
array(1258, '0 days, 0 hours, 20 minutes and 58 seconds'),
array(821958, '9 days, 12 hours, 19 minutes and 18 seconds')
);
}
/**
* localised timestamp test, globals are defined
* @dataProvider timespanFormatDataProvider
*/
public function testTimespanFormat($a, $e) {
$GLOBALS['timespanfmt'] = '%s days, %s hours, %s minutes and %s seconds';
$this->assertEquals($e, PMA_timespanFormat($a));
}
}
?>

View File

@@ -1,82 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for PMA_pow()
*
* @package phpMyAdmin-test
*/
/**
*
*/
require_once 'PHPUnit/Framework.php';
require_once './libraries/common.lib.php';
/**
* @package phpMyAdmin-test
*/
class PMA_pow_test extends PHPUnit_Framework_TestCase
{
public function testIntOverflow()
{
$this->assertEquals('1267650600228229401496703205376',
PMA_pow(2, 100));
}
public function testBcpow()
{
if (function_exists('bcpow')) {
$this->assertEquals('1267650600228229401496703205376',
PMA_pow(2, 100, 'bcpow'));
} else {
$this->markTestSkipped('function bcpow() does not exist');
}
}
public function testGmppow()
{
if (function_exists('gmp_pow')) {
$this->assertEquals('1267650600228229401496703205376',
PMA_pow(2, 100, 'gmp_pow'));
} else {
$this->markTestSkipped('function gmp_pow() does not exist');
}
}
public function _testNegativeExp()
{
$this->assertEquals(0.25,
PMA_pow(2, -2));
}
public function _testNegativeExpPow()
{
if (function_exists('pow')) {
$this->assertEquals(0.25,
PMA_pow(2, -2, 'pow'));
} else {
$this->markTestSkipped('function pow() does not exist');
}
}
public function _testNegativeExpBcpow()
{
if (function_exists('bcpow')) {
$this->assertEquals(0.25,
PMA_pow(2, -2, 'bcpow'));
} else {
$this->markTestSkipped('function bcpow() does not exist');
}
}
public function _testNegativeExpGmppow()
{
if (function_exists('gmp_pow')) {
$this->assertEquals(0.25,
PMA_pow(2, -2, 'gmp_pow'));
} else {
$this->markTestSkipped('function gmp_pow() does not exist');
}
}
}
?>

View File

@@ -1,47 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Test printableBitValue function
*
* @package phpMyAdmin-test
* @version $Id: PMA_printableBitValue_test.php
*/
/**
* Tests core.
*/
require_once 'PHPUnit/Framework.php';
/**
* Include to test.
*/
require_once './libraries/common.lib.php';
/**
* Test printableBitValue function.
*
*/
class PMA_printableBitValue_test extends PHPUnit_Framework_TestCase
{
/**
* data provider for printable bit value test
*/
public function printableBitValueDataProvider() {
return array(
array('testtest', 64, '0111010001100101011100110111010001110100011001010111001101110100'),
array('test', 32, '01110100011001010111001101110100')
);
}
/**
* test for generating string contains printable bit value of selected data
* @dataProvider printableBitValueDataProvider
*/
public function testPrintableBitValue($a, $b, $e) {
$this->assertEquals($e, PMA_printable_bit_value($a, $b));
}
}
?>

View File

@@ -1,111 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Test for quoting, slashing/backslashing
*
* @package phpMyAdmin-test
* @version $Id: PMA_quoting_slashing_test.php
*/
/**
* Tests core.
*/
require_once 'PHPUnit/Framework.php';
/**
* Include to test.
*/
require_once './libraries/common.lib.php';
/**
* Test quoting, slashing, backslashing.
*
*/
class PMA_quoting_slashing_test extends PHPUnit_Framework_TestCase
{
/**
* sqlAddslashes test
*/
public function testAddSlashes() {
$string = "\'test''\''\'\r\t\n";
$this->assertEquals("\\\\\\\\\'test\'\'\\\\\\\\\'\'\\\\\\\\\'\\r\\t\\n", PMA_sqlAddslashes($string, true, true, true));
$this->assertEquals("\\\\\\\\''test''''\\\\\\\\''''\\\\\\\\''\\r\\t\\n", PMA_sqlAddslashes($string, true, true, false));
$this->assertEquals("\\\\\\\\\'test\'\'\\\\\\\\\'\'\\\\\\\\\'\r\t\n", PMA_sqlAddslashes($string, true, false, true));
$this->assertEquals("\\\\\\\\''test''''\\\\\\\\''''\\\\\\\\''\r\t\n", PMA_sqlAddslashes($string, true, false, false));
$this->assertEquals("\\\\\'test\'\'\\\\\'\'\\\\\'\\r\\t\\n", PMA_sqlAddslashes($string, false, true, true));
$this->assertEquals("\\\\''test''''\\\\''''\\\\''\\r\\t\\n", PMA_sqlAddslashes($string, false, true, false));
$this->assertEquals("\\\\\'test\'\'\\\\\'\'\\\\\'\r\t\n", PMA_sqlAddslashes($string, false, false, true));
$this->assertEquals("\\\\''test''''\\\\''''\\\\''\r\t\n", PMA_sqlAddslashes($string, false, false, false));
}
/**
* data provider for unQuote test
*/
public function unQuoteProvider() {
return array(
array('"test\'"', "test'"),
array("'test''", "test'"),
array("`test'`", "test'"),
array("'test'test", "'test'test")
);
}
/**
* unQuote test
* @dataProvider unQuoteProvider
*/
public function testUnQuote($param, $expected) {
$this->assertEquals($expected, PMA_unQuote($param));
}
/**
* data provider for unQuote test with chosen quote
*/
public function unQuoteSelectedProvider() {
return array(
array('"test\'"', "test'"),
array("'test''", "'test''"),
array("`test'`", "`test'`"),
array("'test'test", "'test'test")
);
}
/**
* unQuote test with chosen quote
* @dataProvider unQuoteSelectedProvider
*/
public function testUnQuoteSelectedChar($param, $expected) {
$this->assertEquals($expected, PMA_unQuote($param, '"'));
}
/**
* data provider for backquote test
*/
public function backquoteDataProvider() {
return array(
array('0', '`0`'),
array('test', '`test`'),
array('te`st', '`te``st`'),
array(array('test', 'te`st', '', '*'), array('`test`', '`te``st`', '', '*'))
);
}
/**
* backquote test with different param $do_it (true, false)
* @dataProvider backquoteDataProvider
*/
public function testBackquote($a, $b) {
$this->assertEquals($a, PMA_backquote($a, false));
$this->assertEquals($b, PMA_backquote($a));
}
}
?>

View File

@@ -1,44 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for PMA_sanitize()
*
* @package phpMyAdmin-test
*/
/**
*
*/
require_once 'PHPUnit/Framework.php';
require_once './libraries/sanitizing.lib.php';
/**
* @package phpMyAdmin-test
*/
class PMA_sanitize_test extends PHPUnit_Framework_TestCase
{
public function testXssInHref()
{
$this->assertEquals('[a@javascript:alert(\'XSS\');@target]link</a>',
PMA_sanitize('[a@javascript:alert(\'XSS\');@target]link[/a]'));
}
public function testLink()
{
$this->assertEquals('<a href="http://www.phpmyadmin.net/" target="target">link</a>',
PMA_sanitize('[a@http://www.phpmyadmin.net/@target]link[/a]'));
}
public function testHtmlTags()
{
$this->assertEquals('&lt;div onclick=""&gt;',
PMA_sanitize('<div onclick="">'));
}
public function testBbcoe()
{
$this->assertEquals('<strong>strong</strong>',
PMA_sanitize('[b]strong[/b]'));
}
}
?>

View File

@@ -1,176 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Test for showHint function
*
* @package phpMyAdmin-test
* @version $Id: PMA_showHint_test.php
*/
/**
* Tests core.
*/
require_once 'PHPUnit/Framework.php';
/**
* Include to test.
*/
require_once './libraries/common.lib.php';
/**
* Test showHint function.
*
*/
class PMA_showHint_test extends PHPUnit_Framework_TestCase
{
/**
* @var array temporary variable for globals array
*/
protected $tmpGlobals;
/**
* @var array temporary variable for session array
*/
protected $tmpSession;
/**
* storing globals and session
*/
public function setUp()
{
$this->tmpGlobals = $GLOBALS;
$this->tmpSession = $_SESSION;
}
/**
* recovering globals and session
*/
public function tearDown()
{
$GLOBALS = $this->tmpGlobals;
$_SESSION = $this->tmpSession;
}
/**
* PMA_showHint with defined GLOBALS
*/
public function testShowHintReturnValue()
{
$key = md5('test');
$nr = 1234;
$instance = 1;
$GLOBALS['footnotes'][$key]['nr'] = $nr;
$GLOBALS['footnotes'][$key]['instance'] = $instance;
$this->assertEquals(sprintf('<sup class="footnotemarker" id="footnote_sup_%d_%d">%d</sup>',
$nr, $instance + 1, $nr), PMA_showHint('test'));
}
/**
* PMA_showHint with defined GLOBALS formatted as BB
*/
public function testShowHintReturnValueBbFormat()
{
$key = md5('test');
$nr = 1234;
$instance = 1;
$GLOBALS['footnotes'][$key]['nr'] = $nr;
$GLOBALS['footnotes'][$key]['instance'] = $instance;
$this->assertEquals(sprintf('[sup]%d[/sup]', $nr),
PMA_showHint('test', true));
}
/**
* PMA_showHint with not defined GLOBALS
*/
public function testShowHintSetting()
{
$key = md5('test');
$nr = 1;
$instance = 1;
$this->assertEquals(sprintf('<sup class="footnotemarker" id="footnote_sup_%d_%d">%d</sup>', $nr, $instance, $nr), PMA_showHint('test', false, 'notice'));
$expArray = array(
'note' => 'test',
'type' => 'notice',
'nr' => count($GLOBALS['footnotes']),
'instance' => 1,
);
$this->assertEquals($expArray, $GLOBALS['footnotes'][$key]);
}
/**
* PMA_showHint with not defined GLOBALS formatted as BB
*/
public function testShowHintSettingBbFormat()
{
$key = md5('test');
$nr = 1;
$instance = 1;
$this->assertEquals(sprintf('[sup]%d[/sup]', $nr), PMA_showHint('test', true, 'notice'));
$expArray = array(
'note' => 'test',
'type' => 'notice',
'nr' => count($GLOBALS['footnotes']),
'instance' => 1,
);
$this->assertEquals($expArray, $GLOBALS['footnotes'][$key]);
}
/**
* PMA_showHint with defined GLOBALS using PMA_Message object
*/
public function testShowHintPmaMessageReturnValue()
{
$nr = 1;
$instance = 1;
$oMock = $this->getMock('PMA_Message',
array('setMessage', 'setNumber', 'getHash', 'getLevel'));
$oMock->setMessage('test');
$oMock->setNumber($nr);
$key = $oMock->getHash();
$GLOBALS['footnotes'][$key]['nr'] = $nr;
$GLOBALS['footnotes'][$key]['instance'] = $instance;
$this->assertEquals(sprintf('<sup class="footnotemarker" id="footnote_sup_%d_%d">%d</sup>',
$nr, $instance + 1, $nr), PMA_showHint($oMock));
}
/**
* PMA_showHint with not defined GLOBALS using PMA_Message object
*/
public function testShowHintPmaMessageSetting()
{
$nr = 1;
$instance = 1;
$oMock = $this->getMock('PMA_Message',
array('setMessage', 'setNumber', 'getHash', 'getLevel', 'getNumber'));
$oMock->setMessage('test');
$oMock->setNumber($nr);
$this->assertEquals(sprintf('<sup class="footnotemarker" id="footnote_sup_%d_%d">%d</sup>', $nr, $instance, $nr), PMA_showHint($oMock, false));
$key = $oMock->getHash();
$expArray = array(
'note' => $oMock,
'type' => $oMock->getLevel(),
'nr' => count($GLOBALS['footnotes']),
'instance' => 1,
);
$this->assertEquals($expArray, $GLOBALS['footnotes'][$key]);
}
}
?>

View File

@@ -1,134 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Test for several string operations
*
* @version $Id: PMA_stringOperations_test.php
*/
/**
* Tests core.
*/
require_once 'PHPUnit/Framework.php';
/**
* Include to test.
*/
require_once './libraries/common.lib.php';
/**
* Test string operations.
* @package phpMyAdmin-test
*/
class PMA_stringOperations_test extends PHPUnit_Framework_TestCase
{
/**
* temporary variable for globals array
*/
protected $tmpGlobals;
/**
* temporary variable for session array
*/
protected $tmpSession;
/**
* storing globals and session
*/
public function setUp() {
$this->tmpGlobals = $GLOBALS;
$this->tmpSession = $_SESSION;
}
/**
* data provider for flipstring test
*/
public function flipStringDataProvider() {
return array(
array('test', "t<br />\ne<br />\ns<br />\nt"),
array('te&nbsp;;st', "t<br />\ne<br />\n&nbsp;<br />\n;<br />\ns<br />\nt")
);
}
/**
* test of changing string from horizontal to vertical orientation
* @dataProvider flipStringDataProvider
*/
public function testFlipString($a, $e) {
$this->assertEquals($e, PMA_flipstring($a));
}
/**
* data provider for userDir test
*/
public function userDirDataProvider() {
return array(
array('/var/pma_tmp/%u/', "/var/pma_tmp/root/"),
array('/home/%u/pma', "/home/root/pma/")
);
}
/**
* test of generating user dir, globals are defined
* @dataProvider userDirDataProvider
*/
public function testUserDirString($a, $e) {
$GLOBALS['cfg']['Server']['user'] = 'root';
$this->assertEquals($e, PMA_userDir($a));
}
/**
* data provider for replace binary content test
*/
public function replaceBinaryContentsDataProvider() {
return array(
array("\x000", '\00'),
array("\x08\x0a\x0d\x1atest", '\b\n\r\Ztest'),
array("\ntest", '\ntest')
);
}
/**
* replace binary contents test
* @dataProvider replaceBinaryContentsDataProvider
*/
public function testReplaceBinaryContents($a, $e) {
$this->assertEquals($e, PMA_replace_binary_contents($a));
}
/**
* data provider for duplicate first newline test
*/
public function duplicateFirstNewlineDataProvider() {
return array(
array('test', 'test'),
array("\r\ntest", "\n\r\ntest"),
array("\ntest", "\ntest"),
array("\n\r\ntest", "\n\r\ntest")
);
}
/**
* duplicate first newline test
* @dataProvider duplicateFirstNewlineDataProvider
*/
public function testDuplicateFirstNewline($a, $e) {
$this->assertEquals($e, PMA_duplicateFirstNewline($a));
}
}
?>

View File

@@ -1,50 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for PMA_sanitize()
*
* @package phpMyAdmin-test
*/
/**
*
*/
require_once 'PHPUnit/Framework.php';
require_once './libraries/transformations.lib.php';
/**
* @package phpMyAdmin-test
*/
class PMA_transformation_getOptions_test extends PHPUnit_Framework_TestCase
{
public function testDefault()
{
$this->assertEquals(array('option1 ', ' option2 '),
PMA_transformation_getOptions("option1 , option2 "));
}
public function testQuoted()
{
$this->assertEquals(array('option1', ' option2'),
PMA_transformation_getOptions("'option1' ,' option2' "));
}
public function testComma()
{
$this->assertEquals(array('2,3', ' ,, option ,,'),
PMA_transformation_getOptions("'2,3' ,' ,, option ,,' "));
}
public function testEmptyOptions()
{
$this->assertEquals(array('', '', ''),
PMA_transformation_getOptions("'',,"));
}
public function testEmpty()
{
$this->assertEquals(array(),
PMA_transformation_getOptions(''));
}
}
?>

View File

@@ -1,71 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Test whichCrlf function
*
* @package phpMyAdmin-test
* @version $Id: PMA_whichCrlf_test.php
*/
/**
* Tests core.
*/
require_once 'PHPUnit/Framework.php';
/**
* Include to test.
*/
require_once './libraries/common.inc.php';
/**
* Test whichCrlf function.
*
*/
class PMA_whichCrlf_test extends PHPUnit_Framework_TestCase
{
/**
* @using runkit pecl extension
* if not define PMA_USR_OS, then define it as Win
* if installed runkit, then constant will not change
*/
public function testWhichCrlf()
{
$runkit = function_exists('runkit_constant_redefine');
if ($runkit && defined('PMA_USR_OS'))
$pma_usr_os = PMA_USR_OS;
if (defined('PMA_USR_OS') && !$runkit) {
if (PMA_USR_OS == 'Win')
$this->assertEquals("\r\n", PMA_whichCrlf());
else
$this->assertEquals("\n", PMA_whichCrlf());
$this->markTestIncomplete('Cannot redefine constant');
} else {
if ($runkit)
define('PMA_USR_OS', 'Linux');
$this->assertEquals("\n", PMA_whichCrlf());
if ($runkit)
runkit_constant_redefine('PMA_USR_OS', 'Win');
else
define('PMA_USR_OS', 'Win');
$this->assertEquals("\r\n", PMA_whichCrlf());
}
if ($runkit) {
if (isset($pma_usr_os))
runkit_constant_redefine('PMA_USR_OS', 'Win');
else
runkit_constant_remove('PMA_USR_OS');
}
}
}
?>

View File

@@ -1,20 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Selenium TestCase for login related tests
*
* @package phpMyAdmin-test
*/
require_once('PmaSeleniumTestCase.php');
class PmaSeleniumLoginTest extends PmaSeleniumTestCase
{
public function testLogin()
{
$this->doLogin();
$this->assertRegExp("/phpMyAdmin .*-dev/", $this->getTitle());
}
}
?>

View File

@@ -1,47 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Selenium TestCase for privilege related tests
*
* @package phpMyAdmin-test
*/
require_once('PmaSeleniumTestCase.php');
class PmaSeleniumPrivilegesTest extends PmaSeleniumTestCase
{
public function testChangePassword()
{
$this->doLogin();
$this->selectFrame("frame_content");
$this->click("link=Change password");
$this->waitForPageToLoad("30000");
try {
$this->assertEquals("", $this->getValue("text_pma_pw"));
} catch (PHPUnit_Framework_AssertionFailedError $e) {
array_push($this->verificationErrors, $e->toString());
}
try {
$this->assertEquals("", $this->getValue("text_pma_pw2"));
} catch (PHPUnit_Framework_AssertionFailedError $e) {
array_push($this->verificationErrors, $e->toString());
}
try {
$this->assertEquals("", $this->getValue("generated_pw"));
} catch (PHPUnit_Framework_AssertionFailedError $e) {
array_push($this->verificationErrors, $e->toString());
}
$this->click("button_generate_password");
$this->assertNotEquals("", $this->getValue("text_pma_pw"));
$this->assertNotEquals("", $this->getValue("text_pma_pw2"));
$this->assertNotEquals("", $this->getValue("generated_pw"));
$this->type("text_pma_pw", $this->cfg['Test']['testuser']['password']);
$this->type("text_pma_pw2", $this->cfg['Test']['testuser']['password']);
$this->click("change_pw");
$this->waitForPageToLoad("30000");
$this->assertTrue($this->isTextPresent(""));
$this->assertTrue($this->isTextPresent(""));
}
}
?>

View File

@@ -1,100 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Selenium parent class for TestCases
*
* @package phpMyAdmin-test
*/
// Optionally add the php-client-driver to your include path
set_include_path(get_include_path() . PATH_SEPARATOR . '/opt/selenium-remote-control-1.0.1/selenium-php-client-driver-1.0.1/PEAR/');
require_once 'PHPUnit/Framework/TestCase.php';
require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
require_once 'Testing/Selenium.php';
// Include the main phpMyAdmin user config
// currently only $cfg['Test'] is used
require_once '../config.inc.php';
class PmaSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase
{
protected $selenium;
protected $cfg;
// TODO: find a way to get this from config.inc.php???
// PHPUnit also has a way to use XML configuration... maybe we should use that
public static $browsers = array(
array(
'name' => 'Firefox on Windows XP',
'browser' => '*firefox',
'host' => 'my.windowsxp.box',
'port' => 4444,
'timeout' => 30000,
),
array(
'name' => 'Internet Explorer on Windows XP',
'browser' => '*iexplore',
'host' => 'my.windowsxp.box',
'port' => 4444,
'timeout' => 30000,
),
);
public function setUp()
{
global $cfg;
$this->cfg =& $cfg;
//PHPUnit_Extensions_SeleniumTestCase::$browsers = $this->cfg['Test']['broswers'];
// Check if the test configuration is available
if ( empty($cfg['Test']['pma_host'])
|| empty($cfg['Test']['pma_url'])
//|| empty($cfg['Test']['browsers'])
) {
$this->fail("Missing Selenium configuration in config.inc.php"); // TODO add doc ref?
}
$this->setBrowserUrl($cfg['Test']['pma_host'] . $cfg['Test']['pma_url']);
$this->start();
}
public function tearDown()
{
$this->stop();
}
/**
* perform a login
*/
public function doLogin()
{
$this->open($this->cfg['Test']['pma_url']);
// Somehow selenium does not like the language selection on the cookie login page, forced English in the config for now.
//$this->select("lang", "label=English");
$this->waitForPageToLoad("30000");
$this->type("input_username", $this->cfg['Test']['testuser']['username']);
$this->type("input_password", $this->cfg['Test']['testuser']['password']);
$this->click("input_go");
$this->waitForPageToLoad("30001");
}
/*
* Just a dummy to show some example statements
*
public function mockTest()
{
// Slow down the testing speed, ideal for debugging
//$this->setSpeed(4000);
}
*/
}
?>

View File

@@ -1,24 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Selenium TestCase for XSS related tests
*
* @package phpMyAdmin-test
*/
require_once('PmaSeleniumTestCase.php');
class PmaSeleniumXSSTest extends PmaSeleniumTestCase
{
public function testXssQueryTab()
{
$this->doLogin();
$this->selectFrame("frame_content");
$this->click("link=SQL");
$this->waitForPageToLoad("30000");
$this->type("sqlquery", "'\"><script>alert(123);</script>");
$this->click("SQL");
// If an alert pops up the test fails, since we don't handle an alert.
}
}
?>

View File

@@ -1,314 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* theme test
*
* @uses libraries/common.inc.php global fnctions
* @package phpMyAdmin-test
*/
chdir('..');
/**
* Gets core libraries and defines some variables
*/
require_once './libraries/common.inc.php';
$lang_iso_code = $GLOBALS['available_languages'][$GLOBALS['lang']][1];
// start output
header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="<?php echo $lang_iso_code; ?>"
lang="<?php echo $lang_iso_code; ?>"
dir="<?php echo $GLOBALS['text_dir']; ?>">
<head>
<title>phpMyAdmin <?php echo PMA_VERSION; ?> -
<?php echo htmlspecialchars($HTTP_HOST); ?> - Theme Test</title>
<meta http-equiv="Content-Type"
content="text/html; charset=<?php echo $GLOBALS['charset']; ?>" />
<link rel="stylesheet" type="text/css"
href="../phpmyadmin.css.php?<?php echo PMA_generate_common_url(); ?>&amp;js_frame=right&amp;nocache=<?php echo $GLOBALS['PMA_Config']->getThemeUniqueValue(); ?>" />
<link rel="stylesheet" type="text/css" media="print"
href="../print.css" />
<script src="../js/functions.js" type="text/javascript"></script>
</head>
<body>
<?php
$separator = '<span class="separator">'
.'<img class="icon" src=../"' . $GLOBALS['pmaThemeImage'] . 'item_ltr.png"'
.' width="5" height="9" alt="-" /></span>' . "\n";
$item = '<a href="%1$s?%2$s" class="item">'
.' <img class="icon" src="../' . $GLOBALS['pmaThemeImage'] . '%5$s"'
.' width="16" height="16" alt="" /> ' . "\n"
.'%4$s: %3$s</a>' . "\n";
echo '<div id="serverinfo">' . "\n";
printf($item,
$GLOBALS['cfg']['DefaultTabServer'],
PMA_generate_common_url(),
'Server',
__('Server'),
's_host.png');
echo $separator;
printf($item,
$GLOBALS['cfg']['DefaultTabDatabase'],
'',
'Database',
__('Database'),
's_db.png');
echo $separator;
printf($item,
$GLOBALS['cfg']['DefaultTabTable'],
'',
'Table',
(isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view']
? __('View')
: __('Table')),
(isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view']
? 'b_views'
: 's_tbl') . '.png');
echo '<span class="table_comment" id="span_table_comment">'
.'&quot;Table comment&quot</span>' . "\n";
echo '</div>';
/**
* Displays tab links
*/
$tabs = array();
$tabs['databases']['icon'] = '../../../../' . $pmaThemeImage . 's_db.png';
$tabs['databases']['link'] = 'server_databases.php';
$tabs['databases']['text'] = __('Databases');
$tabs['sql']['icon'] = '../../../../' . $pmaThemeImage . 'b_sql.png';
$tabs['sql']['link'] = 'server_sql.php';
$tabs['sql']['text'] = __('SQL');
$tabs['status']['icon'] = '../../../../' . $pmaThemeImage . 's_status.png';
$tabs['status']['link'] = 'server_status.php';
$tabs['status']['text'] = __('Status');
$tabs['vars']['icon'] = '../../../../' . $pmaThemeImage . 's_vars.png';
$tabs['vars']['link'] = 'server_variables.php';
$tabs['vars']['text'] = __('Variables');
$tabs['charset']['icon'] = '../../../../' . $pmaThemeImage . 's_asci.png';
$tabs['charset']['link'] = 'server_collations.php';
$tabs['charset']['text'] = __('Charsets');
$tabs['engine']['icon'] = '../../../../' . $pmaThemeImage . 'b_engine.png';
$tabs['engine']['link'] = 'server_engines.php';
$tabs['engine']['text'] = __('Engines');
$tabs['rights']['icon'] = '../../../../' . $pmaThemeImage . 's_rights.png';
$tabs['rights']['link'] = 'server_privileges.php';
$tabs['rights']['text'] = __('Privileges');
$tabs['binlog']['icon'] = '../../../../' . $pmaThemeImage . 's_tbl.png';
$tabs['binlog']['link'] = 'server_binlog.php';
$tabs['binlog']['text'] = __('Binary log');
$tabs['process']['icon'] = '../../../../' . $pmaThemeImage . 's_process.png';
$tabs['process']['link'] = 'server_processlist.php';
$tabs['process']['text'] = 'caution';
$tabs['process']['class'] = 'caution';
$tabs['export']['icon'] = '../../../../' . $pmaThemeImage . 'b_export.png';
$tabs['export']['text'] = 'disabled';
$tabs['export2']['icon'] = '../../../../' . $pmaThemeImage . 'b_export.png';
$tabs['export2']['text'] = 'disabled caution';
$tabs['export2']['class'] = 'caution';
$tabs['import']['icon'] = '../../../../' . $pmaThemeImage . 'b_import.png';
$tabs['import']['link'] = 'server_import.php';
$tabs['import']['text'] = 'active';
$tabs['import']['class'] = 'active';
echo PMA_generate_html_tabs($tabs, array());
unset($tabs);
if (@file_exists($pmaThemeImage . 'logo_right.png')) {
?>
<img id="pmalogoright" src="../<?php echo $pmaThemeImage; ?>logo_right.png"
alt="phpMyAdmin" />
<?php
}
?>
<h1>
<?php
echo sprintf(__('Welcome to %s'),
'<bdo dir="ltr" xml:lang="en">phpMyAdmin ' . PMA_VERSION . '</bdo>');
?>
</h1>
<hr class="clearfloat" />
<form method="post" action="theme.php" target="_parent">
<fieldset>
<legend><?php echo __('Theme / Style'); ?></legend>
<?php
echo $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox(false);
?>
<noscript><input type="submit" value="Go" style="vertical-align: middle" /></noscript>
</fieldset>
</form>
<hr />
<h1>H1 Header</h1>
<h2>H2 Header</h2>
<h3>H3 Header</h3>
<h4>H4 Header</h4>
<div class="success">
success message box content!
</div>
<div class="success">
<h1>Auccess message box header!</h1>
success message box content!
</div>
<div class="notice">
notice message box content!
</div>
<div class="notice">
<h1>Notice message box header!</h1>
notice message box content!
</div>
<div class="error">
error message box content!
</div>
<div class="error">
<h1>Error message box header!</h1>
error message box content!
</div>
<fieldset class="confirmation">
<legend>Confirmation fieldset</legend>
<tt>QUERY TO EXECUTE;</tt>
</fieldset>
<fieldset class="tblFooters">
<input type="submit" name="yes" value="YES" />
<input type="submit" name="no" value="NO" />
</fieldset>
<hr />
<div class="success">
success message box content!
</div>
<code class="sql">
<span class="syntax">
<span class="syntax_alpha syntax_alpha_reservedWord">SELECT</span> <span class="syntax_punct">*</span> <br />
<span class="syntax_alpha syntax_alpha_reservedWord">FROM</span> <span class="syntax_quote syntax_quote_backtick">`test`</span> <span class="syntax_white syntax_white_newline"></span><br />
<span class="syntax_alpha syntax_alpha_reservedWord">LIMIT</span> <span class="syntax_digit syntax_digit_integer">0</span><span class="syntax_punct syntax_punct_listsep">,</span> <span class="syntax_digit syntax_digit_integer">30</span>;<br />
<span class="syntax_alpha syntax_alpha_reservedWord">SELECT</span> <span class="syntax_punct">*</span> <br />
<span class="syntax_alpha syntax_alpha_reservedWord">FROM</span> <span class="syntax_quote syntax_quote_backtick">`test`</span> <span class="syntax_white syntax_white_newline"></span><br />
<span class="syntax_alpha syntax_alpha_reservedWord">LIMIT</span> <span class="syntax_digit syntax_digit_integer">0</span><span class="syntax_punct syntax_punct_listsep">,</span> <span class="syntax_digit syntax_digit_integer">30</span>;<br />
<span class="syntax_alpha syntax_alpha_reservedWord">SELECT</span> <span class="syntax_punct">*</span> <br />
<span class="syntax_alpha syntax_alpha_reservedWord">FROM</span> <span class="syntax_quote syntax_quote_backtick">`test`</span> <span class="syntax_white syntax_white_newline"></span><br />
<span class="syntax_alpha syntax_alpha_reservedWord">LIMIT</span> <span class="syntax_digit syntax_digit_integer">0</span><span class="syntax_punct syntax_punct_listsep">,</span> <span class="syntax_digit syntax_digit_integer">30</span>;<br />
<span class="syntax_alpha syntax_alpha_reservedWord">SELECT</span> <span class="syntax_punct">*</span> <br />
<span class="syntax_alpha syntax_alpha_reservedWord">FROM</span> <span class="syntax_quote syntax_quote_backtick">`test`</span> <span class="syntax_white syntax_white_newline"></span><br />
<span class="syntax_alpha syntax_alpha_reservedWord">LIMIT</span> <span class="syntax_digit syntax_digit_integer">0</span><span class="syntax_punct syntax_punct_listsep">,</span> <span class="syntax_digit syntax_digit_integer">30</span>;<br />
</span>
</code>
<div class="tools">
[
<a href="tbl_sql.php?db=test;table=test;sql_query=SELECT+%2A+FROM+%60test%60;show_query=1;token=266edabf70fa6368498d89b4054d01bf#querybox" onclick="window.parent.focus_querywindow('SELECT * FROM `test`'); return false;">Bearbeiten</a>
] [
<a href="import.php?db=test;table=test;sql_query=EXPLAIN+SELECT+%2A+FROM+%60test%60;token=266edabf70fa6368498d89b4054d01bf" >SQL erklären</a>
] [
<a href="import.php?db=test;table=test;sql_query=SELECT+%2A+FROM+%60test%60;show_query=1;show_as_php=1;token=266edabf70fa6368498d89b4054d01bf" >PHP-Code erzeugen</a>
] [
<a href="import.php?db=test;table=test;sql_query=SELECT+%2A+FROM+%60test%60;show_query=1;token=266edabf70fa6368498d89b4054d01bf" >Aktualisieren</a>
]</div>
<hr />
<table class="data">
<caption>table.data caption</caption>
<thead>
<tr><th></th>
<th>table.data thead tr th</th>
<th>table.data thead tr th</th>
<th colspan="3">action</th>
<th>table.data thead tr th</th>
</tr>
</thead>
<tfoot>
<tr><th></th>
<th>table.data tfoot tr th</th>
<th class="value">table.data tfoot tr th</th>
<th colspan="3">action</th>
<th>table.data tfoot tr th</th>
</tr>
</tfoot>
<tbody>
<tr class="odd">
<td><input type="checkbox" id="checkbox_1" name="checkbox_1"
value="1" /></td>
<th><label for="checkbox_1">th label</label></th>
<td class="value">td.value</td>
<td><img class="icon" src="../<?php echo $GLOBALS['cfg']['ThemePath']; ?>/original/img/bd_drop.png"
width="16" height="16" alt="drop" /></td>
<td><img class="icon" src="../<?php echo $GLOBALS['cfg']['ThemePath']; ?>/original/img/bd_drop.png"
width="16" height="16" alt="drop" /></td>
<td><img class="icon" src="../<?php echo $GLOBALS['cfg']['ThemePath']; ?>/original/img/bd_drop.png"
width="16" height="16" alt="drop" /></td>
<td>table.data tbody tr.odd td</td>
</tr>
<tr class="even">
<td><input type="checkbox" id="checkbox_2" name="checkbox_2"
value="1" /></td>
<th><label for="checkbox_2">th label</label></th>
<td class="value">td.value</td>
<td><img class="icon" src="../<?php echo $GLOBALS['cfg']['ThemePath']; ?>/original/img/bd_drop.png"
width="16" height="16" alt="drop" /></td>
<td><img class="icon" src="../<?php echo $GLOBALS['cfg']['ThemePath']; ?>/original/img/bd_drop.png"
width="16" height="16" alt="drop" /></td>
<td><img class="icon" src="../<?php echo $GLOBALS['cfg']['ThemePath']; ?>/original/img/bd_drop.png"
width="16" height="16" alt="drop" /></td>
<td>table.data tbody tr.even td</td>
</tr>
<tr class="odd">
<td><input type="checkbox" id="checkbox_3" name="checkbox_3"
value="1" /></td>
<th><label for="checkbox_3">th label</label></th>
<td class="value">td.value</td>
<td><img class="icon" src="../<?php echo $GLOBALS['cfg']['ThemePath']; ?>/original/img/bd_drop.png"
width="16" height="16" alt="drop" /></td>
<td><img class="icon" src="../<?php echo $GLOBALS['cfg']['ThemePath']; ?>/original/img/bd_drop.png"
width="16" height="16" alt="drop" /></td>
<td><img class="icon" src="../<?php echo $GLOBALS['cfg']['ThemePath']; ?>/original/img/bd_drop.png"
width="16" height="16" alt="drop" /></td>
<td>table.data tbody tr.odd td</td>
</tr>
<tr class="even">
<td><input type="checkbox" id="checkbox_4" name="checkbox_4"
value="1" /></td>
<th><label for="checkbox_4">th label</label></th>
<td class="value">td.value</td>
<td><img class="icon" src="../<?php echo $GLOBALS['cfg']['ThemePath']; ?>/original/img/bd_drop.png"
width="16" height="16" alt="drop" /></td>
<td><img class="icon" src="../<?php echo $GLOBALS['cfg']['ThemePath']; ?>/original/img/bd_drop.png"
width="16" height="16" alt="drop" /></td>
<td><img class="icon" src="../<?php echo $GLOBALS['cfg']['ThemePath']; ?>/original/img/bd_drop.png"
width="16" height="16" alt="drop" /></td>
<td>table.data tbody tr.even td</td>
</tr>
</tbody>
</table>
</body>
</html>

View File

@@ -1,18 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* runs all defined tests
*
* @package phpMyAdmin-test
*/
/**
*
*/
require_once 'AllTests.php';
echo '<pre>';
AllTests::main();
echo '</pre>';
?>