Remove collisions of session and global variables to allow register_globals

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@552 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2009-01-29 13:23:59 +00:00
parent 7805aaadac
commit 96eec31be0
2 changed files with 12 additions and 12 deletions

View file

@ -32,14 +32,14 @@ if ($_GET["start"]) {
}
if ($_GET["filename"]) {
$filename = basename($_GET["filename"]);
$coverage = $_SESSION["coverage"][realpath($filename)];
$cov = $_SESSION["coverage"][realpath($filename)];
$file = explode("<br />", highlight_file($filename, true));
unset($prev_color);
$s = "";
for ($l=0; $l <= count($file); $l++) {
$line = $file[$l];
$color = "#C0FFC0"; // tested
switch ($coverage[$l+1]) {
switch ($cov[$l+1]) {
case -1: $color = "#FFC0C0"; break; // untested
case -2: $color = "Silver"; break; // dead code
case null: $color = ""; break; // not executable
@ -63,11 +63,11 @@ if ($_GET["filename"]) {
echo "<table border='0' cellspacing='0' cellpadding='1'>\n";
foreach (glob("*.php") as $filename) {
if ($filename{0} != "_") {
$coverage = $_SESSION["coverage"][realpath($filename)];
$cov = $_SESSION["coverage"][realpath($filename)];
$ratio = 0;
if (isset($coverage)) {
$values = array_count_values($coverage);
$ratio = round(100 - 100 * $values[-1] / count($coverage));
if (isset($cov)) {
$values = array_count_values($cov);
$ratio = round(100 - 100 * $values[-1] / count($cov));
}
echo "<tr><td align='right' style='background-color: " . ($ratio < 50 ? "Red" : ($ratio < 75 ? "#FFEA20" : "#A7FC9D")) . ";'>$ratio%</td><td><a href='_coverage.php?filename=$filename'>$filename</a></td></tr>\n";
}

View file

@ -57,14 +57,14 @@ if (isset($langs[$_COOKIE["lang"]])) {
$accept_language[str_replace("_", "-", $match[1])] = (isset($match[3]) ? $match[3] : 1);
}
arsort($accept_language);
foreach ($accept_language as $lang => $q) {
if (isset($langs[$lang])) {
$LANG = $lang;
foreach ($accept_language as $key => $q) {
if (isset($langs[$key])) {
$LANG = $key;
break;
}
$lang = preg_replace('~-.*~', '', $lang);
if (!isset($accept_language[$lang]) && isset($langs[$lang])) {
$LANG = $lang;
$key = preg_replace('~-.*~', '', $key);
if (!isset($accept_language[$key]) && isset($langs[$key])) {
$LANG = $key;
break;
}
}