0.7.3
This commit is contained in:
88
web/rtc.php
88
web/rtc.php
@@ -1,11 +1,24 @@
|
||||
<?
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Yuba RTC Browser
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
$icon_size = 64;
|
||||
$pad = 28;
|
||||
|
||||
?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
|
||||
div.container { display: flex; flex-flow: row wrap; justify-content: center; }
|
||||
div.item { width: 99px; height: 99px; padding: 20px; }
|
||||
div.item { width: <?=$icon_size+$pad;?>px; height: <?=$icon_size+$pad;?>px; padding: <?=$pad;?>px; word-wrap: break-word; }
|
||||
div.item { font-family: Helvetica; font-size: 11px; }
|
||||
img { width: 64px; height: 64px; }
|
||||
div.flexfill { width: <?=$icon_size+($pad*3);?>px; height: 1px; }
|
||||
img.thumb { padding: 6px; border: 1px solid gainsboro; }
|
||||
img { margin-bottom: 8px; }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
@@ -14,12 +27,20 @@ img { width: 64px; height: 64px; }
|
||||
|
||||
<?
|
||||
|
||||
////////////////////////////////////////////////
|
||||
// Yuba RTC Browser
|
||||
////////////////////////////////////////////////
|
||||
|
||||
// Functions
|
||||
|
||||
function breadcrumbs() { }
|
||||
|
||||
function shortlabel($filename, $max = 40) {
|
||||
$suffix = "(...).".pathinfo($filename)['extension'];
|
||||
if (strlen($filename) > $max) {
|
||||
$return = substr($filename, 0, ($max-strlen($suffix))).$suffix;
|
||||
} else {
|
||||
$return = $filename;
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
function findicon($filename) {
|
||||
$ext = pathinfo($filename)['extension'];
|
||||
if (!$ext) {
|
||||
@@ -35,24 +56,29 @@ function findicon($filename) {
|
||||
return $good;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
$db_file = $_GET['db'];
|
||||
$pid = $_GET['pid'];
|
||||
|
||||
if ($db_file) {
|
||||
|
||||
// Show a view
|
||||
// View
|
||||
|
||||
if (!is_readable($db_file)) { echo "can't read db file"; die; }
|
||||
|
||||
echo "<a href='?db='>index</a>";
|
||||
echo "<a href='?db='>db list</a>";
|
||||
|
||||
echo "<hr>";
|
||||
|
||||
$dbo = new PDO("sqlite:".$db_file);
|
||||
$dbo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
|
||||
|
||||
$array = $dbo->query("SELECT children FROM family WHERE (rowid=2)")->fetch()['children'];
|
||||
if (!$pid) {
|
||||
$array = $dbo->query("SELECT children FROM family WHERE (rowid=2)")->fetch()['children'];
|
||||
} else {
|
||||
$array = $dbo->query("SELECT children FROM family WHERE (pid='".$pid."')")->fetch()['children'];
|
||||
}
|
||||
|
||||
$children = unserialize($array);
|
||||
|
||||
@@ -62,26 +88,55 @@ if ($db_file) {
|
||||
echo "<hr>";
|
||||
|
||||
echo "\n<div class='container'>";
|
||||
dsf
|
||||
print_r($children);
|
||||
|
||||
foreach ($children as $key => $item) {
|
||||
if (count($children) < 1) { echo "dir is empty."; die; }
|
||||
|
||||
foreach ($children as $item) {
|
||||
|
||||
echo "<div class='item'>";
|
||||
|
||||
$row_a = $dbo->query("SELECT * FROM files WHERE (pid='".$item."')")->fetchAll()[0];
|
||||
|
||||
//$row_b = $dbo->query("SELECT * FROM mdls WHERE (pid='".$item."')")->fetchAll()[0];
|
||||
//$row_c = $dbo->query("SELECT * FROM milk WHERE (pid='".$item."')")->fetchAll()[0];
|
||||
|
||||
$icon = "<img src='".findicon($row_a['Filename'])."'>";
|
||||
if ($row_a['thumb_filename']) {
|
||||
$aspect = $row_a['thumb_width']/$row_a['thumb_height'];
|
||||
if ($aspect > 1) {
|
||||
$width = $icon_size;
|
||||
$height = $icon_size/$aspect;
|
||||
} else {
|
||||
$width = $icon_size*$aspect;
|
||||
$height = $icon_size;
|
||||
}
|
||||
$realfile = dirname($db_file).$row_a['thumb_filename'];
|
||||
$icon = "<img class='thumb' src='".$realfile."' width='".$width."' height='".$height."'>";
|
||||
} else {
|
||||
$icon = "<img class='icon' src='".findicon($row_a['Filename'])."' width='".$icon_size."' height='".$icon_size."'>";
|
||||
}
|
||||
|
||||
echo "\n<div class='item'>".$icon."<br>".htmlentities($row_a['Filename'])."</div>";
|
||||
|
||||
$name = htmlentities(shortlabel($row_a['Filename']));
|
||||
|
||||
if ($row_a['Type'] == "dir") {
|
||||
echo "\n<a href='?db=".$db_file."&pid=".$row_a['pid']."'>".$icon."</a><br>".$name;
|
||||
} else {
|
||||
echo $icon."<br>".$name;
|
||||
}
|
||||
|
||||
echo "</div>";
|
||||
echo "<br>";
|
||||
|
||||
}
|
||||
|
||||
|
||||
echo str_repeat("<div class='flexfill'></div>", 100);
|
||||
echo "\n</div>";
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
// DB List
|
||||
|
||||
$bundles = glob("skim/*.bundle");
|
||||
@@ -101,6 +156,7 @@ if ($db_file) {
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
echo "<hr><br>".round($time = microtime(true)-$_SERVER["REQUEST_TIME_FLOAT"],2)." seconds";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user