com web/doc: revcheck rewritten: include/lib_revcheck.inc .php www/revcheck.php

[email protected]
Newsgroups php.doc.web
Message-ID <[email protected]>
Commit:    cc2113bb79d2619f18ad16c12fb156945a74173b
Author:    Sobak <[email protected]>         Thu, 20 Mar 2014 18:53:32 +0100
Parents:   87e71fc492382a38e29471f1c1fb961140074e82
Branches:  master

Link:       http://git.php.net/?p=web/doc.git;a=commitdiff;h=cc2113bb79d2619f18ad16c12fb156945a74173b

Log:
revcheck rewritten

Changed paths:
  M  include/lib_revcheck.inc.php
  M  www/revcheck.php
diff_cc2113bb79d2619f18ad16c12fb156945a74173b.txt (text/plain, 35.8 KB)
diff --git a/include/lib_revcheck.inc.php b/include/lib_revcheck.inc.php
index 8e00965..e54bfa4 100644
--- a/include/lib_revcheck.inc.php
+++ b/include/lib_revcheck.inc.php
@@ -33,8 +33,6 @@ define("REV_NOTRANS",  6); // file without translation
 define("REV_CREDIT",   7); // only used in translators list
 define("REV_WIP",      8); // only used in translators list
 
-
-
 // Return an array of directory containing outdated files
 function get_dirs($idx, $lang)
 {
@@ -208,11 +206,10 @@ function revcheck_available_languages($idx)
 // Return en integer
 function get_nb_EN_files($idx)
 {
-    $sql = "select COUNT(*) as total FROM files WHERE lang = 'en'";
+    $sql = "SELECT COUNT(*) AS total FROM files WHERE lang = 'en'";
     $res = sqlite_query($idx, $sql);
     $row = sqlite_fetch_array($res, SQLITE_ASSOC);
-    $files_EN = $row['total'];
-    return $files_EN;
+    return $row['total'];
 }
 
 function get_missfiles($idx, $lang)
@@ -279,12 +276,21 @@ function get_oldfiles($idx, $lang)
     return $tmp;
 }
 
-function get_description($idx, $lang)
+function get_misstags($idx, $lang)
 {
-    $sql = 'SELECT intro FROM description WHERE lang = "' . $lang . '";';
+    $sql = 'SELECT
+     d.name AS dir, b.size AS en_size, a.size AS trans_size, a.name AS name
+     FROM files a, dirs d 
+     LEFT JOIN files b ON a.dir = b.dir AND a.name = b.name 
+     WHERE a.lang="'.$lang.'" AND b.lang="en" AND a.revision IS NULL 
+     AND a.size IS NOT NULL AND a.dir = d.id';
+
     $result = sqlite_query($idx, $sql);
-    $row = sqlite_fetch_array($result, SQLITE_ASSOC);
-    return $row['intro'];
+    while($row = sqlite_fetch_array($result, SQLITE_ASSOC)) {
+        $tmp[] = $row;
+    }
+
+    return $tmp;
 }
 
 // Return an integer
@@ -698,4 +704,9 @@ function get_stats_notag($idx, $lang)
     $r = sqlite_fetch_array($result, SQLITE_ASSOC);
     $result = array($r['total'], $r['size']);
     return $result;
+}
+
+function gen_date($file)
+{
+    return '<small>Generated: '.date('d M Y H:i:s', filemtime($file)).'</small>';
 }
\ No newline at end of file
diff --git a/www/revcheck.php b/www/revcheck.php
index 833533d..f22d932 100644
--- a/www/revcheck.php
+++ b/www/revcheck.php
@@ -2,150 +2,63 @@
 include '../include/init.inc.php';
 include '../include/lib_revcheck.inc.php';
 
-$LANG = LANGC;
-$language = $_GET['lang'];
-if (in_array($language, array_keys($LANGUAGES))) {
-    $language = 'en';
+if (isset($_GET['lang']) && in_array($_GET['lang'], array_keys($LANGUAGES))) { 
+	$lang = $_GET['lang']; 
+}
+else {
+	$lang = 'en';
+} 
+
+$lang_name = $LANGUAGES[$lang];
+
+if (isset($_GET['p'])) {
+	$tool = $_GET['p'];
 }
 
 $DBLANG = SQLITE_DIR . 'rev.php.sqlite';
-if (LANGC == 'en' ||LANGC == 'all') {
-	if ($dbhandle = @sqlite_open($DBLANG)) {
-		$langs = revcheck_available_languages($dbhandle);
-		if(!$langs) {
-			echo site_header('docweb.common.header.revcheck');
-		  ?>
-			<div class="ColoredDiv">
-			<h2 class="c">Status of the translated PHP Manual</h2>
-			<p class="c" style="font-size:12px;"><span class="Flag">
-			<?php 
-			if (LANGC != 'all') {
-				echo '<img src="/images/flags/' . LANGC .'.png" alt="'. LANGD . '" title="' . LANGD . '" />';
-			} ?></span> Language: <?php echo LANGD; ?> : This documentation don't exist yet.<br />
-			</p>
-		  </div>
-		  <?php
-		  echo site_footer();
-		  die();
-		} else {
-			echo site_header('docweb.common.header.revcheck');
-			echo "
-			<p class=\"c\">
-			<img src=\"/images/revcheck/info_revcheck_php_all_lang.png\" alt=\"Info\" />
-			</p>";
-			echo site_footer();
-			die();
-		}
-	} else {
-		echo site_header('docweb.common.header.revcheck');
-		echo "Couldn't connect to the revcheck database";
-		echo site_footer();
-		die();
+
+// Check if db connection can be established and if revcheck for requested lang exists
+if ($dbhandle = sqlite_open($DBLANG)) {
+	$sql = "SELECT charset FROM description WHERE lang = '$lang'";
+	if ($lang != 'en' && (!($res = sqlite_query($dbhandle, $sql)) || !sqlite_num_rows($res))) {
+		site_header();
+		echo "<p>This revision check doesn't exist yet.</p>";
+		site_footer();
+		die;
 	}
 }
-$sql = "SELECT charset FROM description WHERE lang='" . LANGC . "';";
-if (!($dbhandle = @sqlite_open($DBLANG)) || !($res = @sqlite_query($dbhandle, $sql)) || !sqlite_num_rows($res))
-{
-    // if there's no description, there's no documentation
-    echo site_header('docweb.common.header.revcheck');
-?>
-  <div class="ColoredDiv">
-  <h2 class="c">Status of the translated PHP Manual</h2>
-  <p class="c" style="font-size:12px;"><span class="Flag">
-  <?php 
-  if (LANGC != 'all') {
-      echo '<img src="/images/flags/' . LANGC .'.png" alt="'. LANGD . '" title="' . LANGD . '" />';
-  } ?></span> Language: <?php echo LANGD; ?><br />
-  </p>
-  </div>
-  <blockquote>
-  This revision check don't exist yet.
-  </blockquote>
-<?php
-echo site_footer();
-die;
+else {
+	site_header();
+	echo "<p>Database connection couldn't be established</p>";
+	site_footer();
+	die;
 }
-$charset = sqlite_fetch_single($res);
-define('ENCODING', $charset);
-sqlite_close($dbhandle);
-echo site_header('docweb.common.header.revcheck');
-if (isset($_GET['p'])) {
-    $PART = $_GET['p'];
-} else {
-    $PART = 'start';
-}
-
 
-// Colors used to mark files by status (colors for the above types)
-$CSS = array(
-REV_UPTODATE => "act",
-REV_NOREV    => "norev",
-REV_CRITICAL => "crit",
-REV_OLD      => "old",
-REV_NOTAG    => "wip",
-REV_NOTRANS  => "wip",
-REV_CREDIT   => "wip",
-REV_WIP      => "wip",
-);
-
-
-$file_types = array(
-array (REV_UPTODATE, "Up to date files"),
-array (REV_OLD,      "Old files"),
-array (REV_CRITICAL, "Critical files"),
-array (REV_WIP,      "Work in progress"),
-array (REV_NOREV,    "Files without revision number"),
-array (REV_NOTAG,    "Files without revision tag"),
-array (REV_NOTRANS,  "Files available for translation")
-);
-
-?>
-
-<div class="ColoredDiv">
-  <h2 class="c">Status of the translated PHP Manual</h2>
-  <p class="c" style="font-size:12px;">
-   Generated: <?php echo date("r", filemtime($DBLANG)); ?> &nbsp; / <span class="Flag"><img src="/images/flags/<?php echo LANGC; ?>.png" alt="<?php echo LANGD; ?>" title="<?php echo LANGD; ?>" /></span> Language: <?php echo LANGD; ?><br />
-  </p>
-</div>
- <ul>
-  <li<?php echo ($PART == 'intro' ) ? ' class="liSelected"' : ''; ?>><a href="<?php echo BASE_URL . '/revcheck.php?p=intro">Introduction</a>'; ?></li>
-  <li<?php echo ($PART == 'translators' ) ? ' class="liSelected"' : ''; ?>><a href="<?php echo BASE_URL . '/revcheck.php?p=translators">Translators</a>'; ?></li>
-  <li<?php echo ($PART == 'filesummary' ) ? ' class="liSelected"' : ''; ?>><a href="<?php echo BASE_URL . '/revcheck.php?p=filesummary">File summary by type</a>'; ?></li>
-  <li<?php echo ($PART == 'files' ) ? ' class="liSelected"' : ''; ?>><a href="<?php echo BASE_URL . '/revcheck.php?p=files">Files</a>'; ?></li>
-  <li<?php echo ($PART == 'misstags' ) ? ' class="liSelected"' : ''; ?>><a href="<?php echo BASE_URL . '/revcheck.php?p=misstags">Missing revision numbers</a>'; ?></li>
-  <li<?php echo ($PART == 'missfiles' ) ? ' class="liSelected"' : ''; ?>><a href="<?php echo BASE_URL . '/revcheck.php?p=missfiles">Untranslated files</a>'; ?></li>
-  <li<?php echo ($PART == 'oldfiles' ) ? ' class="liSelected"' : ''; ?>><a href="<?php echo BASE_URL . '/revcheck.php?p=oldfiles">Not in EN tree</a>'; ?></li>
-  <li<?php echo ($PART == 'graph' ) ? ' class="liSelected"' : ''; ?>><a href="<?php echo BASE_URL . '/revcheck.php?p=graph">Graph</a>'; ?></li>
- </ul>
-<?php
+site_header(true);
+switch($tool) {
+	case 'translators':
+		$translators = get_translators($dbhandle, $lang);
 
-if ($dbhandle = sqlite_open($DBLANG)) {
-    switch($PART) {
-        case 'translators' :
-
-        $translators = get_translators($dbhandle, $LANG);
-
-        $uptodate = translator_get_uptodate($dbhandle, $LANG);
-        $old      = translator_get_old($dbhandle, $LANG);
-        $critical = translator_get_critical($dbhandle, $LANG);
-        $wip      = translator_get_wip($dbhandle, $LANG);
-
-        foreach($translators as $nick =>$data) {
-            $files_w[$nick] = array('uptodate' => '', 'old' =>'', 'critical' => '', 'norev' => '', 'wip' => '');
-            $files_w[$nick]['uptodate'] = isset($uptodate[$nick]) ? $uptodate[$nick] : '';
-            $files_w[$nick]['wip'] = isset($wip[$nick]) ? $wip[$nick] : '';
-            $files_w[$nick]['old'] = isset($old[$nick]) ? $old[$nick] : '';
-            $files_w[$nick]['critical'] = isset($critical[$nick]) ? $critical[$nick] : '';
-        }
-
-        echo '<a name="translators"></a>';
-        if (empty($translators)) {
-            echo 'No translators info';
-        } else {
-            echo <<<TRANSLATORS_HEAD
-<div style="text-align:center"> <!-- Compatibility with old IE -->
-<table width="820" border="0" cellpadding="4" cellspacing="1" class="Tc">
-<tr class="blue">
+		if (empty($translators)) {
+			echo '<p>No translators info.</p>';
+		}
+		else {
+			$uptodate = translator_get_uptodate($dbhandle, $lang);
+			$old      = translator_get_old($dbhandle, $lang);
+			$critical = translator_get_critical($dbhandle, $lang);
+			$wip      = translator_get_wip($dbhandle, $lang);
+
+			foreach($translators as $nick =>$data) {
+				$files_w[$nick] = array('uptodate' => '', 'old' =>'', 'critical' => '', 'norev' => '', 'wip' => '');
+				$files_w[$nick]['uptodate'] = isset($uptodate[$nick]) ? $uptodate[$nick] : '';
+				$files_w[$nick]['wip'] = isset($wip[$nick]) ? $wip[$nick] : '';
+				$files_w[$nick]['old'] = isset($old[$nick]) ? $old[$nick] : '';
+				$files_w[$nick]['critical'] = isset($critical[$nick]) ? $critical[$nick] : '';
+			}
+
+			echo <<<TRANSLATORS_HEAD
+<table border="0" cellpadding="4" cellspacing="1">
+<tr>
 <th rowspan="2">Name</th>
 <th rowspan="2">Contact email</th>
 <th rowspan="2">Nick</th>
@@ -153,371 +66,344 @@ if ($dbhandle = sqlite_open($DBLANG)) {
 <th colspan="7">Files maintained</th>
 </tr>
 <tr>
-<th class="wip" style="color:#000000">cre-<br />dits</th>
-<th class="act" style="color:#000000">upto-<br />date</th>
-<th class="old" style="color:#000000">old</th>
-<th class="crit" style="color:#000000">cri-<br />tical</th>
-<th class="norev" style="color:#000000">no<br />rev</th>
-<th class="wip" style="color:#000000">wip</th>
-<th class="blue">sum</th>
+<th>upto-<br>date</th>
+<th>old</th>
+<th>cri-<br>tical</th>
+<th>wip</th>
+<th>sum</th>
 </tr>
 TRANSLATORS_HEAD;
-            $class = 'old';
-
-            foreach ($translators as $nick => $data) {
-                if ($data['svn'] == 'yes') {
-                    $svnu = 'x';
-                    $col = 'old';
-                } else {
-                    $svnu = '&nbsp;';
-                    $col = 'wip';
-                }
-                echo '<tr class="', $col, '">' . "\n";
-                echo '<td><a name="maint-'.$nick.'" href="'.BASE_URL. '/revcheck.php?p=files&amp;user='.$nick. '">'. $data['name'] . '</a></td>', "\n";
-                echo '<td>', $data['mail'], '</td>', "\n";
-                echo '<td>', $nick, '</td>', "\n";
-                echo '<td class="c">', $svnu, '</td>', "\n";
-                echo '<td class="c">&nbsp;</td>' ,
-                '<td class="c">' , @$files_w[$nick]['uptodate'], "</td>" ,
-                '<td class="c">' , @$files_w[$nick]['old'] , "</td>" ,
-                '<td class="c">' , $files_w[$nick]['critical'], "</td>" ,
-                '<td class="c">&nbsp;</td>' ,
-                '<td class="c">', $files_w[$nick]['wip'], '</td>' ,
-                '<th class="blue">' , @array_sum($files_w[$nick]), "</th>" , "\n";
-                echo '</tr>', "\n";
-            }
-            echo '</table>'."\n</div>";
-        }
-        break;
-
-        case 'missfiles' :
-        $missfiles = get_missfiles($dbhandle, $LANG);
-        if (!$missfiles) {
-            echo 'No missfile info';
-        } else {
-            $num = count($missfiles);
-            echo <<<MISSTAGS_HEAD
-<p>&nbsp;</p>
-<div style="text-align:center"> <!-- Compatibility with old IE -->
-<table width="400" border="0" cellpadding="3" cellspacing="1" class="Tc">
-        <tr class="blue">
-                <th rowspan="1">Available for translation ($num files):</th>
-                <th colspan="1">kB</th>
-        </tr>
-
-MISSTAGS_HEAD;
-
-            $last_dir = false;
-            $total_size = 0;
-            foreach ($missfiles as $miss) {
-                if (!$last_dir || $last_dir != $miss['dir']) {
-                    echo '<tr class="blue"><th colspan="2">' . $miss['dir'] . '</th></tr>';
-                    $last_dir = $miss['dir'];
-                }
-                echo '<tr class="wip"><td>', $miss['file'], '</td><td class="r">', $miss['size'], '</td></tr>';
-                $total_size += $miss['size'];
-                // flush every 200 kbytes
-                if (($total_size % 200) == 0) {
-                    flush();
-                }
-            }
-            echo '<tr class="blue">
-                      <th colspan="2">Total Size ('.$num.' files): '.$total_size.' kB</th>
-                  </tr>';
-            echo '</table></div>';
-        }
-        break;
-
-        case 'oldfiles' :
-        $oldfiles = get_oldfiles($dbhandle, $LANG);
-        if (!$oldfiles) {
-            echo 'No old file info';
-        } else {
-            $num = count($oldfiles);
-            echo <<<OLDTAGS_HEAD
-<p>&nbsp;</p>
-<div style="text-align:center"> <!-- Compatibility with old IE -->
-<table width="400" border="0" cellpadding="3" cellspacing="1" class="Tc">
-        <tr class="blue">
-                <th rowspan="1">Not in EN tree ($num files):</th>
-                <th colspan="1">kB</th>
-        </tr>
-
-OLDTAGS_HEAD;
-
-            $last_dir = false;
-            $total_size = 0;
-            foreach ($oldfiles as $old) {
-                if (!$last_dir || $last_dir != $old['dir']) {
-                    echo '<tr class="blue"><th colspan="2">' . $old['dir'] . '</th></tr>';
-                    $last_dir = $old['dir'];
-                }
-                echo '<tr class="wip"><td>', $old['file'], '</td><td class="r">', $old['size'], '</td></tr>';
-                $total_size += $old['size'];
-                // flush every 200 kbytes
-                if (($total_size % 200) == 0) {
-                    flush();
-                }
-            }
-            echo '<tr class="blue">
-                      <th colspan="2">Total Size ('.$num.' files): '.$total_size.' kB</th>
-                  </tr>';
-            echo '</table></div>';
-        }
-        break;
-
-        case 'misstags' :
-        $sql = 'select
-             d.name as dir, b.size as en_size, a.size as trans_size, a.name as name
-             from files a, dirs d 
-             left join files b on a.dir = b.dir and a.name = b.name 
-             where a.lang="' . $LANG .'" and b.lang="en" and a.revision is NULL 
-             and a.size is not NULL and a.dir = d.id';
-
-        $result = sqlite_query($dbhandle, $sql);
-        $num = sqlite_num_rows($result);
-        if ($num == 0) {
-            echo 'No misstags info';
-        } else {
-            echo <<<MISSTAGS_HEAD
-<p>&nbsp;</p>
-<div style="text-align:center"> <!-- Compatibility with old IE -->
-<table width="400" border="0" cellpadding="3" cellspacing="1" class="Tc">
-        <tr class="blue">
-                <th rowspan="2">Files without Revision-comment ($num files):</th>
-                <th colspan="3">Sizes in kB</th>
-        </tr>
-        <tr class="blue">
-                <th>en</th>
-                <th>$LANG</th>
-                <th>diff</th>
-        </tr>
-
-MISSTAGS_HEAD;
-
-            $last_dir = false;
-
-            while($row = sqlite_fetch_array($result, SQLITE_ASSOC)) {
-                if (!$last_dir || $last_dir != $row['dir']) {
-                    echo '<tr class="blue"><th colspan="4">' . $row['dir'] . '</th></tr>';
-                    $last_dir = $row['dir'];
-                }
-                echo '<tr class="wip"><td>', $row['name'], '</td><td class="r">', $row['en_size'], '</td><td class="r">', $row['trans_size'], '</td><td class="r">', (intval($row['en_size'] - $row['trans_size'])) ,'</td></tr>';
-            }
-            echo '</table></div>';
-        }
-        break;
-
-
-        case 'filesummary' :
-
-        $file_summary_array = array(
-        REV_UPTODATE => array(0,0),
-        REV_NOREV    => array(0,0),
-        REV_CRITICAL => array(0,0),
-        REV_OLD      => array(0,0),
-        REV_NOTAG    => array(0,0),
-        REV_NOTRANS  => array(0,0),
-        REV_CREDIT   => array(0,0),
-        REV_WIP      => array(0,0)
-        );
-
-
-        $file_summary_array[REV_WIP]      = get_stats_wip($dbhandle, $LANG);
-        $file_summary_array[REV_CRITICAL] = get_stats_critical($dbhandle, $LANG);
-        $file_summary_array[REV_UPTODATE] = get_stats_uptodate($dbhandle, LANGC);
-        $file_summary_array[REV_OLD]      = get_stats_old($dbhandle, $LANG);
-        $file_summary_array[REV_NOTAG]    = get_stats_notag($dbhandle, $LANG);
-        $file_summary_array[REV_NOTRANS]  = get_stats_notrans($dbhandle, $LANG);
-
-        echo <<<END_OF_MULTILINE
-<div style="text-align:center"> <!-- Compatibility with old IE -->
-<table width="450" border="0" cellpadding="4" cellspacing="1" class="Tc">
-<tr class="blue">
-<th>File status type</th>
-<th>Number of files</th>
-<th>Percent of files</th>
-<th>Size of files (kB)</th>
-<th>Percent of size</th>
-</tr>
-END_OF_MULTILINE;
 
-        $percent = array(0, 0);
-
-        foreach($file_summary_array as $t => $a) {
-            $percent[0] += $a[0];
-            $percent[1] += $a[1];
-        }
-
-        foreach ($file_types as $num => $type) {
-
-            $tmp_num_percent_0 = ($percent[0] == 0) ? 0 : number_format($file_summary_array[$type[0]][0] * 100 / $percent[0], 2 );
-            $tmp_num_percent_1 = ($percent[0] == 0) ? 0 : number_format($file_summary_array[$type[0]][1] * 100 / $percent[1], 2);
-
-
-            echo "<tr class=\"".$CSS[$type[0]]."\">".
-            "<td>".$type[1]."</td>".
-            "<td class=\"c\">" . $file_summary_array[$type[0]][0] . "</td>".
-            "<td class=\"c\">" . $tmp_num_percent_0 . "%</td>".
-            "<td class=\"c\">".$file_summary_array[$type[0]][1]."</td>".
-            "<td class=\"c\">" . $tmp_num_percent_1 . "%</td></tr>\n";
-        }
-
-        echo "<tr class=\"blue\"><th>Files total</th><th>$percent[0]</th><th>100%</th><th>" . $percent[1] . "</th><th>100%</th></tr>\n".
-        "</table></div>\n<p>&nbsp;</p>\n";
-
-        break;
-
-
-        case 'files' :
-        // we need a dir to browse
-        $dirs = get_dirs($dbhandle, $LANG);
-        $users = get_translators($dbhandle, $LANG);
-
-        if (empty($dirs)) {
-            echo 'No files';
-        } else {
-            echo '<p>Choose a directory :</p>';
-            echo '<form method="get" action="' . BASE_URL . '/revcheck.php?p=files"><p><select name="dir">';
-            foreach ($dirs as $id => $name) {
-                if (isset($_GET['dir']) && $_GET['dir'] == $id) {
-                    $selected = ' selected="selected"';
-                } else {
-                    $selected = '';
-                }
-                echo '<option value="' . $id . '"' . $selected . '>' . $name . '</option>' . "\n";
-            }
-            echo '</select><input type="hidden" name="p" value="files" /><input type="submit" value="See outdated files" /></p></form>';
-            
-            echo '<p>Or choose a translator :</p>';
-            echo '<form method="get" action="' . BASE_URL . '/revcheck.php?p=files"><p><select name="user">';
-            foreach ($users as $id => $user) {
-                if (isset($_GET['user']) && $_GET['user'] == $id) {
-                    $selected = ' selected="selected"';
-                } else {
-                    $selected = '';
-                }
-                echo '<option value="' . $id . '"' . $selected . '>' . $id . '</option>' . "\n";
-            }
-            echo '</select><input type="hidden" name="p" value="files" /><input type="submit" value="See outdated files" /></p></form>';
-        }
-
-        if (!empty($dirs) && (isset($_GET['dir']) || isset($_GET['user']))) {
-            if (isset($_GET['user'])) {
-                $outdated = get_outdated_translator_files($dbhandle, $LANG, $_GET['user']);
-            } else {
-                $outdated = get_outdated_files($dbhandle, $LANG, $_GET['dir']);
-            }
-            if (empty($outdated)) {
-                echo 'No files info';
-            } else {
-                echo <<<END_OF_MULTILINE
-<div style="text-align:center"> <!-- Compatibility with old IE -->
-<table width="820" border="0" cellpadding="4" cellspacing="1" class="Tc">
-  <tr class="blue">
-    <th rowspan="2">Translated file</th>
-    <th colspan="2">Revision</th>
-    <th colspan="3">Size in kB</th>
-    <th colspan="3">Age in days</th>
-    <th rowspan="2">Maintainer</th>
-    <th rowspan="2">Status</th>
-  </tr>
-  <tr class="blue">
-    <th>en</th>
-    <th>$LANG</th>
-    <th>en</th>
-    <th>$LANG</th>
-    <th>diff</th>
-    <th>en</th>
-    <th>$LANG</th>
-    <th>diff</th>
-  </tr>
-  <tr class="blue"><th colspan="12">{$outdated[0]['name']}</th></tr>
+			foreach ($translators as $nick => $data) {
+				$svn = ($data['svn'] == 'yes') ? '✓' : '&nbsp;';
+
+				echo '<tr>',
+				'<td><a href="/revcheck.php?p=files&amp;user='.$nick.'">'.$data['name'].'</a></td>',
+				'<td>', $data['mail'], '</td>',
+				'<td>', $nick, '</td>',
+				'<td>', $svn, '</td>',
+				'<td>' , @$files_w[$nick]['uptodate'], '</td>',
+				'<td>' , @$files_w[$nick]['old'], '</td>',
+				'<td>' , $files_w[$nick]['critical'], '</td>',
+				'<td>', $files_w[$nick]['wip'], '</td>',
+				'<th>' , @array_sum($files_w[$nick]), '</th>',
+				'</tr>';
+			}
+			echo '</table>';
+		}
+		echo gen_date($DBLANG);
+	break;
 
-END_OF_MULTILINE;
-                $last_dir = false;
-                $prev_name = $outdated[0]['name'];
-
-                foreach ($outdated as $r) {
-                    if ($r['name'] != $prev_name) {
-                       echo '<tr class="blue"><th colspan="12">'.$r['name'].'</th></tr>';
-                       $prev_name = $r['name'];
-                    }
-                    $r['en_date'] = intval((time() - $r['en_date']) / 86400);
-                    $r['trans_date'] = intval((time() - $r['trans_date']) / 86400);
-                    // Make decision on file category by revision, date and size
-                    $rev_diff  = intval($r['en_rev']) - intval($r['trans_rev']);
-                    $size_diff = intval($r['en_size']) - intval($r['trans_size']);
-                    $date_diff = $r['en_date'] - $r['trans_date'];
-                    if ($r['trans_rev'] === 'n/a') {
-                        $status_mark = REV_NOREV;
-                    } else if ($rev_diff > 0 || $size_diff >= ALERT_SIZE || $date_diff <= ALERT_DATE) {
-                        $status_mark = REV_CRITICAL;
-                    } else {
-                        // We need a value here for the CSS, default to 'old'
-                        $status_mark = REV_OLD;
-                    }
-
-                    // Make the maintainer a link, if we have that maintainer in the list
-                    if ($r['maintainer'] && $r["maintainer"] != 'nobody') {
-                        $r["maintainer"] = '<a href="?p=translators#maint-' . $r['maintainer'] . '">' . $r["maintainer"] . '</a>';
-                    }
-
-                    // If we have a 'numeric' revision diff and it is not zero,
-                    // make a link to the SVN repository's diff script
-                    if ($r['trans_rev'] !== 'n/a') {
-                        $r['short_name'] = '<a href="http://svn.php.net/viewvc/' .
-                        $PROJECTS[$project][2] . '/trunk/' . $r['name'] . '/' . $r['file'] .
-                        "?r1=" . $r["trans_rev"] .
-                        "&amp;r2=" . $r["en_rev"] .
-                        '&amp;view=patch">' . $r['file'] . '</a>';
-
-                        // Add a [NoWS] link
-                        $r['short_name'] .= ' <a href="http://svn.php.net/viewvc/' .
-                        $PROJECTS[$project][2] . '/trunk/' . $r['name'] . '/' . $r['file'] .
-                        '?r1=' . $r['trans_rev'] .
-                        '&amp;r2=' . $r['en_rev'] .
-                        '">[NoWS]</a>';
-                    } else {
-                        $r['short_name'] = $r['file'];
-                    }
-
-
-
-                    // Write out the line for the current file (get file name shorter)
-                    echo "<tr class=\"{$CSS[$status_mark]}\">".
-                    "<td>{$r['short_name']}</td>".
-                    "<td>{$r['en_rev']}</td>" .
-                    "<td>{$r['trans_rev']}</td>" .
-                    "<td> {$r['en_size']}</td>" .
-                    "<td> {$r['trans_size']}</td>" .
-                    "<td align=\"right\"><strong>" . $size_diff . "</strong></td>" .
-                    "<td> {$r['en_date']}</td>" .
-                    "<td> {$r['trans_date']}</td>" .
-                    "<td align=\"right\"><strong>" . $date_diff . "</strong></td>" .
-                    "<td> {$r['maintainer']}</td>" .
-                    "<td> {$r['status']}</td></tr>\n";
-
-                }
-                echo '</table></div>';
-}
-}
-break;
-
-case "graph" :
-if (is_readable("images/revcheck/info_revcheck_php_" . LANGC . ".png")) {
-    echo "<p class=\"c\">
-                <img src=\"/images/revcheck/info_revcheck_php_" . LANGC . ".png\" alt=\"Info\" />
-                </p>";
-} else {
-    echo 'Can\'t find graph';
-}
-break;
+	case 'missfiles':
+		$missfiles = get_missfiles($dbhandle, $lang);
+		if (!$missfiles) {
+			echo '<p>No missfile info.</p>';
+		}
+		else {
+			$num = count($missfiles);
+			echo '<table border="0" cellpadding="3" cellspacing="1" style="text-align:center">';
+			echo '<tr><th rowspan="1">Available for translation ('.$num.' files):</th><th colspan="1">kB</th></tr>';
+
+			$last_dir = false;
+			$total_size = 0;
+			foreach ($missfiles as $miss) {
+				if (!$last_dir || $last_dir != $miss['dir']) {
+					echo '<tr><th colspan="2">'.$miss['dir'].'</th></tr>';
+					$last_dir = $miss['dir'];
+				}
+				echo '<tr><td>'.$miss['file'].'</td><td>'.$miss['size'].'</td></tr>';
+				$total_size += $miss['size'];
+				// flush every 200 kbytes
+				if (($total_size % 200) == 0) {
+					flush();
+				}
+			}
+			echo '<tr><th colspan="2">Total Size ('.$num.' files): '.$total_size.' kB</th></tr>';
+			echo '</table>';
+		}
+		echo gen_date($DBLANG);
+	break;
+
+	case 'oldfiles':
+		$oldfiles = get_oldfiles($dbhandle, $lang);
+		if (!$oldfiles) {
+			echo '<p>No old files info.</p>';
+		}
+		else {
+			$num = count($oldfiles);
+			echo '<table width="400" border="0" cellpadding="3" cellspacing="1" style="text-align:center">';
+			echo '<tr><th rowspan="1">Not in EN tree ('.$num.' files):</th><th colspan="1">kB</th></tr>';
+
+			$last_dir = false;
+			$total_size = 0;
+			foreach ($oldfiles as $old) {
+				if (!$last_dir || $last_dir != $old['dir']) {
+					echo '<tr><th colspan="2">'.$old['dir'].'</th></tr>';
+					$last_dir = $old['dir'];
+				}
+				echo '<tr><td>', $old['file'], '</td><td class="r">'.$old['size'].'</td></tr>';
+				$total_size += $old['size'];
+				// flush every 200 kbytes
+				if (($total_size % 200) == 0) {
+					flush();
+				}
+			}
+			echo '<tr><th colspan="2">Total Size ('.$num.' files): '.$total_size.' kB</th></tr>';
+			echo '</table>';
+		}
+		echo gen_date($DBLANG);
+	break;
+
+	case 'misstags':
+		$misstags = get_misstags($dbhandle, $lang);
+		$num = count($misstags);
+		if (!$num) {
+			echo 'No misstags info';
+		}
+		else {
+			echo '<table border="0" cellpadding="3" cellspacing="1" style="text-align:center">';
+			echo '<tr><th rowspan="2">Files without Revision-comment ('.$num.' files):</th><th colspan="3">Sizes in kB</th></tr>';
+			echo '<tr><th>en</th><th>'.$lang.'</th><th>diff</th></</tr>';
+
+			$last_dir = false;
+
+			foreach ($misstags as $row) {
+				if (!$last_dir || $last_dir != $row['dir']) {
+					echo '<tr><th colspan="4">'.$row['dir'].'</th></tr>';
+					$last_dir = $row['dir'];
+				}
+				echo '<tr><td>'.$row['name'].'</td><td>'.$row['en_size'].'</td><td>'.$row['trans_size'].'</td><td>'.(intval($row['en_size'] - $row['trans_size'])).'</td></tr>';
+			}
+			echo '</table>';
+		}
+		echo gen_date($DBLANG);
+	break;
+
+
+	case 'filesummary':
+		$file_types = array(
+			array (REV_UPTODATE, 'Up to date files'),
+			array (REV_OLD,      'Old files'),
+			array (REV_CRITICAL, 'Critical files'),
+			array (REV_WIP,      'Work in progress'),
+			array (REV_NOREV,    'Files without revision number'),
+			array (REV_NOTAG,    'Files without revision tag'),
+			array (REV_NOTRANS,  'Files available for translation')
+		);
+	
+		$file_summary_array = array(
+			REV_UPTODATE => array(0,0),
+			REV_NOREV    => array(0,0),
+			REV_CRITICAL => array(0,0),
+			REV_OLD      => array(0,0),
+			REV_NOTAG    => array(0,0),
+			REV_NOTRANS  => array(0,0),
+			REV_CREDIT   => array(0,0),
+			REV_WIP      => array(0,0)
+		);
+
+		$file_summary_array[REV_WIP]      = get_stats_wip($dbhandle, $lang);
+		$file_summary_array[REV_CRITICAL] = get_stats_critical($dbhandle, $lang);
+		$file_summary_array[REV_UPTODATE] = get_stats_uptodate($dbhandle, $lang);
+		$file_summary_array[REV_OLD]      = get_stats_old($dbhandle, $lang);
+		$file_summary_array[REV_NOTAG]    = get_stats_notag($dbhandle, $lang);
+		$file_summary_array[REV_NOTRANS]  = get_stats_notrans($dbhandle, $lang);
+
+		echo '<table border="0" cellpadding="4" cellspacing="1" style="text-align:center;">';
+		echo '<tr><th>File status type</th><th>Number of files</th><th>Percent of files</th><th>Size of files (kB)</th><th>Percent of size</th></tr>';
+
+		$percent = array(0, 0);
+
+		foreach($file_summary_array as $t => $a) {
+			$percent[0] += $a[0];
+			$percent[1] += $a[1];
+		}
+
+		foreach ($file_types as $num => $type) {
+			$tmp_num_percent_0 = ($percent[0] == 0) ? 0 : number_format($file_summary_array[$type[0]][0] * 100 / $percent[0], 2 );
+			$tmp_num_percent_1 = ($percent[0] == 0) ? 0 : number_format($file_summary_array[$type[0]][1] * 100 / $percent[1], 2);
+
+			echo '<tr>';
+			echo '<td>'.$type[1].'</td>';
+			echo '<td>'.$file_summary_array[$type[0]][0].'</td>';
+			echo '<td>'.$tmp_num_percent_0.'%</td>';
+			echo '<td>'.$file_summary_array[$type[0]][1].'</td>';
+			echo '<td>'.$tmp_num_percent_1.'%</td>';
+			echo '</tr>';
+		}
+
+		echo '<tr><th>Files total</th><th>'.$percent[0].'</th><th>100%</th><th>'.$percent[1].'</th><th>100%</th></tr>';
+		echo '</table>';
+		echo gen_date($DBLANG);
+	break;
 
-default :
-echo '<p>' . get_description($dbhandle, $LANG) . '</p>';
-break;
-    }
+
+	case 'files' :
+		// we need a dir to browse
+		$dirs = get_dirs($dbhandle, $lang);
+		$users = get_translators($dbhandle, $lang);
+
+		if (empty($dirs)) {
+			echo '<p>No files</p>';
+		}
+		else {
+			echo '<p>Choose a directory:</p>';
+			echo '<form method="get" action="revcheck.php?p=files&amp;lang='.$lang.'"><p><select name="dir">';
+			foreach ($dirs as $id => $name) {
+				if (isset($_GET['dir']) && $_GET['dir'] == $id) {
+					$selected = ' selected="selected"';
+				}
+				else {
+					$selected = '';
+				}
+				echo '<option value="'.$id.'"'.$selected.'>'.$name.'</option>';
+			}
+			echo '</select><input type="hidden" name="p" value="files"><input type="submit" value="See outdated files"></p></form>';
+			
+			echo '<p>Or choose a translator:</p>';
+			echo '<form method="get" action="revcheck.php?p=files&amp;lang='.$lang.'"><p><select name="user">';
+			foreach ($users as $id => $user) {
+				if (isset($_GET['user']) && $_GET['user'] == $id) {
+					$selected = ' selected="selected"';
+				}
+				else {
+					$selected = '';
+				}
+				echo '<option value="'.$id.'"'.$selected.'>'.$id.'</option>';
+			}
+			echo '</select><input type="hidden" name="p" value="files"><input type="submit" value="See outdated files"></p></form>';
+		}
+
+		if (!empty($dirs) && (isset($_GET['dir']) || isset($_GET['user']))) {
+			if (isset($_GET['user'])) {
+				$outdated = get_outdated_translator_files($dbhandle, $lang, $_GET['user']);
+			}
+			else {
+				$outdated = get_outdated_files($dbhandle, $lang, $_GET['dir']);
+			}
+			if (empty($outdated)) {
+				echo 'No files info';
+			}
+			else {
+				echo <<<END_OF_MULTILINE
+	<table border="0" cellpadding="4" cellspacing="1" style="text-align:center">
+	<tr>
+	<th rowspan="2">Translated file</th>
+	<th colspan="2">Revision</th>
+	<th colspan="3">Size in kB</th>
+	<th colspan="3">Age in days</th>
+	<th rowspan="2">Maintainer</th>
+	<th rowspan="2">Status</th>
+	</tr>
+	<tr>
+	<th>en</th>
+	<th>$lang</th>
+	<th>en</th>
+	<th>$lan</th>
+	<th>diff</th>
+	<th>en</th>
+	<th>$lang</th>
+	<th>diff</th>
+	</tr>
+	<tr><th colspan="12">{$outdated[0]['name']}</th></tr>
+END_OF_MULTILINE;
+				$last_dir = false;
+				$prev_name = $outdated[0]['name'];
+
+				foreach ($outdated as $r) {
+					if ($r['name'] != $prev_name) {
+					   echo '<tr><th colspan="12">'.$r['name'].'</th></tr>';
+					   $prev_name = $r['name'];
+					}
+					$r['en_date'] = intval((time() - $r['en_date']) / 86400);
+					$r['trans_date'] = intval((time() - $r['trans_date']) / 86400);
+					// Make decision on file category by revision, date and size
+					$rev_diff  = intval($r['en_rev']) - intval($r['trans_rev']);
+					$size_diff = intval($r['en_size']) - intval($r['trans_size']);
+					$date_diff = $r['en_date'] - $r['trans_date'];
+					if ($r['trans_rev'] === 'n/a') {
+						$status_mark = REV_NOREV;
+					}
+					elseif ($rev_diff > 0 || $size_diff >= ALERT_SIZE || $date_diff <= ALERT_DATE) {
+						$status_mark = REV_CRITICAL;
+					}
+					else {
+						// We need a value here for the CSS, default to 'old'
+						$status_mark = REV_OLD;
+					}
+
+					// Make the maintainer a link, if we have that maintainer in the list
+					if ($r['maintainer'] && $r["maintainer"] != 'nobody') {
+						$r["maintainer"] = '<a href="?p=translators#maint-' . $r['maintainer'] . '">' . $r["maintainer"] . '</a>';
+					}
+
+					// If we have a 'numeric' revision diff and it is not zero,
+					// make a link to the SVN repository's diff script
+					if ($r['trans_rev'] !== 'n/a') {
+						$r['short_name'] = '<a href="http://svn.php.net/viewvc/' .
+						$PROJECTS[$project][2] . '/trunk/' . $r['name'] . '/' . $r['file'] .
+						"?r1=" . $r["trans_rev"] .
+						"&amp;r2=" . $r["en_rev"] .
+						'&amp;view=patch">' . $r['file'] . '</a>';
+
+						// Add a [NoWS] link
+						$r['short_name'] .= ' <a href="http://svn.php.net/viewvc/' .
+						$PROJECTS[$project][2] . '/trunk/' . $r['name'] . '/' . $r['file'] .
+						'?r1=' . $r['trans_rev'] .
+						'&amp;r2=' . $r['en_rev'] .
+						'">[NoWS]</a>';
+					}
+					else {
+						$r['short_name'] = $r['file'];
+					}
+
+					// Write out the line for the current file (get file name shorter)
+					echo '<tr>'.
+					"<td>{$r['short_name']}</td>".
+					"<td>{$r['en_rev']}</td>" .
+					"<td>{$r['trans_rev']}</td>" .
+					"<td> {$r['en_size']}</td>" .
+					"<td> {$r['trans_size']}</td>" .
+					"<td align=\"right\"><strong>" . $size_diff . "</strong></td>" .
+					"<td> {$r['en_date']}</td>" .
+					"<td> {$r['trans_date']}</td>" .
+					"<td align=\"right\"><strong>" . $date_diff . "</strong></td>" .
+					"<td> {$r['maintainer']}</td>" .
+					"<td> {$r['status']}</td></tr>\n";
+
+				}
+				echo '</table>';
+			}
+		}
+		echo gen_date($DBLANG);
+	break;
+
+	case 'graph':
+		$path = "images/revcheck/info_revcheck_php_$lang.png";
+		if (is_readable($path)) {
+			echo '<img src="'.$path.'" alt="info">';
+			echo gen_date($DBLANG);
+		}
+		else {
+			echo "<p>Can't find graph.</p>";
+		}
+	break;
+
+	default:
+		if ($lang == 'en') {
+			echo '<img src="images/revcheck/info_revcheck_php_all_lang.png" alt="Info" class="chart">';
+			echo '<p>This is all what we can show for original manual. To get more tools, please select translation language.</p>';
+			$sidebar = nav_languages();
+			site_footer($sidebar);
+		}
+		else {
+			echo '<p>Please choose a specified tool from the right side.</p>';
+		}
+		echo gen_date($DBLANG);
+	break;
 }
 
-echo site_footer();
\ No newline at end of file
+if ($lang != 'en') {
+	$sidebar = nav_tools($lang);
+	site_footer($sidebar);
+}
\ No newline at end of file
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.