if ($_SERVER['PHP_AUTH_USER'] != 'jeff' && $_SERVER['PHP_AUTH_USER'] != 'marina' )
{ die('no rights to read this page'); }
==== NAS : rsync Logs ====
// if(!defined('DOKU_INC')) define('DOKU_INC', dirname(__FILE__).'/');
require_once (DOKU_INC.'dev/tools.php');
$br = " \\\\ \n";
$d = "../save_log";
if ( array_key_exists('excl', $_GET) ) {
echo "write excl file \n\n";
writePagesFile('dev/data.txt', $_GET['excl']);
}
$excl = readPagesFile('dev/data.txt');
// if ( array_key_exists('excl', $_GET) && ($_GET['excl']!='') ) { $excl = '&excl='.urlencode($_GET['excl']); } // urlencode($v)
function createDirTab($d) {
$br = " \\\\ \n";
echo "Dir = ".$d.$br;
$dir = scandir($d);
echo "| date | ext | view | load |\n";
foreach ($dir as $key => $v) {
$totpath = $d."/".$v;
if (is_dir($totpath)) continue;
$ext = strtolower(strrchr($v, '.'));
$stat = stat($totpath);
echo '| '. date('Y-m-d H:i:s', $stat['mtime']) .' ';
echo '| '.$ext.' ';
echo '| [['.getUrl().getDokuScript().'?id='.getDokuID().'&file='.urlencode($v).'|'.htmlspecialchars($v).']] ';
echo '| [['.getUrl().'/'.$totpath.'|'.htmlspecialchars($v).']] ';
echo "|\n";
}
echo "\n\n";
}
$excl_arr = array();
if ($excl != '') {
$excl_arr = explode("\n", $excl);
foreach ($excl_arr as $k => & $v) {
$v = rtrim($v); // echo " * ".$k." ---> [".$v."]\n";
}
}
function isExcluded( $s, $excl_arr ) {
foreach ($excl_arr as $k => $v) {
if ($v[0]== '/') {
if (substr_compare('/'.$s, $v, 0, strlen($v)) === 0) return true;
} elseif ($v[0]== '@') {
// '@^("/\*,/)(.+)(/\*,/)(.+)(/\*,/)(.*)(/\*,/")@'
if (preg_match($v, '/'.$s, $matches) === 1) { return true; }
}
}
return false;
}
if ( !array_key_exists('file', $_GET) ) { createDirTab($d); }
else {
// echo '[['.getUrl().getDokuScript().'?id='.getDokuID().'|retour à la liste]]'.$br."\n\n";
echo '[['.getDokuID().'|retour à la liste]]'.$br."\n\n";
$totpath = $d."/".$_GET['file'];
echo "file path = ".$totpath.$br;
$h = @fopen($totpath, 'r');
$intab = false;
while ( ($line = fgets($h, 4096)) !== false ) {
if (preg_match('@^("/\*,/)(.+)(/\*,/)(.+)(/\*,/)(.*)(/\*,/")@', $line, $matches) === 1) {
if (!$intab) { echo "\n"; $intab=true; }
if (!isExcluded($matches[4], $excl_arr)) {
echo "| [".$matches[2]."] | ".$matches[4]." | ".$matches[6]." |\n";
}
} else {
if ($intab) { echo "\n"; $intab=false; }
echo " " . $line;
}
}
@fclose($h);
echo "\n\n";
}
$br = " \\\\ \n";
$excl = readPagesFile('dev/data.txt');
echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "
\n";
~~NOCACHE~~