147 lines
5.8 KiB
PHP
147 lines
5.8 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
<title><?php gettext('View photos in Sqlite base'); ?></title>
|
|
|
|
<link rel="stylesheet" href="css/sls.css" />
|
|
<link rel='stylesheet' href='css/lc_lightbox.min.css' />
|
|
<link rel='stylesheet' href='css/open_close_fx.css' />
|
|
<link rel='stylesheet' href='css/minimal.css' />
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g==" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
|
|
|
<?php include 'functions.php';
|
|
session_start();
|
|
if($_SESSION['Active'] == false){ /* Redirects user to login.php if not logged in */
|
|
header("location:admin/login.php");
|
|
exit;
|
|
}
|
|
echo "_SESSION<br>";
|
|
_pr($_SESSION);
|
|
//echo $_SESSION['query'];
|
|
|
|
$domain = 'sentier';
|
|
localize($domain);
|
|
|
|
|
|
if (!empty($_POST)) {
|
|
/*
|
|
$_SESSION['query'] = $_POST;
|
|
echo "post query non vide";
|
|
echo gettype($_POST);
|
|
echo gettype($_SESSION['query']);
|
|
*/
|
|
#$liste = $_POST;
|
|
|
|
$liste = array_filter($_POST, function($key) {
|
|
return strpos($key, 'coche') === 0;
|
|
}, ARRAY_FILTER_USE_KEY);
|
|
|
|
if (count($liste) == 0) {
|
|
echo gettext('No image selected !');
|
|
header("location:view_bdd.php");
|
|
}
|
|
|
|
$r = "";
|
|
foreach ($liste as $key => $value) {
|
|
$r .= "filename LIKE '%" . $value . "' OR ";
|
|
}
|
|
$req = "WHERE " . substr($r, 0, -4);
|
|
}
|
|
?>
|
|
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
|
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h1><?php echo gettext('Edit database'); ?></h1>
|
|
|
|
<?php
|
|
|
|
$base = 'db_photo.sqlite3';
|
|
|
|
echo "<a href='close.php'> close session </a><br />";
|
|
|
|
|
|
$query = "SELECT * FROM photos " . $req . " ORDER BY id";
|
|
echo $query;
|
|
|
|
try {
|
|
$conn = new PDO('sqlite:db_photo.sqlite3');
|
|
$stmt = $conn->prepare($query);
|
|
$stmt->execute();
|
|
|
|
#$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
#$rowcount = count($result);
|
|
|
|
|
|
|
|
#_pr($result);
|
|
?>
|
|
|
|
|
|
|
|
<?php
|
|
echo '<form id="editImage" name="editImage" action="modify_bdd.php" method="post" class="myForm" >';
|
|
echo '<table class="styled-table">';
|
|
echo '<thead>';
|
|
echo '<th>' . gettext('Id') . '</th><th>' . gettext('Thumb') . '</th><th>' . gettext('Filename') . '</th><th>' . gettext('Date') . ' </th><th>' . gettext('Lens') . '</th><th>' . gettext('Speed') . '</th><th>' . gettext('Aperture') . '</th><th>' . gettext('Iso') . '</th><th>' . gettext('Width') . '</th><th>' . gettext('Height') . '</th>';
|
|
echo '<th>' . gettext('Model') . '</th><th>' . gettext('Latitude') . '</th><th>' . gettext('Longitude') . '</th><th>' . gettext('Alttitude') . '</th><th>' . gettext('Legende') . '</th><th>' . gettext('Copyright') . '</th><th>' . gettext('Title') . '</th>';
|
|
echo '<th>' . gettext('Creator') . '</th><th>' . gettext('Keywords') . '</th><th>' . gettext('Metering') . '</th><th>' . gettext('Flash') . '</th><th>' . gettext('Focal') . '</th><th>' . gettext('Wb') . '</th><th>' . gettext('Program') . '</th><th>' . gettext('Html') . '</th>';
|
|
echo '</thead>';
|
|
echo '<tbody>';
|
|
|
|
// lens legende copyright title creator keywords
|
|
$nRows = 0;
|
|
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
|
$thumbnail = host() . str_replace("photos/img", "photos/thumb", $row['filename']);
|
|
$full = host() . $row['filename'];
|
|
|
|
echo '<tr><td>' . $row['id'] . '</td><td>' . '<a href="' . $full . '"><img src="'.$thumbnail.'" /></a>' . '</td>';
|
|
echo '<td>' . $row['filename'] . '</td>';
|
|
echo '<td>' . $row['dateoriginal'] . '</td>';
|
|
echo '<td><input type="text" id="flens" name="flens" value="' . $row['lens'] . '" size=""></td>';
|
|
echo '<td>' . $row['speed'] . '</td><td>' . $row['aperture'] . '</td><td>' . $row['iso'] . '</td><td>' . $row['width'] . '</td><td>' . $row['height'] . '</td><td>' . $row['model'] . '</td>';
|
|
echo '<td>' . $row['lat'] . '</td><td>' . $row['long'] . '</td><td>' . $row['alt'] . '</td>';
|
|
echo '<td><input type="text" id="flegende" name="flegende" value="' . $row['legende'] . '" size=""></td>';
|
|
echo '<td><input type="text" id="fcopyright" name="fcopyright" value="' . $row['copyright'] . '" size=""></td>';
|
|
echo '<td><input type="text" id="ftitle" name="ftitle" value="' . $row['title'] . '" size=""></td>';
|
|
echo '<td><input type="text" id="fcreator" name="fcreator" value="' . $row['creator'] . '" size=""></td>';
|
|
echo '<td><input type="text" id="fkeywords" name="fkeywords" value="' . $row['keywords'] . '" size=""></td>';
|
|
echo '<td>' . $row['metering'] . '</td><td>' . $row['flash'] . '</td><td>' . $row['focal'] . '</td><td>' . $row['wb'] . '</td><td>' . $row['program'] . '</td><td>' . $row['html'] . '</td></tr>';
|
|
echo '<input type="hidden" id="fid" name="fid" value="' . $row['id'] . '">';
|
|
|
|
|
|
$nRows++;
|
|
}
|
|
|
|
echo '</tbody></table>';
|
|
echo '<button type="submit" name="update" value="update" class="myButton all">' . gettext('Update') . '</button>';
|
|
echo '</form>';
|
|
|
|
$conn = null;
|
|
|
|
}
|
|
catch(PDOException $e) {
|
|
echo $e->getMessage();
|
|
}
|
|
?>
|
|
|
|
<p class="navPage"><a href="index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></a> | <a href="maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="photo-du-mois.php" title="<?php echo gettext("Picture of the month"); ?>"><?php echo gettext("Picture of the month"); ?></a> | <a href="admin/index.php" title="<?php echo gettext("Admin"); ?>"><?php echo gettext("Admin"); ?></a></p>
|
|
|
|
<p><em><small>© 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
|
|
|
|
<script src='js/lc_lightbox.min.js' type='text/javascript'></script>
|
|
<script src='js/alloy_finger.min.js' type='text/javascript'></script>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|