require_once('lib.php');
function print_tag($tag) {
if (!strncmp($tag, 'ffvaDB:ppl_id=', 14)) {
echo(''.entenc(sprint_singular(<<
unselect:');
foreach ($selected_tags as $stag) {
$dst = $path.'/';
foreach ($selected_tags as $otag) {
if ($stag == $otag) continue;
$dst .= $otag.'/';
}
print_tag_link($stag, NULL, 10, $dst);
}
echo('
'."\n");
array_pop($dir['files']);
foreach ($dir['files'] as $key => $row) {
$tijd[$key] = $row[1];
}
array_multisort($tijd, SORT_DESC, $dir['files']);
foreach ($dir['files'] as $row) {
foreach ($prefixen as $prefix) {
if (preg_match("/$prefix-(.+)/", $row[0], $matches)) {
//echo(''.entenc($path).'/../'.entenc($prefix).'/.thumb_'.entenc($matches[1]).''."\n");
echo(''."\n");
//print_r($matches);
break;
}
}
}
} else {
array_pop($dir['dir']);
foreach ($dir['dir'] as $key => $row) {
if (!$row) break;
$naam[$key] = $row[0];
}
array_multisort($naam, SORT_ASC, $dir['dir']);
foreach ($dir['dir'] as $row) {
if (!$row[1] || !$row[2]) continue;
print_tag_link($row[0], $row[2], some_log($row[2], $factor));
}
}
} else if ($_GET['name'] == 'do_tag.php') {
$photo = basename($_SERVER['HTTP_REFERER']);
if ($_SERVER['PHP_AUTH_USER'] == 'rsnel' || $_SERVER['PHP_AUTH_USER'] == 'mandy') {
if (!chdir('../tagmeister')) die('error');
if (preg_match('/^[a-zA-Z][a-zA-Z0-9.:=_]*/', $_POST['tag'])) {
if ($_POST['submit'] == 'Add tag') {
symlink($photo, $_POST['tag'].'/'.$photo);
} else if ($_POST['submit'] == 'Remove tag') {
unlink($_POST['tag'].'/'.$photo);
}
}
header('Location: '.$_SERVER['HTTP_REFERER']);
}
} else {
// requested file
$selected_tags = explode('/', $_GET['name']);
array_pop($selected_tags);
$dir = tagmeister_command('dir /'.dirname($_GET['name']).'/');
$factor = pow($dir['largest'], 1./$max);
$file = basename($_GET['name']);
$dirn = dirname($_GET['name']);
html_head(entenc($file));
//print_r($selected_tags);
array_pop($dir['files']);
foreach ($dir['files'] as $key => $row) {
$tijd[$key] = $row[1];
}
array_multisort($tijd, SORT_ASC, $dir['files']);
$prev = NULL;
$found = NULL;
$next = NULL;
$total = count($dir['files']);
$count = 0;
foreach ($dir['files'] as $cfile) {
if ($found) {
$next = $cfile[0];
break;
}
$count++;
if ($cfile[0] == $file) $found = $cfile[1];
else $prev = $cfile[0];
}
echo('nav: ');
if ($prev) echo('prev'."\n");
else echo('
prev'."\n");
echo('up'."\n");
if ($next) echo('next'."\n");
else echo('next'."\n");
echo("($count/$total)\n");
echo(' camera time: '.date(DATE_RFC1123, $found));
echo('
filter:');
array_pop($dir['tags']);
$tags = tagmeister_command("get_tags /{$_GET['name']}");
foreach ($dir['tags'] as $row) {
if (in_array($row[0], $tags)) print_tag_link($row[0], $row[1], some_log($row[1], $factor), './'.$row[0].'/'.$file);
}
echo('
unselect:');
foreach ($selected_tags as $stag) {
$dst = $path.'/';
foreach ($selected_tags as $otag) {
if ($stag == $otag) continue;
$dst .= $otag.'/';
}
print_tag_link($stag, NULL, 10, $dst == $path.'/'?$dst:$dst.$file);
}
$file = substr(strrchr('/'.$_GET['name'], '/'), 1);
foreach ($prefixen as $prefix) {
if (preg_match("/$prefix-(.+)/", $file, $matches)) {
echo('
'."\n");
//print_r($matches);
break;
}
}
if ($_SERVER['PHP_AUTH_USER'] == 'rsnel' || $_SERVER['PHP_AUTH_USER'] == 'mandy') { ?>