Compare commits
10 Commits
V2
...
b35196fdb8
| Author | SHA1 | Date | |
|---|---|---|---|
| b35196fdb8 | |||
| 55bedea648 | |||
| ec0ab53cb2 | |||
| bfda660a2f | |||
| 59de54758d | |||
| db9f05f6f6 | |||
| 3ee1a9eaf6 | |||
| f056c8a9a0 | |||
| 9665a355be | |||
| 4c22f27eb6 |
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
1
Locale/fr_FR/LC_MESSAGES/nocache
Symbolic link
1
Locale/fr_FR/LC_MESSAGES/nocache
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
.
|
||||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
1
Locale/nocache
Symbolic link
1
Locale/nocache
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
.
|
||||||
74
admin.php
74
admin.php
@@ -1,74 +0,0 @@
|
|||||||
<?php require ("3-protect.php");
|
|
||||||
include 'localize.php';
|
|
||||||
$domain = 'sentier';
|
|
||||||
localize($domain);
|
|
||||||
include 'functions.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 echo gettext('Logged in'); ?></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' /-->
|
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
|
||||||
|
|
||||||
<!--link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script-->
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<h1><?php echo gettext('Status: ') . $_SESSION["user"] . gettext(' logged in'); ?></h1>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!--div class="center-flex"-->
|
|
||||||
<div class="center-flex">
|
|
||||||
<?php
|
|
||||||
$base = 'db_photo.sqlite3';
|
|
||||||
|
|
||||||
if (file_exists($base)) {
|
|
||||||
//echo '<div class="base">Base SQLite: ' . $base . ' !</div>';
|
|
||||||
echo '<h3>Base SQLite: ' . __DIR__ . '/' . $base . ' !</h3>';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<nav>
|
|
||||||
<a class="kaki" href="../edit_bdd.php">Edit</a>
|
|
||||||
<a class="kaki" href="../insert_bdd.php">Insert</a>
|
|
||||||
<a class="kaki" href="../modify_bdd.php">Modify</a>
|
|
||||||
<a class="kaki" href="../view_bdd.php">View (Ajax)</a>
|
|
||||||
<a class="kaki" href="../view_bdd2.php">View</a>
|
|
||||||
<a class="kaki" href="../clean_bdd.php">Clean</a>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<!-- (B1) LOGOUT FORM -->
|
|
||||||
|
|
||||||
<p></p>
|
|
||||||
<nav><a class="red" href="4-logout.php" role="button">Log out</a></nav>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!--form method="post">
|
|
||||||
<input type="hidden" name="logout" value="1">
|
|
||||||
<input type="submit" value="Log Out">
|
|
||||||
</form-->
|
|
||||||
|
|
||||||
<?php
|
|
||||||
//$_SESSION["user"] != ""
|
|
||||||
?>
|
|
||||||
|
|
||||||
<p class="navPage"><a href="index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></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="maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="admin.php" title="<?php echo gettext("Admin page"); ?>"><?php echo gettext("Admin page"); ?></a></p>
|
|
||||||
|
|
||||||
<p><em><small>© 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -3,10 +3,10 @@
|
|||||||
// (A) LOGIN CHECKS
|
// (A) LOGIN CHECKS
|
||||||
require "2-check.php";
|
require "2-check.php";
|
||||||
|
|
||||||
include 'localize.php';
|
include '../localize.php';
|
||||||
$domain = 'sentier';
|
$domain = 'sentier';
|
||||||
localize($domain);
|
localize($domain);
|
||||||
include 'functions.php';
|
include '../functions.php';
|
||||||
|
|
||||||
// (B) LOGIN PAGE HTML ?>
|
// (B) LOGIN PAGE HTML ?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<title><?php echo gettext("Login Page"); ?></title>
|
<title><?php echo gettext("Login Page"); ?></title>
|
||||||
<link rel="stylesheet" href="1-login.css" />
|
<link rel="stylesheet" href="1-login.css" />
|
||||||
<link rel="stylesheet" href="css/sls.css" />
|
<link rel="stylesheet" href="../css/sls.css" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<?php if (isset($failed)) { ?>
|
<?php if (isset($failed)) { ?>
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
<input type="submit" value="<?php echo gettext("Sign In"); ?>">
|
<input type="submit" value="<?php echo gettext("Sign In"); ?>">
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<p class="navPage"><a href="index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></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="maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="admin.php" title="<?php echo gettext("Admin page"); ?>"><?php echo gettext("Admin page"); ?></a></p>
|
<p class="navPage"><a href="../index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></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="../maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="admin.php" title="<?php echo gettext("Admin page"); ?>"><?php echo gettext("Admin page"); ?></a></p>
|
||||||
|
|
||||||
<p><em><small>© 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
|
<p><em><small>© 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
|
||||||
|
|
||||||
88
admin/admin.php
Normal file
88
admin/admin.php
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
<?php require ("3-protect.php");
|
||||||
|
include '../i18n_setup.php';
|
||||||
|
/*include 'localize.php';
|
||||||
|
$domain = 'sentier';
|
||||||
|
localize($domain);
|
||||||
|
*/
|
||||||
|
include '../functions.php';
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="description" content="Sur le sentier: pages administration">
|
||||||
|
<title><?php echo gettext('Logged in'); ?></title>
|
||||||
|
|
||||||
|
<meta name="msapplication-TileColor" content="#2b5797">
|
||||||
|
<meta name="msapplication-config" content="/icons/browserconfig.xml">
|
||||||
|
<meta name="theme-color" content="#ffffff">
|
||||||
|
<link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-touch-icon.png">
|
||||||
|
<link rel="icon" type="image/png" sizes="32x32" href="/icons/favicon-32x32.png">
|
||||||
|
<link rel="icon" type="image/png" sizes="16x16" href="/icons/favicon-16x16.png">
|
||||||
|
<link rel="manifest" href="/icons/site.webmanifest">
|
||||||
|
<link rel="shortcut icon" href="/icons/favicon.ico">
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../css/sls.css">
|
||||||
|
|
||||||
|
<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('Status: ') . $_SESSION["user"] . gettext(' logged in'); ?></h1>
|
||||||
|
|
||||||
|
|
||||||
|
<!--div class="center-flex"-->
|
||||||
|
<div class="center-flex">
|
||||||
|
<?php
|
||||||
|
$base = 'db_photo.sqlite3';
|
||||||
|
|
||||||
|
if (file_exists($base)) {
|
||||||
|
echo '<h3>Base SQLite: ' . __DIR__ . '/' . $base . ' !</h3>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<nav>
|
||||||
|
<a class="kaki" href="edit_bdd.php"><?php echo gettext("Edit"); ?></a>
|
||||||
|
<a class="kaki" href="insert_bdd.php"><?php echo gettext("Insert"); ?></a>
|
||||||
|
<a class="kaki" href="modify_bdd.php"><?php echo gettext("Modify"); ?></a>
|
||||||
|
<a class="kaki" href="view_bdd.php"><?php echo gettext("View (Ajax)"); ?></a>
|
||||||
|
<a class="kaki" href="view_bdd2.php"><?php echo gettext("View"); ?></a>
|
||||||
|
<a class="kaki" href="clean_bdd.php"><?php echo gettext("Clean"); ?></a>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<!-- (B1) LOGOUT FORM -->
|
||||||
|
|
||||||
|
<p></p>
|
||||||
|
<nav><a class="red" href="4-logout.php" role="button"><?php echo gettext("Log out"); ?></a></nav>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--form method="post">
|
||||||
|
<input type="hidden" name="logout" value="1">
|
||||||
|
<input type="submit" value="Log Out">
|
||||||
|
</form-->
|
||||||
|
|
||||||
|
<div class="indexForm">
|
||||||
|
<form name="langSelect" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post" >
|
||||||
|
<select name="lang" id="lang" class="mySelect">
|
||||||
|
<option value="">Language</option>
|
||||||
|
<option value="de_DE">German</option>
|
||||||
|
<option value="en_US">English</option>
|
||||||
|
<option value="es_ES">Spanish</option>
|
||||||
|
<option value="fr_FR">French</option>
|
||||||
|
</select>
|
||||||
|
<button type="submit" class="myButton">Ok</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="navPage"><a href="index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></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="maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="admin.php" title="<?php echo gettext("Admin page"); ?>"><?php echo gettext("Admin page"); ?></a></p>
|
||||||
|
|
||||||
|
<p><em><small>© 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,8 +1,12 @@
|
|||||||
<?php require ("3-protect.php");
|
<?php
|
||||||
include 'localize.php';
|
require ("3-protect.php");
|
||||||
$domain = 'sentier';
|
//session_start();
|
||||||
localize($domain);
|
include '../i18n_setup.php';
|
||||||
include 'functions.php';
|
/*include 'localize.php';
|
||||||
|
$domain = 'sentier';
|
||||||
|
localize($domain);
|
||||||
|
*/
|
||||||
|
include '../functions.php';
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
@@ -11,12 +15,18 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
|
<meta name="description" content="Sur le sentier: admin">
|
||||||
<title><?php echo gettext('Clean photos in Sqlite base'); ?></title>
|
<title><?php echo gettext('Clean photos in Sqlite base'); ?></title>
|
||||||
|
<meta name="msapplication-TileColor" content="#2b5797">
|
||||||
|
<meta name="msapplication-config" content="/icons/browserconfig.xml">
|
||||||
|
<meta name="theme-color" content="#ffffff">
|
||||||
|
<link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-touch-icon.png">
|
||||||
|
<link rel="icon" type="image/png" sizes="32x32" href="/icons/favicon-32x32.png">
|
||||||
|
<link rel="icon" type="image/png" sizes="16x16" href="/icons/favicon-16x16.png">
|
||||||
|
<link rel="manifest" href="/icons/site.webmanifest">
|
||||||
|
<link rel="shortcut icon" href="/icons/favicon.ico">
|
||||||
|
|
||||||
<link rel="stylesheet" href="css/sls.css" />
|
<link rel="stylesheet" href="../css/sls.css">
|
||||||
<link rel='stylesheet' href='lc-lightbox/css/lc_lightbox.min.css' />
|
|
||||||
<link rel='stylesheet' href='lc-lightbox/css/open_close_fx.css' />
|
|
||||||
<link rel='stylesheet' href='lc-lightbox/skins/minimal.css' />
|
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
@@ -24,24 +34,24 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<h1><?php echo gettext('Clean / repare database'); ?></h1><br />
|
<h1><?php echo gettext('Clean / repare database'); ?></h1><br>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$base = 'db_photo.sqlite3';
|
$chemin = '../photos/img/';
|
||||||
|
$base = '../db_photo.sqlite3';
|
||||||
|
|
||||||
// Taille des vignettes
|
// Taille des vignettes
|
||||||
$th_w = 300;
|
$th_w = 300;
|
||||||
$th_h = 300;
|
$th_h = 300;
|
||||||
// Chemins
|
// Chemins
|
||||||
$img_path = "photos/img/";
|
$img_path = $chemin;
|
||||||
$thumb_path = "photos/thumb/";
|
$thumb_path = str_replace("img", "thumb", $chemin);
|
||||||
|
|
||||||
|
|
||||||
echo '<h3>' . gettext('Clean folder img...') . '</h3>';
|
echo '<h3>' . gettext('Clean folder img...') . '</h3>';
|
||||||
|
|
||||||
$originals = array_map('basename', glob('photos/img/*.{jpg,jpeg,JPG,JPEG,heic,HEIC,webp,WEBP}', GLOB_BRACE));
|
$originals = array_map('basename', glob("$img_path/*.{jpg,jpeg,JPG,JPEG,heic,HEIC,webp,WEBP}", GLOB_BRACE));
|
||||||
$thumbs = array_map('basename', glob('photos/thumb/*.{jpg,jpeg,JPG,JPEG,heic,HEIC,webp,WEBP}', GLOB_BRACE));
|
$thumbs = array_map('basename', glob("$thumb_path/*.{jpg,jpeg,JPG,JPEG,heic,HEIC,webp,WEBP}", GLOB_BRACE));
|
||||||
|
|
||||||
// On recherche les vignettes manquantes
|
// On recherche les vignettes manquantes
|
||||||
|
|
||||||
@@ -58,9 +68,8 @@ if ($a > 0) {
|
|||||||
foreach($missing_thumbs as $img){
|
foreach($missing_thumbs as $img){
|
||||||
$file = $img_path . $img;
|
$file = $img_path . $img;
|
||||||
create_thumb($th_w, $th_h, $file);
|
create_thumb($th_w, $th_h, $file);
|
||||||
echo gettext('Thumb for ') . $img . gettext(' was successfully created!') . '<br>';
|
echo '<h5>' . gettext('Thumb for ') . $img . gettext(' was successfully created!') . '</h5>';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -79,9 +88,9 @@ if ($b > 0) {
|
|||||||
foreach($extra_thumbs as $thumb){
|
foreach($extra_thumbs as $thumb){
|
||||||
$file = $thumb_path . $thumb;
|
$file = $thumb_path . $thumb;
|
||||||
if (unlink($file)) {
|
if (unlink($file)) {
|
||||||
echo $thumb . gettext(' was deleted successfully!') . '<br>';
|
echo '<h5>' . $thumb . gettext(' was deleted successfully!') . '</h5>';
|
||||||
} else {
|
} else {
|
||||||
echo gettext('There was a error deleting the file ') . $thumb;
|
echo '<h5 class="redtext">' . gettext('There was a error deleting the file ') . $thumb . '</h5>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,7 +101,7 @@ if ($b > 0) {
|
|||||||
echo '<h3>' . gettext('Compare folder img and database...') . '</h3>';
|
echo '<h3>' . gettext('Compare folder img and database...') . '</h3>';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$conn = new PDO("sqlite:db_photo.sqlite3");
|
$conn = new PDO("sqlite:$base");
|
||||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
|
||||||
$query = "SELECT filename FROM photos";
|
$query = "SELECT filename FROM photos";
|
||||||
@@ -116,8 +125,8 @@ foreach($result as $file) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$base = array_map('basename', $bdd);
|
$base = array_map('basename', $bdd);
|
||||||
echo '<h4>' . count($base) . " entries in database". "</h4>";
|
echo '<h4>' . count($base) . gettext(" entries in database"). "</h4>";
|
||||||
echo '<h4>' . count($originals) . " files on disk" . "</h4>";
|
echo '<h4>' . count($originals) . gettext(" files on disk") . "</h4>";
|
||||||
|
|
||||||
$extra_in_bdd= array_diff($base, $originals);
|
$extra_in_bdd= array_diff($base, $originals);
|
||||||
$c = count($extra_in_bdd);
|
$c = count($extra_in_bdd);
|
||||||
@@ -137,7 +146,7 @@ if ($c > 0) {
|
|||||||
$stmt->bindParam(':filename', $file);
|
$stmt->bindParam(':filename', $file);
|
||||||
$result = $stmt->execute();
|
$result = $stmt->execute();
|
||||||
if ($result) {
|
if ($result) {
|
||||||
echo $img . gettext(' has been deleted from database !') . "<br />";
|
echo '<h5>' . $img . gettext(' has been deleted from database !') . "</h5>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -695,10 +704,12 @@ if ($d > 0) {
|
|||||||
echo '</thead>';
|
echo '</thead>';
|
||||||
echo '<tbody>';
|
echo '<tbody>';
|
||||||
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||||
$thumbnail = host() . str_replace("photos/img", "photos/thumb", $row['filename']);
|
//$thumbnail = host() . str_replace("photos/img", "photos/thumb", $row['filename']);
|
||||||
$full = host() . $row['filename'];
|
//$full = host() . $row['filename'];
|
||||||
|
|
||||||
echo '<tr><td>' . '<a href="' . $full . '"><img src="'.$thumbnail.'" /></a>' . '</td><td>' . $row['filename'] . '</td><td>' . $row['filesize'] . '</td><td>' . $row['dateoriginal'] . '</td><td>' . $row['lens'] . '</td><td>' . $row['speed'] . '</td><td>' . $row['aperture'] . '</td><td>' . $row['correctexpo'] . '</td><td>' . $row['iso'] . '</td><td>' . $row['model'] . '</td><td>' . $row['metering'] . '</td><td>' . $row['flash'] . '</td><td>' . $row['focal'] . '</td><td>' . $row['program'] . '</td><td>' . $row['wb'] . '</td><td>' . $row['mode'] . '</td><td>' . $row['software'] . '</td><td>' . $row['lat'] . '</td><td>' . $row['long'] . '</td><td>' . $row['alt'] . '</td><td>' . $row['keywords'] . '</td><td>' . $row['title'] . '</td><td>' . $row['creator'] . '</td><td>' . $row['city'] . '</td><td>' . $row['department'] . '</td><td>' . $row['code'] . '</td><td>' . $row['country'] . '</td><td>' . $row['copyright'] . '</td><td>' . $row['legende'] . '</td></tr>';
|
$lb = data_for_lightbox($row);
|
||||||
|
|
||||||
|
echo '<tr><td>' . '<a href="' . $lb['big'] . '"><img src="' . $lb['thumb'] . '" /></a>' . '</td><td>' . $row['filename'] . '</td><td>' . $row['filesize'] . '</td><td>' . $row['dateoriginal'] . '</td><td>' . $row['lens'] . '</td><td>' . $row['speed'] . '</td><td>' . $row['aperture'] . '</td><td>' . $row['correctexpo'] . '</td><td>' . $row['iso'] . '</td><td>' . $row['model'] . '</td><td>' . $row['metering'] . '</td><td>' . $row['flash'] . '</td><td>' . $row['focal'] . '</td><td>' . $row['program'] . '</td><td>' . $row['wb'] . '</td><td>' . $row['mode'] . '</td><td>' . $row['software'] . '</td><td>' . $row['lat'] . '</td><td>' . $row['long'] . '</td><td>' . $row['alt'] . '</td><td>' . $row['keywords'] . '</td><td>' . $row['title'] . '</td><td>' . $row['creator'] . '</td><td>' . $row['city'] . '</td><td>' . $row['department'] . '</td><td>' . $row['code'] . '</td><td>' . $row['country'] . '</td><td>' . $row['copyright'] . '</td><td>' . $row['legende'] . '</td></tr>';
|
||||||
}
|
}
|
||||||
echo '</tbody></table>';
|
echo '</tbody></table>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
@@ -712,19 +723,14 @@ if ($d > 0) {
|
|||||||
$conn = null;
|
$conn = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//echo '<h3>' . gettext('Find duplicate images in database: ') . '</h3>';
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<p class="navPage"><a href="index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></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="maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="admin.php" title="<?php echo gettext("Admin page"); ?>"><?php echo gettext("Admin page"); ?></a></p>
|
<?php $logout = (isset($_SESSION["user"])) ? '<a class="" href="4-logout.php" role="button">' . gettext("Log out") . '</a>' : ''; ?>
|
||||||
|
|
||||||
|
<p class="navPage"><a href="../index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></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="../maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="admin.php" title="<?php echo gettext("Admin page"); ?>"><?php echo gettext("Admin page"); ?></a> | <?php echo $logout; ?></p>
|
||||||
|
|
||||||
<p><em><small>© 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
|
<p><em><small>© 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
|
||||||
|
|
||||||
<script src='lc-lightbox/js/lc_lightbox.min.js' type='text/javascript'></script>
|
|
||||||
<script src='lc-lightbox/lib/AlloyFinger/alloy_finger.min.js' type='text/javascript'></script>
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
295
admin/delete_bdd.php
Normal file
295
admin/delete_bdd.php
Normal file
@@ -0,0 +1,295 @@
|
|||||||
|
<?php
|
||||||
|
require ("3-protect.php");
|
||||||
|
//session_start();
|
||||||
|
include '../i18n_setup.php';
|
||||||
|
/*include 'localize.php';
|
||||||
|
$domain = 'sentier';
|
||||||
|
localize($domain);
|
||||||
|
*/
|
||||||
|
include '../functions.php';
|
||||||
|
|
||||||
|
$chemin = '../photos/img/';
|
||||||
|
$base = "../db_photo.sqlite3";
|
||||||
|
|
||||||
|
$conn = new PDO("sqlite:$base");
|
||||||
|
$conn2 = new PDO("sqlite:$base");
|
||||||
|
$msg = "";
|
||||||
|
$req_suppress = "";
|
||||||
|
$req_delete = "";
|
||||||
|
$files_deleted = "";
|
||||||
|
$files = array();
|
||||||
|
|
||||||
|
//_pr($_POST);
|
||||||
|
|
||||||
|
/*
|
||||||
|
// view_bdd2.php:
|
||||||
|
supress ; coche => delete_bdd.php (delete ; coche)
|
||||||
|
edit; coche => edit_bdd.php => modify_bdd.php (modif sur la bdd)
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (isset($_SESSION["user"])) {
|
||||||
|
if ((isset($_POST["suppress"])) && ($_POST["suppress"] == "suppress")) {
|
||||||
|
|
||||||
|
if (isset($_POST['coche']) && (! empty($_POST['coche']))) {
|
||||||
|
$rr = "";
|
||||||
|
foreach($_POST['coche'] as $key => $value) {
|
||||||
|
$r = "id = '" . $value . "' OR ";
|
||||||
|
$rr .= $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
$req = substr($rr, 0, -4);
|
||||||
|
$req_suppress = "SELECT * FROM photos WHERE " . $req . " ORDER BY id";
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$url = "view_bdd.php?message=" . urlencode(gettext("No images select !"));
|
||||||
|
header("location: $url");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif ((isset($_POST["delete"])) && ($_POST["delete"] == "delete")) {
|
||||||
|
|
||||||
|
if (isset($_POST['id']) && (! empty($_POST['id']))) {
|
||||||
|
$rr = "";
|
||||||
|
foreach($_POST['id'] as $key => $value) {
|
||||||
|
$r = "id = '" . $value . "' OR ";
|
||||||
|
$rr .= $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
$req = substr($rr, 0, -4);
|
||||||
|
/**/
|
||||||
|
$req_suppress = "SELECT id, filename FROM photos WHERE " . $req . " ORDER BY id"; // Pour supprimer les fichiers
|
||||||
|
|
||||||
|
$stmt = $conn->prepare($req_suppress);
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||||
|
$ids[] = $row['id'];
|
||||||
|
|
||||||
|
$file = $row['filename'];
|
||||||
|
if (file_exists($file)) {
|
||||||
|
$files[] = realpath('.') . "/" . $file;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//$msg .= "File $file doesn't exist !";
|
||||||
|
$msg .= sprintf( gettext("File %s doesn't exist !"), $file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//_pr($files);
|
||||||
|
|
||||||
|
$req_delete = "DELETE FROM photos WHERE id in (".str_repeat("?,", count($ids) - 1)."?)";
|
||||||
|
// DELETE FROM photos WHERE id in (?,?)
|
||||||
|
|
||||||
|
$stmt = $conn->prepare($req_delete);
|
||||||
|
$stmt->execute($ids);
|
||||||
|
$count = $stmt->rowCount();
|
||||||
|
|
||||||
|
if ($count = count($files)) {
|
||||||
|
foreach ($files as $file) {
|
||||||
|
if (unlink($file)) {
|
||||||
|
//echo "File: " . $file . " deleted!" . "<br />";
|
||||||
|
$files_deleted .= sprintf( gettext("File: %s deleted!"), $file ) . "\n";
|
||||||
|
//echo $a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$url = "view_bdd.php?message=" . urlencode(gettext("No images select !"));
|
||||||
|
header("location: $url");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
$url = "view_bdd.php?message=" . urlencode(gettext("No images select !"));
|
||||||
|
header("location: $url");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$url = "admin.php?message=" . urlencode(gettext("Please log in !"));
|
||||||
|
header("location: $url");
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!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">
|
||||||
|
<meta name="description" content="Sur le sentier: admin">
|
||||||
|
<title><?php echo gettext('View photos in Sqlite base'); ?></title>
|
||||||
|
<meta name="msapplication-TileColor" content="#2b5797">
|
||||||
|
<meta name="msapplication-config" content="/icons/browserconfig.xml">
|
||||||
|
<meta name="theme-color" content="#ffffff">
|
||||||
|
<link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-touch-icon.png">
|
||||||
|
<link rel="icon" type="image/png" sizes="32x32" href="/icons/favicon-32x32.png">
|
||||||
|
<link rel="icon" type="image/png" sizes="16x16" href="/icons/favicon-16x16.png">
|
||||||
|
<link rel="manifest" href="/icons/site.webmanifest">
|
||||||
|
<link rel="shortcut icon" href="/icons/favicon.ico">
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../css/sls.css">
|
||||||
|
|
||||||
|
<link rel='stylesheet' href='../lc-lightbox/css/lc_lightbox.min.css'>
|
||||||
|
<link rel='stylesheet' href='../lc-lightbox/css/open_close_fx.css'>
|
||||||
|
<link rel='stylesheet' href='../lc-lightbox/skins/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">
|
||||||
|
|
||||||
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
|
||||||
|
<?php
|
||||||
|
//debug_to_console($_GET);
|
||||||
|
//debug_to_console($req_edit);
|
||||||
|
|
||||||
|
echo '<h1>' . gettext('Suppress images ') . ': ' . $base . '</h1><br />';
|
||||||
|
|
||||||
|
if (($req_suppress != "") and ($req_delete == "")) {
|
||||||
|
|
||||||
|
echo '<h3>' . $msg . '</h3>';
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
$conn3 = new PDO("sqlite:$base");
|
||||||
|
$stmt3 = $conn3->prepare($req_suppress);
|
||||||
|
$stmt3->execute();
|
||||||
|
|
||||||
|
echo '<form id="deleteImage" name="deleteImage" action="delete_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('Speed') . '</th><th>' . gettext('Iso') . '</th><th>' . gettext('Aperture') . '</th><th>' . gettext('Expo. correct') . '</th>';
|
||||||
|
echo '<th>' . gettext('Model') . '</th><th>' . gettext('Lens') . '</th><th>' . gettext('Focal') . '</th><th>' . gettext('Metering') . '</th><th>' . gettext('Program') . '</th><th>' . gettext('Wb') . '</th>';
|
||||||
|
|
||||||
|
echo '<th>' . gettext('Flash') . '</th><th>' . gettext('Software') . '</th><th>' . gettext('Keywords') . '</th><th>' . gettext('Title') . '</th><th>' . gettext('Creator') . '</th><th>' . gettext('City') . '</th><th>' . gettext('Department') . '</th><th>' . gettext('Code') . '</th><th>' . gettext('Country') . '</th><th>' . gettext('Copyright') . '</th><th>' . gettext('Legende') . '</th>';
|
||||||
|
echo '</thead>';
|
||||||
|
echo '<tbody>';
|
||||||
|
|
||||||
|
$nRows = 0;
|
||||||
|
while ($row = $stmt3->fetch(PDO::FETCH_ASSOC)) {
|
||||||
|
|
||||||
|
$lb = data_for_lightbox($row);
|
||||||
|
|
||||||
|
echo '<tr><td>' . $row['id'] . '</td><td>' . '<a href="' . $lb['big'] . '" title="' . htmlspecialchars($lb['title']) . '" data-lcl-txt="' . htmlspecialchars($lb['description']) . '" data-lcl-author="' . htmlspecialchars($lb['creator']) . '"><img src="' . $lb['thumb'] . '" alt="' . htmlspecialchars($lb['title']) . '"></a>' . '</td>';
|
||||||
|
echo '<td>' . $row['filename'] . '</td><td>' . $row['dateoriginal'] . '</td>';
|
||||||
|
echo '<td>' . $row['speed'] . '</td><td>' . $row['iso'] . '</td><td>' . $row['aperture'] . '</td><td>' . $row['correctexpo'] . '</td>';
|
||||||
|
echo '<td>' . $row['model'] . '</td>';
|
||||||
|
echo '<td><input type="text" id="lens" name="lens[]" value="' . $row['lens'] . '" size=""></td>';
|
||||||
|
echo '<td>' . $row['focal'] . '</td><td>' . $row['metering'] . '</td><td>' . $row['program'] . '</td><td>' . $row['wb'] . '</td>';
|
||||||
|
echo '<td>' . $row['flash'] . '</td><td>' . $row['software'] . '</td>';
|
||||||
|
echo "<td><input type='text' id='keywords' name='keywords[]' value='" . $row['keywords'] . "' size=''></td>";
|
||||||
|
echo '<td><input type="text" id="title" name="title[]" value="' . $row['title'] . '" size=""></td>';
|
||||||
|
echo '<td><input type="text" id="creator" name="creator[]" value="' . $row['creator'] . '" size=""></td>';
|
||||||
|
|
||||||
|
echo '<td><input type="text" id="city" name="city[]" value="' . $row['city'] . '" size=""></td>';
|
||||||
|
echo '<td><input type="text" id="department" name="department[]" value="' . $row['department'] . '" size=""></td>';
|
||||||
|
echo '<td><input type="text" id="code" name="code[]" value="' . $row['code'] . '" size=""></td>';
|
||||||
|
echo '<td><input type="text" id="country" name="country[]" value="' . $row['country'] . '" size=""></td>';
|
||||||
|
|
||||||
|
echo '<td><input type="text" id="copyright" name="copyright[]" value="' . $row['copyright'] . '" size=""></td>';
|
||||||
|
echo '<td><input type="text" id="legende" name="legende[]" value="' . $row['legende'] . '" size=""></td></tr>';
|
||||||
|
|
||||||
|
echo '<input type="hidden" id="id" name="id[]" value="' . $row['id'] . '">';
|
||||||
|
$nRows++;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '</tbody></table>';
|
||||||
|
|
||||||
|
|
||||||
|
echo '<p class="alert">' . ngettext("Clic on <b>Delete</b> button will delete the image in the database and the file on the server.", "Clic on <b>Delete</b> button will delete the images in the database and the files on the server.", $nRows) . '</p>';
|
||||||
|
echo '<button type="submit" name="delete" value="delete" class="myButton all">' . gettext('Delete') . '</button>';
|
||||||
|
echo '</form>';
|
||||||
|
|
||||||
|
//$conn = null;
|
||||||
|
}
|
||||||
|
catch(PDOException $e) {
|
||||||
|
echo $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
$req_suppress = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($req_delete != "") {
|
||||||
|
|
||||||
|
$msg = sprintf(ngettext("%d row deleted and the following file:","%d rows deleted and the following files:", $count), $count);
|
||||||
|
//$msg = $count . gettext(" rows deleted and the following files:");
|
||||||
|
echo '<h3 class="greenstyle">' . $msg . '</h3>';
|
||||||
|
echo '<h3>' . nl2br($files_deleted) . '</h3>';
|
||||||
|
|
||||||
|
//echo '<pre><code>' . $req_delete . '</code></pre>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
var $obj = lc_lightbox('td a', {
|
||||||
|
img_zoom : true, // whether to enable zooming system
|
||||||
|
|
||||||
|
author_by_txt : '<?php echo gettext("by"); ?>', // which text is used before the author name, by default is "by"
|
||||||
|
|
||||||
|
slideshow : true, // whether to enable slideshow
|
||||||
|
open_close_time : 200, // durée de l'animation pour l'ouverture et la fermeture de la lightbox
|
||||||
|
ol_time_diff : 100, // animation de superposition avance (à l'ouverture) et retard (à la fermeture) à la fenêtre
|
||||||
|
fading_time : 50, // durée de l'animation de fondu des éléments
|
||||||
|
animation_time : 100,
|
||||||
|
slideshow_time : 4000, // durée de l'intervalle du diaporama
|
||||||
|
autoplay : false, // autoplay slideshow - bool
|
||||||
|
counter : false, // s'il faut afficher le compteur d'éléments
|
||||||
|
progressbar : false, // s'il faut afficher une barre de progression lors de l'exécution du diaporama
|
||||||
|
|
||||||
|
max_width : '95%', // largeur maximale de la lightbox
|
||||||
|
max_height : '95%', // hauteur maximale de la lightbox
|
||||||
|
ol_opacity : 0.7, // overlay opacity / value between 0 and 1
|
||||||
|
ol_color : '#111', // background color of the overlay
|
||||||
|
ol_pattern : false, // overlay patterns - insert the pattern name or false
|
||||||
|
|
||||||
|
wrap_class : 'lcl_fade_oc', // Classes personnalisées ajoutées au wrapper: effet à l'ouverture de la lb (lcl_fade_oc | lcl_zoomin_oc | lcl_rtl_oc)
|
||||||
|
skin : 'minimal', // minimal | light | dark
|
||||||
|
data_position : 'over', // Spécifie où les données des éléments seront affichées. Les modes disponibles sont :over, under|rside|lside
|
||||||
|
cmd_position : 'inner', // Déclare où les commandes doivent être affichées : inner|outer
|
||||||
|
ins_close_pos : 'normal', // set closing button position for inner commands - normal/corner
|
||||||
|
nav_btn_pos : 'normal', // Régle les flèches et la position de lecture/pause. Options disponibles: normal|middle
|
||||||
|
|
||||||
|
txt_hidden : true, // whether to hide texts on lightbox opening - bool or int (related to browser's smaller side)
|
||||||
|
shox_title : true, // s'il faut afficher les titres
|
||||||
|
show_descr : true, // s'il faut afficher les descriptions
|
||||||
|
show_author : true, // s'il faut afficher les auteurs
|
||||||
|
|
||||||
|
thumbs_nav : false, // permet la navigation par vignettes (nécessite des éléments affiche ou images)
|
||||||
|
|
||||||
|
fullscreen : true, // Autoriser ou non le mode plein écran
|
||||||
|
fs_img_behavior : 'smart', //Comportement de l'image en plein écran : fit|fill|smart
|
||||||
|
fs_only : 500, // s'il faut utiliser uniquement l'ouverture de la lightbox en mode plein écran (utile pour les appareils mobiles) : false | (integer)
|
||||||
|
browser_fs_mode : true, // utiliser ou non le mode plein écran du navigateur
|
||||||
|
|
||||||
|
txt_toggle_cmd : true, // s'il faut afficher le bouton de basculement du texte de l'élément
|
||||||
|
download : true, // whether to show element's file download button
|
||||||
|
autoplay_videos : false, // bool / whether to autoplay videos (NB: modern browsers ignore this for deeplinked elements. Not applied if video has poster)
|
||||||
|
touchswipe : true, // permet les interactions tactiles (nécessite AlloyFinger)
|
||||||
|
rclick_prevent : true, // s'il faut éviter le clic droit sur les éléments de la lightbox
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?php $logout = (isset($_SESSION["user"])) ? '<a class="" href="4-logout.php" role="button">' . gettext("Log out") . '</a>' : ''; ?>
|
||||||
|
|
||||||
|
<p class="navPage"><a href="../index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></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="../maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="admin.php" title="<?php echo gettext("Admin page"); ?>"><?php echo gettext("Admin page"); ?></a> | <?php echo $logout; ?></p>
|
||||||
|
|
||||||
|
<p><em><small>© 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
|
||||||
|
|
||||||
|
<script src='../lc-lightbox/js/lc_lightbox.min.js'></script>
|
||||||
|
<script src='../lc-lightbox/lib/AlloyFinger/alloy_finger.min.js'></script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
|
||||||
206
admin/edit_bdd.php
Normal file
206
admin/edit_bdd.php
Normal file
@@ -0,0 +1,206 @@
|
|||||||
|
<?php
|
||||||
|
require ("3-protect.php");
|
||||||
|
//session_start();
|
||||||
|
include '../i18n_setup.php';
|
||||||
|
/*include 'localize.php';
|
||||||
|
$domain = 'sentier';
|
||||||
|
localize($domain);
|
||||||
|
*/
|
||||||
|
include '../functions.php';
|
||||||
|
|
||||||
|
$chemin = '../photos/img/';
|
||||||
|
$base = '../db_photo.sqlite3';
|
||||||
|
|
||||||
|
$conn = new PDO("sqlite:$base");
|
||||||
|
$msg = "";
|
||||||
|
$req_edit = "";
|
||||||
|
|
||||||
|
if (isset($_SESSION["user"])) {
|
||||||
|
if ((isset($_POST["edit"])) && ($_POST["edit"] == "edit")) {
|
||||||
|
|
||||||
|
if (isset($_POST['coche']) && (! empty($_POST['coche']))) {
|
||||||
|
$rr = "";
|
||||||
|
foreach($_POST['coche'] as $key => $value) {
|
||||||
|
$r = "id = '" . $value . "' OR ";
|
||||||
|
$rr .= $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
$req = substr($rr, 0, -4);
|
||||||
|
$req_edit = "SELECT * FROM photos WHERE " . $req . " ORDER BY id";
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$url = "view_bdd.php?message=" . urlencode(gettext("No images select !"));
|
||||||
|
header("location: $url");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$url = "view_bdd.php?message=" . urlencode(gettext("No images select !"));
|
||||||
|
header("location: $url");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$url = "admin.php?message=" . urlencode(gettext("Please log in !"));
|
||||||
|
header("location: $url");
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!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 echo gettext('View photos in Sqlite base'); ?></title>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../css/sls.css" />
|
||||||
|
<link rel='stylesheet' href='../lc-lightbox/css/lc_lightbox.min.css' />
|
||||||
|
<link rel='stylesheet' href='../lc-lightbox/css/open_close_fx.css' />
|
||||||
|
<link rel='stylesheet' href='../lc-lightbox/skins/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" />
|
||||||
|
|
||||||
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
|
||||||
|
<?php
|
||||||
|
//debug_to_console($_GET);
|
||||||
|
//debug_to_console($req_edit);
|
||||||
|
|
||||||
|
//$base = '../db_photo.sqlite3';
|
||||||
|
|
||||||
|
echo '<h1>' . gettext('Edit database') . ': ' . $base . '</h1><br />';
|
||||||
|
|
||||||
|
echo '<h3>' . $msg . '</h3>';
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
$conn = new PDO("sqlite:$base");
|
||||||
|
$stmt = $conn->prepare($req_edit);
|
||||||
|
$stmt->execute();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?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('Speed') . '</th><th>' . gettext('Iso') . '</th><th>' . gettext('Aperture') . '</th><th>' . gettext('Expo. correct') . '</th>';
|
||||||
|
echo '<th>' . gettext('Model') . '</th><th>' . gettext('Lens') . '</th><th>' . gettext('Focal') . '</th><th>' . gettext('Metering') . '</th><th>' . gettext('Program') . '</th><th>' . gettext('Wb') . '</th>';
|
||||||
|
|
||||||
|
echo '<th>' . gettext('Flash') . '</th><th>' . gettext('Software') . '</th><th>' . gettext('Keywords') . '</th><th>' . gettext('Title') . '</th><th>' . gettext('Creator') . '</th><th>' . gettext('City') . '</th><th>' . gettext('Department') . '</th><th>' . gettext('Code') . '</th><th>' . gettext('Country') . '</th><th>' . gettext('Copyright') . '</th><th>' . gettext('Legende') . '</th>';
|
||||||
|
echo '</thead>';
|
||||||
|
echo '<tbody>';
|
||||||
|
|
||||||
|
|
||||||
|
$nRows = 0;
|
||||||
|
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||||
|
|
||||||
|
$lb = data_for_lightbox($row);
|
||||||
|
|
||||||
|
echo '<tr><td>' . $row['id'] . '</td><td>' . '<a href="' . $lb['big'] . '" title="' . htmlspecialchars($lb['title']) . '" data-lcl-txt="' . htmlspecialchars($lb['description']) . '" data-lcl-author="' . htmlspecialchars($lb['creator']) . '"><img src="' . $lb['thumb'] . '" alt="' . htmlspecialchars($lb['title']) . '"></a>' . '</td>';
|
||||||
|
echo '<td>' . $row['filename'] . '</td><td>' . $row['dateoriginal'] . '</td>';
|
||||||
|
echo '<td>' . $row['speed'] . '</td><td>' . $row['iso'] . '</td><td>' . $row['aperture'] . '</td><td>' . $row['correctexpo'] . '</td>';
|
||||||
|
echo '<td>' . $row['model'] . '</td>';
|
||||||
|
echo '<td><input type="text" id="lens" name="lens[]" value="' . $row['lens'] . '" size=""></td>';
|
||||||
|
echo '<td>' . $row['focal'] . '</td><td>' . $row['metering'] . '</td><td>' . $row['program'] . '</td><td>' . $row['wb'] . '</td>';
|
||||||
|
echo '<td>' . $row['flash'] . '</td><td>' . $row['software'] . '</td>';
|
||||||
|
echo "<td><input type='text' id='keywords' name='keywords[]' value='" . $row['keywords'] . "' size=''></td>";
|
||||||
|
echo '<td><input type="text" id="title" name="title[]" value="' . $row['title'] . '" size=""></td>';
|
||||||
|
echo '<td><input type="text" id="creator" name="creator[]" value="' . $row['creator'] . '" size=""></td>';
|
||||||
|
|
||||||
|
echo '<td><input type="text" id="city" name="city[]" value="' . $row['city'] . '" size=""></td>';
|
||||||
|
echo '<td><input type="text" id="department" name="department[]" value="' . $row['department'] . '" size=""></td>';
|
||||||
|
echo '<td><input type="text" id="code" name="code[]" value="' . $row['code'] . '" size=""></td>';
|
||||||
|
echo '<td><input type="text" id="country" name="country[]" value="' . $row['country'] . '" size=""></td>';
|
||||||
|
|
||||||
|
echo '<td><input type="text" id="copyright" name="copyright[]" value="' . $row['copyright'] . '" size=""></td>';
|
||||||
|
echo '<td><input type="text" id="legende" name="legende[]" value="' . $row['legende'] . '" size=""></td></tr>';
|
||||||
|
|
||||||
|
echo '<input type="hidden" id="id" name="id[]" 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();
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
var $obj = lc_lightbox('td a', {
|
||||||
|
img_zoom : true, // whether to enable zooming system
|
||||||
|
|
||||||
|
author_by_txt : '<?php echo gettext("by"); ?>', // which text is used before the author name, by default is "by"
|
||||||
|
|
||||||
|
slideshow : true, // whether to enable slideshow
|
||||||
|
open_close_time : 200, // durée de l'animation pour l'ouverture et la fermeture de la lightbox
|
||||||
|
ol_time_diff : 100, // animation de superposition avance (à l'ouverture) et retard (à la fermeture) à la fenêtre
|
||||||
|
fading_time : 50, // durée de l'animation de fondu des éléments
|
||||||
|
animation_time : 100,
|
||||||
|
slideshow_time : 4000, // durée de l'intervalle du diaporama
|
||||||
|
autoplay : false, // autoplay slideshow - bool
|
||||||
|
counter : false, // s'il faut afficher le compteur d'éléments
|
||||||
|
progressbar : false, // s'il faut afficher une barre de progression lors de l'exécution du diaporama
|
||||||
|
|
||||||
|
max_width : '95%', // largeur maximale de la lightbox
|
||||||
|
max_height : '95%', // hauteur maximale de la lightbox
|
||||||
|
ol_opacity : 0.7, // overlay opacity / value between 0 and 1
|
||||||
|
ol_color : '#111', // background color of the overlay
|
||||||
|
ol_pattern : false, // overlay patterns - insert the pattern name or false
|
||||||
|
|
||||||
|
wrap_class : 'lcl_fade_oc', // Classes personnalisées ajoutées au wrapper: effet à l'ouverture de la lb (lcl_fade_oc | lcl_zoomin_oc | lcl_rtl_oc)
|
||||||
|
skin : 'minimal', // minimal | light | dark
|
||||||
|
data_position : 'over', // Spécifie où les données des éléments seront affichées. Les modes disponibles sont :over, under|rside|lside
|
||||||
|
cmd_position : 'inner', // Déclare où les commandes doivent être affichées : inner|outer
|
||||||
|
ins_close_pos : 'normal', // set closing button position for inner commands - normal/corner
|
||||||
|
nav_btn_pos : 'normal', // Régle les flèches et la position de lecture/pause. Options disponibles: normal|middle
|
||||||
|
|
||||||
|
txt_hidden : true, // whether to hide texts on lightbox opening - bool or int (related to browser's smaller side)
|
||||||
|
shox_title : true, // s'il faut afficher les titres
|
||||||
|
show_descr : true, // s'il faut afficher les descriptions
|
||||||
|
show_author : true, // s'il faut afficher les auteurs
|
||||||
|
|
||||||
|
thumbs_nav : false, // permet la navigation par vignettes (nécessite des éléments affiche ou images)
|
||||||
|
|
||||||
|
fullscreen : true, // Autoriser ou non le mode plein écran
|
||||||
|
fs_img_behavior : 'smart', //Comportement de l'image en plein écran : fit|fill|smart
|
||||||
|
fs_only : 500, // s'il faut utiliser uniquement l'ouverture de la lightbox en mode plein écran (utile pour les appareils mobiles) : false | (integer)
|
||||||
|
browser_fs_mode : true, // utiliser ou non le mode plein écran du navigateur
|
||||||
|
|
||||||
|
txt_toggle_cmd : true, // s'il faut afficher le bouton de basculement du texte de l'élément
|
||||||
|
download : true, // whether to show element's file download button
|
||||||
|
autoplay_videos : false, // bool / whether to autoplay videos (NB: modern browsers ignore this for deeplinked elements. Not applied if video has poster)
|
||||||
|
touchswipe : true, // permet les interactions tactiles (nécessite AlloyFinger)
|
||||||
|
rclick_prevent : true, // s'il faut éviter le clic droit sur les éléments de la lightbox
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?php $logout = (isset($_SESSION["user"])) ? '<a class="" href="4-logout.php" role="button">' . gettext("Log out") . '</a>' : ''; ?>
|
||||||
|
|
||||||
|
<p class="navPage"><a href="../index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></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="../maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="admin.php" title="<?php echo gettext("Admin page"); ?>"><?php echo gettext("Admin page"); ?></a> | <?php echo $logout; ?></p>
|
||||||
|
|
||||||
|
<p><em><small>© 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
|
||||||
|
|
||||||
|
<script src='../lc-lightbox/js/lc_lightbox.min.js' type='text/javascript'></script>
|
||||||
|
<script src='../lc-lightbox/lib/AlloyFinger/alloy_finger.min.js' type='text/javascript'></script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
|
||||||
@@ -1,8 +1,12 @@
|
|||||||
<?php require ("3-protect.php");
|
<?php
|
||||||
include 'localize.php';
|
require ("3-protect.php");
|
||||||
$domain = 'sentier';
|
//session_start();
|
||||||
localize($domain);
|
include '../i18n_setup.php';
|
||||||
include 'functions.php';
|
/*include 'localize.php';
|
||||||
|
$domain = 'sentier';
|
||||||
|
localize($domain);
|
||||||
|
*/
|
||||||
|
include '../functions.php';
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
@@ -13,10 +17,10 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
<title><?php echo gettext('Insert photos in Sqlite base'); ?></title>
|
<title><?php echo gettext('Insert photos in Sqlite base'); ?></title>
|
||||||
|
|
||||||
<link rel="stylesheet" href="css/sls.css" />
|
<link rel="stylesheet" href="../css/sls.css" />
|
||||||
<link rel='stylesheet' href='lc-lightbox/css/lc_lightbox.min.css' />
|
<link rel='stylesheet' href='../lc-lightbox/css/lc_lightbox.min.css' />
|
||||||
<link rel='stylesheet' href='lc-lightbox/css/open_close_fx.css' />
|
<link rel='stylesheet' href='../lc-lightbox/css/open_close_fx.css' />
|
||||||
<link rel='stylesheet' href='lc-lightbox/skins/minimal.css' />
|
<link rel='stylesheet' href='../lc-lightbox/skins/minimal.css' />
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
|
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
@@ -24,8 +28,11 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
<?php $logout = (isset($_SESSION["user"])) ? '<a class="" href="4-logout.php" role="button">' . gettext("Log out") . '</a>' : ''; ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$base = 'db_photo.sqlite3';
|
$base = '../db_photo.sqlite3';
|
||||||
|
$chemin = '../photos/img/';
|
||||||
|
|
||||||
echo '<h1>' . gettext("Insert images in " . $base . " database.") . '</h1><br />';
|
echo '<h1>' . gettext("Insert images in " . $base . " database.") . '</h1><br />';
|
||||||
|
|
||||||
@@ -38,16 +45,17 @@ if (file_exists($base)) {
|
|||||||
$th_w = 300;
|
$th_w = 300;
|
||||||
$th_h = 300;
|
$th_h = 300;
|
||||||
|
|
||||||
$dir = (new AdvancedFilesystemIterator('photos/img/'))->match('/heic|HEIC|jpg|jpeg|JPG|JPEG|webp|WEBP|avif|AVIF$/');
|
//$dir = (new AdvancedFilesystemIterator('../photos/img/'))->match('/heic|HEIC|jpg|jpeg|JPG|JPEG|webp|WEBP|avif|AVIF$/');
|
||||||
|
$dir = (new AdvancedFilesystemIterator($chemin))->match('/heic|HEIC|jpg|jpeg|JPG|JPEG|webp|WEBP|avif|AVIF$/');
|
||||||
|
|
||||||
echo '<h3>' . count($dir) . gettext(' images found in folder') . ' <i><a href="photos/img/">photos/img/</a></i> ...</h3>';
|
echo '<h3>' . count($dir) . gettext(' images found in folder') . ' <i><a href="' . $chemin . '">photos/img/</a></i> ...</h3>';
|
||||||
|
|
||||||
echo '<h3>' . gettext("Creation of the database") . ' <i>' . $base . '</i> ' . gettext("and the table") . ' <i>photo</i> (' . gettext("if necessary") . ')...</h3>';
|
echo '<h3>' . gettext("Creation of the database") . ' <i>' . $base . '</i> ' . gettext("and the table") . ' <i>photo</i> (' . gettext("if necessary") . ')...</h3>';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// Création de la base et de la table photos
|
// Création de la base et de la table photos
|
||||||
$conn = new PDO("sqlite:db_photo.sqlite3");
|
$conn = new PDO("sqlite:$base");
|
||||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
$query = "CREATE TABLE IF NOT EXISTS photos (
|
$query = "CREATE TABLE IF NOT EXISTS photos (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
@@ -94,7 +102,7 @@ try {
|
|||||||
echo $e->getMessage();
|
echo $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<h3>' . gettext('Read image files in the folder') . ' <i><a href="photos/img/">photos/img/</a></i>...</h3>';
|
echo '<h3>' . gettext('Read image files in the folder') . ' <i><a href="' . $chemin . '">photos/img/</a></i>...</h3>';
|
||||||
|
|
||||||
$i = 1;
|
$i = 1;
|
||||||
$photos = array();
|
$photos = array();
|
||||||
@@ -105,8 +113,11 @@ foreach($dir as $file){
|
|||||||
pathName()
|
pathName()
|
||||||
*/
|
*/
|
||||||
$file = $file->getpathName();
|
$file = $file->getpathName();
|
||||||
$x = in_bdd($file);
|
//$file = $file->getFilename();
|
||||||
|
echo $file;
|
||||||
|
|
||||||
|
$x = in_bdd($file);
|
||||||
|
echo $x;
|
||||||
/*
|
/*
|
||||||
if ($i > 5) {
|
if ($i > 5) {
|
||||||
break;
|
break;
|
||||||
@@ -386,7 +397,7 @@ foreach($dir as $file){
|
|||||||
|
|
||||||
|
|
||||||
$photos[$i] = array(
|
$photos[$i] = array(
|
||||||
'filename' => $file,
|
'filename' => basename($file),
|
||||||
'filesize' => $fsize,
|
'filesize' => $fsize,
|
||||||
|
|
||||||
'dateoriginal' => $da,
|
'dateoriginal' => $da,
|
||||||
@@ -524,7 +535,12 @@ foreach($dir as $file){
|
|||||||
$z = count($photos);
|
$z = count($photos);
|
||||||
if ($z == 0) {
|
if ($z == 0) {
|
||||||
echo '<h3>' . gettext('No new image files to add') . '...</h3>';
|
echo '<h3>' . gettext('No new image files to add') . '...</h3>';
|
||||||
echo '<p class="navPage"><a href="index.php" title="' . gettext("Home") . '">' . gettext("Home") . '</a> | <a href="maps.php" title="' . gettext("Maps") .'">' . gettext("Maps") . '</a> | <a href="photo-du-mois.php" title="' . gettext("Picture of the month") . '">' . gettext("Picture of the month") . '</a></p>';
|
echo '<p class="navPage"><a href="../index.php" title="' . gettext("Home") . '">' . gettext("Home") . '</a>
|
||||||
|
| <a href="../photo-du-mois.php" title="' . gettext("Picture of the month") . '">' . gettext("Picture of the month") . '</a>
|
||||||
|
| <a href="../maps.php" title="' . gettext("Maps") .'">' . gettext("Maps") . '</a>
|
||||||
|
| <a href="admin.php" title="' . gettext("Admin page") . '">' . gettext("Admin page") . '</a>
|
||||||
|
| ' . $logout . '</p>';
|
||||||
|
|
||||||
|
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
@@ -540,11 +556,12 @@ $avant = $resultat['MAX(id)'];
|
|||||||
$nb_avant = (isset($avant)) ? $avant : 0;
|
$nb_avant = (isset($avant)) ? $avant : 0;
|
||||||
|
|
||||||
|
|
||||||
echo '<h3>' . gettext('Creation of thumbnails') . ' ('. $th_w . 'px x ' . $th_h . 'px) ' . gettext('in the folder') . ' <i><a href="photos/img/">photos/thumb/</a></i>.</h3>';
|
echo '<h3>' . gettext('Creation of thumbnails') . ' ('. $th_w . 'px x ' . $th_h . 'px) ' . gettext('in the folder') . ' <i><a href="' . $chemin . '">photos/thumb/</a></i>.</h3>';
|
||||||
|
|
||||||
$b = ($z > 1) ? gettext('new images') : gettext('new image');
|
$b = ($z > 1) ? gettext('new images') : gettext('new image');
|
||||||
echo '<h3>' . gettext('Insertion of ') . $z . ' ' . $b . gettext(' in database') . '...</h3>';
|
echo '<h3>' . gettext('Insertion of ') . $z . ' ' . $b . gettext(' in database') . '...</h3>';
|
||||||
|
|
||||||
|
$short = basename($file);
|
||||||
// Insertion des photos dans la base
|
// Insertion des photos dans la base
|
||||||
// Création des vignettes
|
// Création des vignettes
|
||||||
try {
|
try {
|
||||||
@@ -636,7 +653,8 @@ try {
|
|||||||
$titre = $item['title']; // ***
|
$titre = $item['title']; // ***
|
||||||
$legende = $item['legende']; // ***
|
$legende = $item['legende']; // ***
|
||||||
|
|
||||||
create_thumb($th_w, $th_h, $file);
|
$big = $chemin . $file;
|
||||||
|
create_thumb($th_w, $th_h, $big);
|
||||||
|
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
}
|
}
|
||||||
@@ -707,12 +725,13 @@ try {
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<p class="navPage"><a href="index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></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="maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="admin.php" title="<?php echo gettext("Admin page"); ?>"><?php echo gettext("Admin page"); ?></a></p>
|
|
||||||
|
<p class="navPage"><a href="../index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></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="../maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="admin.php" title="<?php echo gettext("Admin page"); ?>"><?php echo gettext("Admin page"); ?></a> | <?php echo $logout; ?></p>
|
||||||
|
|
||||||
<p><em><small>© 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
|
<p><em><small>© 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
|
||||||
|
|
||||||
<script src='lc-lightbox/js/lc_lightbox.min.js' type='text/javascript'></script>
|
<script src='../lc-lightbox/js/lc_lightbox.min.js' type='text/javascript'></script>
|
||||||
<script src='lc-lightbox/lib/AlloyFinger/alloy_finger.min.js' type='text/javascript'></script>
|
<script src='../lc-lightbox/lib/AlloyFinger/alloy_finger.min.js' type='text/javascript'></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
@@ -1,15 +1,18 @@
|
|||||||
<?php require ("3-protect.php");
|
<?php
|
||||||
include 'localize.php';
|
require ("3-protect.php");
|
||||||
$domain = 'sentier';
|
//session_start();
|
||||||
localize($domain);
|
include '../i18n_setup.php';
|
||||||
include 'functions.php';
|
/*include 'localize.php';
|
||||||
|
$domain = 'sentier';
|
||||||
|
localize($domain);
|
||||||
|
*/
|
||||||
|
include '../functions.php';
|
||||||
|
|
||||||
$base = 'db_photo.sqlite3';
|
$base = '../db_photo.sqlite3';
|
||||||
$conn = new PDO("sqlite:$base");
|
$conn = new PDO("sqlite:$base");
|
||||||
$msg = "";
|
$msg = "";
|
||||||
|
|
||||||
$conn = new PDO("sqlite:db_photo.sqlite3");
|
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
||||||
|
|
||||||
//echo "<a href='close.php'> close session </a><br />";
|
//echo "<a href='close.php'> close session </a><br />";
|
||||||
|
|
||||||
@@ -156,10 +159,10 @@ else {
|
|||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
<title><?php gettext('View photos in Sqlite base'); ?></title>
|
<title><?php gettext('View photos in Sqlite base'); ?></title>
|
||||||
|
|
||||||
<link rel="stylesheet" href="css/sls.css" />
|
<link rel="stylesheet" href="../css/sls.css" />
|
||||||
<link rel='stylesheet' href='lc-lightbox/css/lc_lightbox.min.css' />
|
<link rel='stylesheet' href='../lc-lightbox/css/lc_lightbox.min.css' />
|
||||||
<link rel='stylesheet' href='lc-lightbox/css/open_close_fx.css' />
|
<link rel='stylesheet' href='../lc-lightbox/css/open_close_fx.css' />
|
||||||
<link rel='stylesheet' href='lc-lightbox/skins/minimal.css' />
|
<link rel='stylesheet' href='../lc-lightbox/skins/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" />
|
<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" />
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
||||||
@@ -184,7 +187,7 @@ else {
|
|||||||
$req_edit = "SELECT * FROM photos WHERE " . $req . " ORDER BY id";
|
$req_edit = "SELECT * FROM photos WHERE " . $req . " ORDER BY id";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$conn = new PDO('sqlite:db_photo.sqlite3');
|
$conn = new PDO("sqlite:../$base");
|
||||||
$stmt = $conn->prepare($req_edit);
|
$stmt = $conn->prepare($req_edit);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
||||||
@@ -199,10 +202,12 @@ else {
|
|||||||
|
|
||||||
$nRows = 0;
|
$nRows = 0;
|
||||||
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||||
$thumbnail = host() . str_replace("photos/img", "photos/thumb", $row['filename']);
|
//$thumbnail = host() . str_replace("photos/img", "photos/thumb", $row['filename']);
|
||||||
$full = host() . $row['filename'];
|
//$full = host() . $row['filename'];
|
||||||
|
$lb = data_for_lightbox($row);
|
||||||
|
|
||||||
echo '<tr><td>' . $row['id'] . '</td><td>' . '<a href="' . $full . '"><img src="'.$thumbnail.'" /></a>' . '</td>';
|
//echo '<tr><td>' . $row['id'] . '</td><td>' . '<a href="' . $full . '"><img src="'.$thumbnail.'" /></a>' . '</td>';
|
||||||
|
echo '<tr><td>' . $row['id'] . '</td><td>' . '<a href="' . $lb['big'] . '"><img src="' . $lb['big'] . '" /></a>' . '</td>';
|
||||||
echo '<td>' . $row['filename'] . '</td><td>' . $row['dateoriginal'] . '</td>';
|
echo '<td>' . $row['filename'] . '</td><td>' . $row['dateoriginal'] . '</td>';
|
||||||
echo '<td>' . $row['speed'] . '</td><td>' . $row['iso'] . '</td><td>' . $row['aperture'] . '</td><td>' . $row['correctexpo'] . '</td>';
|
echo '<td>' . $row['speed'] . '</td><td>' . $row['iso'] . '</td><td>' . $row['aperture'] . '</td><td>' . $row['correctexpo'] . '</td>';
|
||||||
echo '<td>' . $row['model'] . '</td>';
|
echo '<td>' . $row['model'] . '</td>';
|
||||||
@@ -236,13 +241,14 @@ else {
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<?php $logout = (isset($_SESSION["user"])) ? '<a class="" href="4-logout.php" role="button">' . gettext("Log out") . '</a>' : ''; ?>
|
||||||
|
|
||||||
<p class="navPage"><a href="index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></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="maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="admin.php" title="<?php echo gettext("Admin page"); ?>"><?php echo gettext("Admin page"); ?></a></p>
|
<p class="navPage"><a href="../index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></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="../maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="admin.php" title="<?php echo gettext("Admin page"); ?>"><?php echo gettext("Admin page"); ?></a> | <?php echo $logout; ?></p>
|
||||||
|
|
||||||
<p><em><small>© 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
|
<p><em><small>© 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
|
||||||
|
|
||||||
<script src='lc-lightbox/js/lc_lightbox.min.js' type='text/javascript'></script>
|
<script src='../lc-lightbox/js/lc_lightbox.min.js' type='text/javascript'></script>
|
||||||
<script src='lc-lightbox/lib/AlloyFinger/alloy_finger.min.js' type='text/javascript'></script>
|
<script src='../lc-lightbox/lib/AlloyFinger/alloy_finger.min.js' type='text/javascript'></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
@@ -1,9 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
require ("3-protect.php");
|
require ("3-protect.php");
|
||||||
include 'localize.php';
|
//session_start();
|
||||||
$domain = 'sentier';
|
include '../i18n_setup.php';
|
||||||
localize($domain);
|
/*include 'localize.php';
|
||||||
include 'functions.php';
|
$domain = 'sentier';
|
||||||
|
localize($domain);
|
||||||
|
*/
|
||||||
|
include '../functions.php';
|
||||||
|
|
||||||
|
$chemin = '../photos/img/';
|
||||||
|
$base = '../db_photo.sqlite3';
|
||||||
|
|
||||||
if (isset($_SERVER['HTTP_REFERER'])){
|
if (isset($_SERVER['HTTP_REFERER'])){
|
||||||
$id = $_GET['id'];
|
$id = $_GET['id'];
|
||||||
@@ -22,26 +28,34 @@ if (isset($_SERVER['HTTP_REFERER'])){
|
|||||||
$software = $_GET['software'];
|
$software = $_GET['software'];
|
||||||
$column = $_GET['column'];
|
$column = $_GET['column'];
|
||||||
$order = $_GET['order'];
|
$order = $_GET['order'];
|
||||||
|
|
||||||
|
echo $filename;
|
||||||
|
/*
|
||||||
class MyDB extends SQLite3 {
|
class MyDB extends SQLite3 {
|
||||||
function __construct() {
|
function __construct() {
|
||||||
$this->open('db_photo.sqlite3');
|
$this->open('../db_photo.sqlite3');
|
||||||
|
//$this->open($base);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$db = new MyDB();
|
$db = new MyDB();
|
||||||
|
*/
|
||||||
|
$db = new SQLite3($base);
|
||||||
|
|
||||||
if(!$db){
|
if(!$db){
|
||||||
echo $db->lastErrorMsg();
|
echo $db->lastErrorMsg();
|
||||||
} else {
|
} else {
|
||||||
$ret = $db->query("SELECT * FROM photos WHERE id LIKE '$id%' AND filename LIKE '%$filename%' AND dateoriginal LIKE '%$dateoriginal%' AND speed LIKE '$speed%' AND iso LIKE '$iso%' AND aperture LIKE '$aperture%' AND correctexpo LIKE '$correctexpo%' AND model LIKE '%$model%' AND lens LIKE '%$lens%' AND focal LIKE '%$focal%' AND metering LIKE '%$metering%' AND program LIKE '%$program%' AND wb LIKE '%$wb%' AND software LIKE '%$software%' ORDER BY $column $order");
|
$ret = $db->query("SELECT * FROM photos WHERE id LIKE '$id%' AND filename LIKE '%$filename%' AND dateoriginal LIKE '%$dateoriginal%' AND speed LIKE '$speed%' AND iso LIKE '$iso%' AND aperture LIKE '$aperture%' AND correctexpo LIKE '$correctexpo%' AND model LIKE '%$model%' AND lens LIKE '%$lens%' AND focal LIKE '%$focal%' AND metering LIKE '%$metering%' AND program LIKE '%$program%' AND wb LIKE '%$wb%' AND software LIKE '%$software%' ORDER BY $column $order");
|
||||||
while($row = $ret->fetchArray(SQLITE3_ASSOC) ){
|
while($row = $ret->fetchArray(SQLITE3_ASSOC) ){
|
||||||
|
|
||||||
$thumbnail = host() . str_replace("photos/img", "photos/thumb", $row['filename']);
|
//$thumbnail = host() . str_replace("img", "thumb", $chemin) . $row['filename'];
|
||||||
$full = host() . $row['filename'];
|
//$full = host() . $chemin . $row['filename'];
|
||||||
$lb = data_for_lightbox($row);
|
$lb = data_for_lightbox($row);
|
||||||
|
|
||||||
echo "<tr>";
|
echo "<tr>";
|
||||||
echo (isset($_SESSION["user"])) ? '<td>' . '<input type="checkbox" id="edit" name="coche[]" value="' . $row['id'] . '" >' . '</td>' : '';
|
echo (isset($_SESSION["user"])) ? '<td>' . '<input type="checkbox" id="edit" name="coche[]" value="' . $row['id'] . '" >' . '</td>' : '';
|
||||||
echo "<td class='priority-1 center'>".$row['id']."</td>";
|
echo "<td class='priority-1 center'>".$row['id']."</td>";
|
||||||
echo "<td class='priority-1'>" . "<a href='" . $full . "' title='" . htmlspecialchars($lb['title']) . "' data-lcl-txt='" . htmlspecialchars($lb['description']) . "' data-lcl-author='" . htmlspecialchars($lb['creator']) . "' /><img src='" . $thumbnail . "' alt='" . htmlspecialchars($lb['title']) . "' /></a></td>";
|
//echo "<td class='priority-1'>" . "<a href='" . $full . "' title='" . htmlspecialchars($lb['title']) . "' data-lcl-txt='" . htmlspecialchars($lb['description']) . "' data-lcl-author='" . htmlspecialchars($lb['creator']) . "' /><img src='" . $thumbnail . "' alt='" . htmlspecialchars($lb['title']) . "'></a></td>";
|
||||||
|
echo "<td class='priority-1'>" . "<a href='" . $lb['big'] . "' title='" . htmlspecialchars($lb['title']) . "' data-lcl-txt='" . htmlspecialchars($lb['description']) . "' data-lcl-author='" . htmlspecialchars($lb['creator']) . "' /><img src='" . $lb['thumb'] . "' alt='" . htmlspecialchars($lb['title']) . "'></a></td>";
|
||||||
echo "<td class='priority-2'>".$row['filename']."</td>";
|
echo "<td class='priority-2'>".$row['filename']."</td>";
|
||||||
echo "<td class='priority-8'>".$row['dateoriginal']."</td>";
|
echo "<td class='priority-8'>".$row['dateoriginal']."</td>";
|
||||||
echo "<td class='priority-3'>".$row['speed']."</td>";
|
echo "<td class='priority-3'>".$row['speed']."</td>";
|
||||||
@@ -1,8 +1,12 @@
|
|||||||
<?php //require ("3-protect.php");
|
<?php
|
||||||
|
require ("3-protect.php");
|
||||||
include 'functions.php';
|
//session_start();
|
||||||
|
include '../i18n_setup.php';
|
||||||
|
/*include 'localize.php';
|
||||||
$domain = 'sentier';
|
$domain = 'sentier';
|
||||||
localize($domain);
|
localize($domain);
|
||||||
|
*/
|
||||||
|
include '../functions.php';
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
@@ -13,10 +17,10 @@ localize($domain);
|
|||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
<title><?php echo gettext('View photos in Sqlite base'); ?></title>
|
<title><?php echo gettext('View photos in Sqlite base'); ?></title>
|
||||||
|
|
||||||
<link rel="stylesheet" href="css/sls.css" />
|
<link rel="stylesheet" href="../css/sls.css" />
|
||||||
<link rel='stylesheet' href='lc-lightbox/css/lc_lightbox.min.css' />
|
<link rel='stylesheet' href='../lc-lightbox/css/lc_lightbox.min.css' />
|
||||||
<link rel='stylesheet' href='lc-lightbox/css/open_close_fx.css' />
|
<link rel='stylesheet' href='../lc-lightbox/css/open_close_fx.css' />
|
||||||
<link rel='stylesheet' href='lc-lightbox/skins/minimal.css' />
|
<link rel='stylesheet' href='../lc-lightbox/skins/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" />
|
<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" />
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
||||||
@@ -29,7 +33,7 @@ localize($domain);
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$base = 'db_photo.sqlite3';
|
$base = '../db_photo.sqlite3';
|
||||||
|
|
||||||
_pr($_POST);
|
_pr($_POST);
|
||||||
/*
|
/*
|
||||||
@@ -50,7 +54,7 @@ if (! empty($_POST)){
|
|||||||
$req = "SELECT * FROM photos WHERE " . $key . " = '" . $val . "'";
|
$req = "SELECT * FROM photos WHERE " . $key . " = '" . $val . "'";
|
||||||
echo $req;
|
echo $req;
|
||||||
|
|
||||||
$conn2 = new PDO("sqlite:db_photo.sqlite3");
|
$conn2 = new PDO("sqlite:$base");
|
||||||
$conn2->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$conn2->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
|
||||||
$limit = 13;
|
$limit = 13;
|
||||||
@@ -74,7 +78,7 @@ _pr($_POST);
|
|||||||
echo '<a href="requests.php">requests</a>';
|
echo '<a href="requests.php">requests</a>';
|
||||||
|
|
||||||
|
|
||||||
$conn = new PDO("sqlite:db_photo.sqlite3");
|
$conn = new PDO("sqlite:$base");
|
||||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
|
||||||
$request = array(
|
$request = array(
|
||||||
@@ -227,12 +231,12 @@ https://www.csscodelab.com/pure-css-custom-select-box-dropdown-styling/
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p class="navPage"><a href="index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></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="maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="admin.php" title="<?php echo gettext("Admin page"); ?>"><?php echo gettext("Admin page"); ?></a></p>
|
<p class="navPage"><a href="../index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></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="../maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="admin.php" title="<?php echo gettext("Admin page"); ?>"><?php echo gettext("Admin page"); ?></a></p>
|
||||||
|
|
||||||
<p><em><small>© 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
|
<p><em><small>© 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
|
||||||
|
|
||||||
<script src='lc-lightbox/js/lc_lightbox.min.js' type='text/javascript'></script>
|
<script src='../lc-lightbox/js/lc_lightbox.min.js' type='text/javascript'></script>
|
||||||
<script src='lc-lightbox/lib/AlloyFinger/alloy_finger.min.js' type='text/javascript'></script>
|
<script src='../lc-lightbox/lib/AlloyFinger/alloy_finger.min.js' type='text/javascript'></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
@@ -1,47 +1,22 @@
|
|||||||
<?php require ("3-protect.php");
|
<?php
|
||||||
include 'localize.php';
|
require ("3-protect.php");
|
||||||
$domain = 'sentier';
|
//session_start();
|
||||||
localize($domain);
|
include '../i18n_setup.php';
|
||||||
include 'functions.php';
|
/*include 'localize.php';
|
||||||
|
$domain = 'sentier';
|
||||||
|
localize($domain);
|
||||||
|
*/
|
||||||
|
include '../functions.php';
|
||||||
|
|
||||||
$base = 'db_photo.sqlite3';
|
$chemin = '../photos/img/';
|
||||||
$conn = new PDO("sqlite:$base");
|
|
||||||
$msg = "";
|
|
||||||
|
|
||||||
if(!empty($_GET['message'])) {
|
$base = '../db_photo.sqlite3';
|
||||||
$msg = "<h3 class='redstyle'>" . $_GET['message'] . "</h3>";
|
$conn = new PDO("sqlite:$base");
|
||||||
}
|
$msg = "";
|
||||||
|
|
||||||
if (isset($_SESSION["user"])) {
|
if(!empty($_GET['message'])) {
|
||||||
if ((isset($_POST["suppress"])) && ($_POST["suppress"] == "suppress")) {
|
$msg = "<h3 class='redstyle'>" . $_GET['message'] . "</h3>";
|
||||||
if (isset($_POST['coche']) && (! empty($_POST['coche']))) {
|
}
|
||||||
$rr = "";
|
|
||||||
foreach($_POST['coche'] as $key => $value) {
|
|
||||||
$r = "id = " . $value . " OR ";
|
|
||||||
$rr .= $r;
|
|
||||||
}
|
|
||||||
|
|
||||||
$req_delete = substr($rr, 0, strlen($rr)-4);
|
|
||||||
|
|
||||||
try {
|
|
||||||
$req = "DELETE FROM Photos WHERE (" . $req_delete . ")";
|
|
||||||
$stmt = $conn->prepare($req);
|
|
||||||
$stmt->execute();
|
|
||||||
$nb = $stmt->rowCount();
|
|
||||||
}
|
|
||||||
catch(PDOException $e) {
|
|
||||||
echo $e->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
$msg = (($nb > 0) ? "<h3 class='greenstyle'>" . $nb . gettext(' photos successfully deleted !') . "</h3>" : "");
|
|
||||||
$request_delete = $req;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$msg = "<h3 class='redstyle'>" . gettext('Empty request !') . "</h3>" ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// }
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
@@ -49,13 +24,23 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
|
<meta name="description" content="Sur le sentier: admin">
|
||||||
<title><?php echo gettext('View photos in Sqlite base'); ?></title>
|
<title><?php echo gettext('View photos in Sqlite base'); ?></title>
|
||||||
|
<meta name="msapplication-TileColor" content="#2b5797">
|
||||||
|
<meta name="msapplication-config" content="/icons/browserconfig.xml">
|
||||||
|
<meta name="theme-color" content="#ffffff">
|
||||||
|
<link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-touch-icon.png">
|
||||||
|
<link rel="icon" type="image/png" sizes="32x32" href="/icons/favicon-32x32.png">
|
||||||
|
<link rel="icon" type="image/png" sizes="16x16" href="/icons/favicon-16x16.png">
|
||||||
|
<link rel="manifest" href="/icons/site.webmanifest">
|
||||||
|
<link rel="shortcut icon" href="/icons/favicon.ico">
|
||||||
|
|
||||||
<link rel="stylesheet" href="css/sls.css" />
|
<link rel="stylesheet" href="../css/sls.css">
|
||||||
<link rel='stylesheet' href='lc-lightbox/css/lc_lightbox.min.css' />
|
|
||||||
<link rel='stylesheet' href='lc-lightbox/css/open_close_fx.css' />
|
<link rel='stylesheet' href='../lc-lightbox/css/lc_lightbox.min.css'>
|
||||||
<link rel='stylesheet' href='lc-lightbox/skins/minimal.css' />
|
<link rel='stylesheet' href='../lc-lightbox/css/open_close_fx.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" />
|
<link rel='stylesheet' href='../lc-lightbox/skins/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">
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
|
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
@@ -105,7 +90,7 @@ function showUser(column) {
|
|||||||
<body onload="showUser('')">
|
<body onload="showUser('')">
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
echo '<h1>' . gettext('View database') . ': ' . $base . '</h1><br />';
|
echo '<h1>' . gettext('View database') . ': ' . $base . '</h1><br>';
|
||||||
|
|
||||||
echo $msg;
|
echo $msg;
|
||||||
?>
|
?>
|
||||||
@@ -114,7 +99,8 @@ function showUser(column) {
|
|||||||
if (isset($_SESSION["user"])) {
|
if (isset($_SESSION["user"])) {
|
||||||
echo '<form id="viewSelect" name="viewSelect" action="view_bdd.php" method="post" class="myForm" >';
|
echo '<form id="viewSelect" name="viewSelect" action="view_bdd.php" method="post" class="myForm" >';
|
||||||
echo '<button type="submit" formaction="edit_bdd.php" name="edit" value="edit" class="myButton all">' . gettext('Edit') . '</button>';
|
echo '<button type="submit" formaction="edit_bdd.php" name="edit" value="edit" class="myButton all">' . gettext('Edit') . '</button>';
|
||||||
echo '<button type="submit" name="suppress" value="suppress" class="myButton all">' . gettext('Suppress') . '</button>';
|
//echo '<button type="submit" name="suppress" value="suppress" class="myButton all">' . gettext('Suppress') . '</button>';
|
||||||
|
echo '<button type="submit" formaction="delete_bdd.php" name="suppress" value="suppress" class="myButton all">' . gettext('Suppress') . '</button>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@@ -167,12 +153,13 @@ function showUser(column) {
|
|||||||
<?php
|
<?php
|
||||||
if (isset($_SESSION["user"])) {
|
if (isset($_SESSION["user"])) {
|
||||||
echo '<button type="submit" formaction="edit_bdd.php" name="edit" value="edit" class="myButton all">' . gettext('Edit') . '</button>';
|
echo '<button type="submit" formaction="edit_bdd.php" name="edit" value="edit" class="myButton all">' . gettext('Edit') . '</button>';
|
||||||
echo '<button type="submit" name="suppress" value="supress" class="myButton all">' . gettext('Suppress') . '</button>';
|
//echo '<button type="submit" name="suppress" value="suppress" class="myButton all">' . gettext('Suppress') . '</button>';
|
||||||
|
echo '<button type="submit" formaction="delete_bdd.php" name="suppress" value="suppress" class="myButton all">' . gettext('Suppress') . '</button>';
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<script type='text/javascript'>
|
<script>
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
@@ -226,14 +213,14 @@ function showUser(column) {
|
|||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<?php $logout = (isset($_SESSION["user"])) ? '<a class="" href="4-logout.php" role="button">' . gettext("Log out") . '</a></p>' : ''; ?>
|
<?php $logout = (isset($_SESSION["user"])) ? '<a class="" href="4-logout.php" role="button">' . gettext("Log out") . '</a>' : ''; ?>
|
||||||
|
|
||||||
<p class="navPage"><a href="index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></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="maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="admin.php" title="<?php echo gettext("Admin page"); ?>"><?php echo gettext("Admin page"); ?></a> | <?php echo $logout; ?></p>
|
<p class="navPage"><a href="../index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></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="../maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="admin.php" title="<?php echo gettext("Admin page"); ?>"><?php echo gettext("Admin page"); ?></a> | <?php echo $logout; ?></p>
|
||||||
|
|
||||||
<p><em><small>© 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
|
<p><em><small>© 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
|
||||||
|
|
||||||
<script src='lc-lightbox/js/lc_lightbox.min.js' type='text/javascript'></script>
|
<script src='../lc-lightbox/js/lc_lightbox.min.js'></script>
|
||||||
<script src='lc-lightbox/lib/AlloyFinger/alloy_finger.min.js' type='text/javascript'></script>
|
<script src='../lc-lightbox/lib/AlloyFinger/alloy_finger.min.js'></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -1,57 +1,28 @@
|
|||||||
<?php require ("3-protect.php");
|
<?php
|
||||||
session_start();
|
require ("3-protect.php");
|
||||||
include 'localize.php';
|
//session_start();
|
||||||
|
include '../i18n_setup.php';
|
||||||
|
/*include 'localize.php';
|
||||||
$domain = 'sentier';
|
$domain = 'sentier';
|
||||||
localize($domain);
|
localize($domain);
|
||||||
include 'functions.php';
|
*/
|
||||||
|
include '../functions.php';
|
||||||
|
|
||||||
$base = 'db_photo.sqlite3';
|
$chemin = '../photos/img/';
|
||||||
|
|
||||||
|
$base = '../db_photo.sqlite3';
|
||||||
$perpage = 20;
|
$perpage = 20;
|
||||||
|
|
||||||
$conn = new PDO("sqlite:db_photo.sqlite3");
|
$conn = new PDO("sqlite:$base");
|
||||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
|
||||||
if (!isset($_GET['page'])) $page = 1;
|
if (!isset($_GET['page'])) $page = 1;
|
||||||
else $page = intval($_GET['page']);
|
else $page = intval($_GET['page']);
|
||||||
|
|
||||||
|
|
||||||
// Suppression d'images
|
|
||||||
|
|
||||||
if (isset($_SESSION["user"])) {
|
|
||||||
if ((isset($_POST["suppress"])) && ($_POST["suppress"] == "suppress")) {
|
|
||||||
if (isset($_POST['coche']) && (! empty($_POST['coche']))) {
|
|
||||||
$rr = "";
|
|
||||||
foreach($_POST['coche'] as $key => $value) {
|
|
||||||
$r = "id = " . $value . " OR ";
|
|
||||||
$rr .= $r;
|
|
||||||
}
|
|
||||||
|
|
||||||
$req_delete = substr($rr, 0, strlen($rr)-4);
|
|
||||||
|
|
||||||
try {
|
|
||||||
$req = "DELETE FROM Photos WHERE (" . $req_delete . ")";
|
|
||||||
$stmt = $conn->prepare($req);
|
|
||||||
$stmt->execute();
|
|
||||||
$nb = $stmt->rowCount();
|
|
||||||
}
|
|
||||||
catch(PDOException $e) {
|
|
||||||
echo $e->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
$msg = (($nb > 0) ? "<h3 class='greenstyle'>" . $nb . gettext(' photos successfully deleted !') . "</h3>" : "");
|
|
||||||
$request_delete = $req;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$msg = "<h3 class='redstyle'>" . gettext('Empty request !') . "</h3>" ;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$gps = (isset($_SESSION['query']['gps'])) ? $_SESSION['query']['gps'] : "off";
|
$gps = (isset($_SESSION['query']['gps'])) ? $_SESSION['query']['gps'] : "off";
|
||||||
|
|
||||||
$dir = (new AdvancedFilesystemIterator('photos/img/'))->match('/heic|HEIC|jpg|jpeg|JPG|JPEG|webp|WEBP$/');
|
$dir = (new AdvancedFilesystemIterator($chemin))->match('/heic|HEIC|jpg|jpeg|JPG|JPEG|webp|WEBP$/');
|
||||||
|
|
||||||
|
|
||||||
$request = array(
|
$request = array(
|
||||||
@@ -95,13 +66,23 @@ foreach ($request as $key => $val){
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
|
<meta name="description" content="Sur le sentier: admin">
|
||||||
<title><?php echo gettext('View photos in Sqlite base'); ?></title>
|
<title><?php echo gettext('View photos in Sqlite base'); ?></title>
|
||||||
|
<meta name="msapplication-TileColor" content="#2b5797">
|
||||||
|
<meta name="msapplication-config" content="/icons/browserconfig.xml">
|
||||||
|
<meta name="theme-color" content="#ffffff">
|
||||||
|
<link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-touch-icon.png">
|
||||||
|
<link rel="icon" type="image/png" sizes="32x32" href="/icons/favicon-32x32.png">
|
||||||
|
<link rel="icon" type="image/png" sizes="16x16" href="/icons/favicon-16x16.png">
|
||||||
|
<link rel="manifest" href="/icons/site.webmanifest">
|
||||||
|
<link rel="shortcut icon" href="/icons/favicon.ico">
|
||||||
|
|
||||||
<link rel="stylesheet" href="css/sls.css" />
|
<link rel="stylesheet" href="../css/sls.css">
|
||||||
<link rel='stylesheet' href='lc-lightbox/css/lc_lightbox.min.css' />
|
|
||||||
<link rel='stylesheet' href='lc-lightbox/css/open_close_fx.css' />
|
<link rel='stylesheet' href='../lc-lightbox/css/lc_lightbox.min.css'>
|
||||||
<link rel='stylesheet' href='lc-lightbox/skins/minimal.css' />
|
<link rel='stylesheet' href='../lc-lightbox/css/open_close_fx.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" />
|
<link rel='stylesheet' href='../lc-lightbox/skins/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">
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
|
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
@@ -110,7 +91,7 @@ foreach ($request as $key => $val){
|
|||||||
<body>
|
<body>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
echo '<h1>' . gettext('View database') . ': ' . $base . '</h1><br />';
|
echo '<h1>' . gettext('View database') . ': ' . $base . '</h1><br>';
|
||||||
|
|
||||||
// Affichage des photos
|
// Affichage des photos
|
||||||
|
|
||||||
@@ -178,12 +159,13 @@ try {
|
|||||||
$count = $stmt->fetchColumn(34); // total => 35
|
$count = $stmt->fetchColumn(34); // total => 35
|
||||||
$stmt->execute(array($perpage, $offset));
|
$stmt->execute(array($perpage, $offset));
|
||||||
|
|
||||||
|
|
||||||
if (empty($_POST)) {
|
if (empty($_POST)) {
|
||||||
echo '<h3 class="greenstyle">' . count($dir) . gettext(' images found in folder') . ' <i><a href="photos/img/">photos/img/</a></i> ...</h3>';
|
echo '<h3 class="greenstyle">' . count($dir) . gettext(' images found in folder') . ' <i><a href="' . $chemin . '">photos/img/</a></i> ...</h3>';
|
||||||
// Display request !!
|
// Display request !!
|
||||||
echo '<pre><code>' . $query2 . '</code></pre>';
|
echo '<pre><code>' . $query2 . '</code></pre>';
|
||||||
}
|
}
|
||||||
elseif ($_POST["suppress"] == "suppress") {
|
elseif ((isset($_POST['suppress'])) && ($_POST["suppress"] == "suppress")) {
|
||||||
|
|
||||||
echo $msg;
|
echo $msg;
|
||||||
|
|
||||||
@@ -193,7 +175,9 @@ try {
|
|||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo '<h3 class="greenstyle">' . $count . gettext(' images founds with the following request:') . '</h3>';
|
$found = sprintf(ngettext("%d image found with the following query:","%d images found with the following query:", $count), $count);
|
||||||
|
echo '<h3 class="greenstyle">' . $found . '</h3>';
|
||||||
|
//echo '<h3 class="greenstyle">' . $count . gettext(' images founds with the following request:') . '</h3>';
|
||||||
// Display request !!
|
// Display request !!
|
||||||
echo '<pre><code>' . $query2 . '</code></pre>';
|
echo '<pre><code>' . $query2 . '</code></pre>';
|
||||||
}
|
}
|
||||||
@@ -249,9 +233,9 @@ try {
|
|||||||
</select>
|
</select>
|
||||||
<span class="operateur"><?php echo gettext('Operator:'); ?></span>
|
<span class="operateur"><?php echo gettext('Operator:'); ?></span>
|
||||||
<input type="radio" id="operator1" name="operator" value="AND" checked>
|
<input type="radio" id="operator1" name="operator" value="AND" checked>
|
||||||
<label for="ope1"><?php echo gettext('AND'); ?></label>
|
<label for="operator1"><?php echo gettext('AND'); ?></label>
|
||||||
<input type="radio" id="operator2" name="operator" value="OR">
|
<input type="radio" id="operator2" name="operator" value="OR">
|
||||||
<label for="ope1"><?php echo gettext('OR'); ?></label>
|
<label for="operator2"><?php echo gettext('OR'); ?></label>
|
||||||
|
|
||||||
|
|
||||||
<button type="submit" class="myButton">OK</button>
|
<button type="submit" class="myButton">OK</button>
|
||||||
@@ -293,23 +277,23 @@ try {
|
|||||||
echo '<form id="viewSelect" name="viewSelect" action="view_bdd2.php" method="post" class="myForm" >';
|
echo '<form id="viewSelect" name="viewSelect" action="view_bdd2.php" method="post" class="myForm" >';
|
||||||
|
|
||||||
echo '<button type="submit" formaction="edit_bdd.php" name="edit" value="edit" class="myButton all">' . gettext('Edit') . '</button>';
|
echo '<button type="submit" formaction="edit_bdd.php" name="edit" value="edit" class="myButton all">' . gettext('Edit') . '</button>';
|
||||||
echo '<button type="submit" name="suppress" value="suppress" class="myButton all">' . gettext('Suppress') . '</button>';
|
//echo '<button type="submit" name="suppress" value="suppress" class="myButton all">' . gettext('Suppress') . '</button>';
|
||||||
|
echo '<button type="submit" formaction="delete_bdd.php" name="suppress" value="suppress" class="myButton all">' . gettext('Suppress') . '</button>';
|
||||||
|
|
||||||
echo '<table class="styled-table">';
|
echo '<table class="styled-table">';
|
||||||
echo '<thead>';
|
echo '<thead>';
|
||||||
echo ((isset($_SESSION["user"])) ? '<th>' . gettext('Select') . '</th>' : '') . '<th>' . gettext('Id') . '</th><th>' . gettext('Thumb') . '</th><th>' . gettext('Filename') . ' (' . gettext('Size') . ')</th><th><a class="sort" href="view_bdd.php?column=date&order=' . $asc_or_desc . '">' . gettext('Date') . ' <i class="fas fa-sort' . ($column == 'date' ? '-' . $up_or_down : '') . '"></i></a></th><th><a href="view_bdd.php?column=lens&order=' . $asc_or_desc . '">' . gettext('Lens') . ' <i class="fas fa-sort' . ($column == 'lens' ? '-' . $up_or_down : '') . '"></i></a></th><th>' . gettext('Speed') . '</th><th>' . gettext('Aperture') . '</th><th>' . gettext('Exposure corr.') . '</th><th><a href="view_bdd.php?column=iso&order=' . $asc_or_desc . '">' . gettext('Iso') . ' <i class="fas fa-sort' . ($column == 'iso' ? '-' . $up_or_down : '') . '"></i></a></th><th>' . gettext('Width') . '</th><th>' . gettext('Height') . '</th>';
|
echo '<tr>' . ((isset($_SESSION["user"])) ? '<th>' . gettext('Select') . '</th>' : '') . '<th>' . gettext('Id') . '</th><th>' . gettext('Thumb') . '</th><th>' . gettext('Filename') . ' (' . gettext('Size') . ')</th><th><a class="sort" href="view_bdd.php?column=date&order=' . $asc_or_desc . '">' . gettext('Date') . ' <i class="fas fa-sort' . ($column == 'date' ? '-' . $up_or_down : '') . '"></i></a></th><th><a href="view_bdd.php?column=lens&order=' . $asc_or_desc . '">' . gettext('Lens') . ' <i class="fas fa-sort' . ($column == 'lens' ? '-' . $up_or_down : '') . '"></i></a></th><th>' . gettext('Speed') . '</th><th>' . gettext('Aperture') . '</th><th>' . gettext('Exposure corr.') . '</th><th><a href="view_bdd.php?column=iso&order=' . $asc_or_desc . '">' . gettext('Iso') . ' <i class="fas fa-sort' . ($column == 'iso' ? '-' . $up_or_down : '') . '"></i></a></th><th>' . gettext('Width') . '</th><th>' . gettext('Height') . '</th>';
|
||||||
echo '<th><a href="view_bdd.php?column=model&order=' . $asc_or_desc . '">' . gettext('Model') . ' <i class="fas fa-sort' . ($column == 'Model' ? '-' . $up_or_down : '') . '"></i></a></th><th><a href="view_bdd.php?column=lat&order=' . $asc_or_desc . '">' . gettext('Latitude') . ' <i class="fas fa-sort' . ($column == 'lat' ? '-' . $up_or_down : '') . '"></i></a></th><th>' . gettext('Longitude') . '</th><th>' . gettext('Alttitude') . '</th><th>' . gettext('Legende') . '</th><th>' . gettext('Copyright') . '</th><th>' . gettext('Title') . '</th>';
|
echo '<th><a href="view_bdd.php?column=model&order=' . $asc_or_desc . '">' . gettext('Model') . ' <i class="fas fa-sort' . ($column == 'Model' ? '-' . $up_or_down : '') . '"></i></a></th><th><a href="view_bdd.php?column=lat&order=' . $asc_or_desc . '">' . gettext('Latitude') . ' <i class="fas fa-sort' . ($column == 'lat' ? '-' . $up_or_down : '') . '"></i></a></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>';
|
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></tr>';
|
||||||
echo '</thead>';
|
echo '</thead>';
|
||||||
echo '<tbody>';
|
echo '<tbody>';
|
||||||
|
|
||||||
$nRows = 0;
|
$nRows = 0;
|
||||||
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||||
$thumbnail = host() . str_replace("photos/img", "photos/thumb", $row['filename']);
|
|
||||||
$full = host() . $row['filename'];
|
|
||||||
$lb = data_for_lightbox($row);
|
$lb = data_for_lightbox($row);
|
||||||
|
|
||||||
echo '<tr>' . ((isset($_SESSION["user"])) ? '<td>' . '<input type="checkbox" id="edit" name="coche[]" value="' . $row['id'] . '" >' . '</td>' : '') . '<td>' . $row['id'] . '</td><td>' . '<a href="' . $full . '" title="' . htmlspecialchars($lb['title']) . '" data-lcl-txt="' . htmlspecialchars($lb['description']) . '" data-lcl-author="' . htmlspecialchars($lb['creator']) . '"><img src="'.$thumbnail.'" alt="' . htmlspecialchars($lb['title']) . '" /></a>' . '</td><td>' . $row['filename'] . '<br />(' . $row['filesize'] . ')</td><td>' . $row['dateoriginal'] . '</td><td>' . $row['lens'] . '</td><td>' . $row['speed'] . '</td><td>' . $row['aperture'] . '</td> <td>' . $row['correctexpo'] . '</td><td>' . $row['iso'] . '</td><td>' . $row['width'] . '</td><td>' . $row['height'] . '</td><td>' . $row['model'] . '</td><td>' . $row['lat'] . '</td><td>' . $row['long'] . '</td><td>' . $row['alt'] . '</td><td>' . $row['legende'] . '</td><td>' . $row['copyright'] . '</td><td>' . $row['title'] . '</td><td>' . $row['creator'] . '</td><td>' . $row['keywords'] . '</td><td>' . $row['metering'] . '</td><td>' . $row['flash'] . '</td><td>' . $row['focal'] . '</td><td>' . $row['wb'] . '</td><td>' . $row['program'] . '</td></tr>';
|
echo '<tr>' . ((isset($_SESSION["user"])) ? '<td>' . '<input type="checkbox" id="edit" name="coche[]" value="' . $row['id'] . '" >' . '</td>' : '') . '<td>' . $row['id'] . '</td><td>' . '<a href="' . $lb['big'] . '" title="' . htmlspecialchars($lb['title']) . '" data-lcl-txt="' . htmlspecialchars($lb['description']) . '" data-lcl-author="' . htmlspecialchars($lb['creator']) . '"><img src="' . $lb['thumb']. '" alt="' . htmlspecialchars($lb['title']) . '"></a>' . '</td><td>' . $row['filename'] . '<br>(' . $row['filesize'] . ')</td><td>' . $row['dateoriginal'] . '</td><td>' . $row['lens'] . '</td><td>' . $row['speed'] . '</td><td>' . $row['aperture'] . '</td> <td>' . $row['correctexpo'] . '</td><td>' . $row['iso'] . '</td><td>' . $row['width'] . '</td><td>' . $row['height'] . '</td><td>' . $row['model'] . '</td><td>' . $row['lat'] . '</td><td>' . $row['long'] . '</td><td>' . $row['alt'] . '</td><td>' . $row['legende'] . '</td><td>' . $row['copyright'] . '</td><td>' . $row['title'] . '</td><td>' . $row['creator'] . '</td><td>' . $row['keywords'] . '</td><td>' . $row['metering'] . '</td><td>' . $row['flash'] . '</td><td>' . $row['focal'] . '</td><td>' . $row['wb'] . '</td><td>' . $row['program'] . '</td></tr>';
|
||||||
$nRows++;
|
$nRows++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,7 +302,8 @@ try {
|
|||||||
echo '</tbody></table>';
|
echo '</tbody></table>';
|
||||||
if (isset($_SESSION["user"])) {
|
if (isset($_SESSION["user"])) {
|
||||||
echo '<button type="submit" formaction="edit_bdd.php" name="edit" value="edit" class="myButton all">' . gettext('Edit') . '</button>';
|
echo '<button type="submit" formaction="edit_bdd.php" name="edit" value="edit" class="myButton all">' . gettext('Edit') . '</button>';
|
||||||
echo '<button type="submit" name="suppress" value="supress" class="myButton all">' . gettext('Suppress') . '</button>';
|
//echo '<button type="submit" name="suppress" value="suppress" class="myButton all">' . gettext('Suppress') . '</button>';
|
||||||
|
echo '<button type="submit" formaction="delete_bdd.php" name="suppress" value="suppress" class="myButton all">' . gettext('Suppress') . '</button>';
|
||||||
}
|
}
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
@@ -329,7 +314,7 @@ try {
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<script type='text/javascript'>
|
<script>
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
@@ -395,7 +380,7 @@ try {
|
|||||||
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
$numRows = $result['count'];
|
$numRows = $result['count'];
|
||||||
|
|
||||||
$stmt = $conn->reset();
|
//$stmt = $conn->reset();
|
||||||
$conn = null;
|
$conn = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -424,14 +409,14 @@ try {
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php $logout = (isset($_SESSION["user"])) ? '<a class="" href="4-logout.php" role="button">' . gettext("Log out") . '</a></p>' : ''; ?>
|
<?php $logout = (isset($_SESSION["user"])) ? '<a class="" href="4-logout.php" role="button">' . gettext("Log out") . '</a>' : ''; ?>
|
||||||
|
|
||||||
<p class="navPage"><a href="index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></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="maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="admin.php" title="<?php echo gettext("Admin page"); ?>"><?php echo gettext("Admin page"); ?></a> | <?php echo $logout; ?></p>
|
<p class="navPage"><a href="../index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></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="../maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="admin.php" title="<?php echo gettext("Admin page"); ?>"><?php echo gettext("Admin page"); ?></a> | <?php echo $logout; ?></p>
|
||||||
|
|
||||||
<p><em><small>© 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
|
<p><em><small>© 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
|
||||||
|
|
||||||
<script src='lc-lightbox/js/lc_lightbox.min.js' type='text/javascript'></script>
|
<script src='../lc-lightbox/js/lc_lightbox.min.js'></script>
|
||||||
<script src='lc-lightbox/lib/AlloyFinger/alloy_finger.min.js' type='text/javascript'></script>
|
<script src='../lc-lightbox/lib/AlloyFinger/alloy_finger.min.js'></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
5
composer.json
Normal file
5
composer.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"require": {
|
||||||
|
"phpmyadmin/motranslator": "^5.3"
|
||||||
|
}
|
||||||
|
}
|
||||||
692
composer.lock
generated
Normal file
692
composer.lock
generated
Normal file
@@ -0,0 +1,692 @@
|
|||||||
|
{
|
||||||
|
"_readme": [
|
||||||
|
"This file locks the dependencies of your project to a known state",
|
||||||
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
|
"This file is @generated automatically"
|
||||||
|
],
|
||||||
|
"content-hash": "b102e899e31d62f4d40282ff04a339d9",
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "phpmyadmin/motranslator",
|
||||||
|
"version": "5.3.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/phpmyadmin/motranslator.git",
|
||||||
|
"reference": "d03b4d9c608e7265091bf6decc05323d16c7c047"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/phpmyadmin/motranslator/zipball/d03b4d9c608e7265091bf6decc05323d16c7c047",
|
||||||
|
"reference": "d03b4d9c608e7265091bf6decc05323d16c7c047",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^7.1 || ^8.0",
|
||||||
|
"symfony/expression-language": "^4.0 || ^5.0 || ^6.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpmyadmin/coding-standard": "^3.0.0",
|
||||||
|
"phpstan/phpstan": "^1.4.6",
|
||||||
|
"phpunit/phpunit": "^7.4 || ^8 || ^9"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"ext-apcu": "Needed for ACPu-backed translation cache"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"PhpMyAdmin\\MoTranslator\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"GPL-2.0-or-later"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "The phpMyAdmin Team",
|
||||||
|
"email": "developers@phpmyadmin.net",
|
||||||
|
"homepage": "https://www.phpmyadmin.net/team/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Translation API for PHP using Gettext MO files",
|
||||||
|
"homepage": "https://github.com/phpmyadmin/motranslator",
|
||||||
|
"keywords": [
|
||||||
|
"gettext",
|
||||||
|
"i18n",
|
||||||
|
"mo",
|
||||||
|
"translator"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/phpmyadmin/motranslator/issues",
|
||||||
|
"source": "https://github.com/phpmyadmin/motranslator"
|
||||||
|
},
|
||||||
|
"time": "2023-08-23T18:32:07+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "psr/cache",
|
||||||
|
"version": "3.0.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/php-fig/cache.git",
|
||||||
|
"reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf",
|
||||||
|
"reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.0.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "1.0.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Psr\\Cache\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "PHP-FIG",
|
||||||
|
"homepage": "https://www.php-fig.org/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Common interface for caching libraries",
|
||||||
|
"keywords": [
|
||||||
|
"cache",
|
||||||
|
"psr",
|
||||||
|
"psr-6"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/php-fig/cache/tree/3.0.0"
|
||||||
|
},
|
||||||
|
"time": "2021-02-03T23:26:27+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "psr/container",
|
||||||
|
"version": "2.0.2",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/php-fig/container.git",
|
||||||
|
"reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963",
|
||||||
|
"reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=7.4.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.0.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Psr\\Container\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "PHP-FIG",
|
||||||
|
"homepage": "https://www.php-fig.org/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Common Container Interface (PHP FIG PSR-11)",
|
||||||
|
"homepage": "https://github.com/php-fig/container",
|
||||||
|
"keywords": [
|
||||||
|
"PSR-11",
|
||||||
|
"container",
|
||||||
|
"container-interface",
|
||||||
|
"container-interop",
|
||||||
|
"psr"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/php-fig/container/issues",
|
||||||
|
"source": "https://github.com/php-fig/container/tree/2.0.2"
|
||||||
|
},
|
||||||
|
"time": "2021-11-05T16:47:00+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "psr/log",
|
||||||
|
"version": "3.0.2",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/php-fig/log.git",
|
||||||
|
"reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3",
|
||||||
|
"reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.0.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "3.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Psr\\Log\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "PHP-FIG",
|
||||||
|
"homepage": "https://www.php-fig.org/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Common interface for logging libraries",
|
||||||
|
"homepage": "https://github.com/php-fig/log",
|
||||||
|
"keywords": [
|
||||||
|
"log",
|
||||||
|
"psr",
|
||||||
|
"psr-3"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/php-fig/log/tree/3.0.2"
|
||||||
|
},
|
||||||
|
"time": "2024-09-11T13:17:53+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/cache",
|
||||||
|
"version": "v7.2.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/cache.git",
|
||||||
|
"reference": "e7e983596b744c4539f31e79b0350a6cf5878a20"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/cache/zipball/e7e983596b744c4539f31e79b0350a6cf5878a20",
|
||||||
|
"reference": "e7e983596b744c4539f31e79b0350a6cf5878a20",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.2",
|
||||||
|
"psr/cache": "^2.0|^3.0",
|
||||||
|
"psr/log": "^1.1|^2|^3",
|
||||||
|
"symfony/cache-contracts": "^2.5|^3",
|
||||||
|
"symfony/deprecation-contracts": "^2.5|^3.0",
|
||||||
|
"symfony/service-contracts": "^2.5|^3",
|
||||||
|
"symfony/var-exporter": "^6.4|^7.0"
|
||||||
|
},
|
||||||
|
"conflict": {
|
||||||
|
"doctrine/dbal": "<3.6",
|
||||||
|
"symfony/dependency-injection": "<6.4",
|
||||||
|
"symfony/http-kernel": "<6.4",
|
||||||
|
"symfony/var-dumper": "<6.4"
|
||||||
|
},
|
||||||
|
"provide": {
|
||||||
|
"psr/cache-implementation": "2.0|3.0",
|
||||||
|
"psr/simple-cache-implementation": "1.0|2.0|3.0",
|
||||||
|
"symfony/cache-implementation": "1.1|2.0|3.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"cache/integration-tests": "dev-master",
|
||||||
|
"doctrine/dbal": "^3.6|^4",
|
||||||
|
"predis/predis": "^1.1|^2.0",
|
||||||
|
"psr/simple-cache": "^1.0|^2.0|^3.0",
|
||||||
|
"symfony/clock": "^6.4|^7.0",
|
||||||
|
"symfony/config": "^6.4|^7.0",
|
||||||
|
"symfony/dependency-injection": "^6.4|^7.0",
|
||||||
|
"symfony/filesystem": "^6.4|^7.0",
|
||||||
|
"symfony/http-kernel": "^6.4|^7.0",
|
||||||
|
"symfony/messenger": "^6.4|^7.0",
|
||||||
|
"symfony/var-dumper": "^6.4|^7.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Component\\Cache\\": ""
|
||||||
|
},
|
||||||
|
"classmap": [
|
||||||
|
"Traits/ValueWrapper.php"
|
||||||
|
],
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nicolas Grekas",
|
||||||
|
"email": "p@tchwork.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Provides extended PSR-6, PSR-16 (and tags) implementations",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"keywords": [
|
||||||
|
"caching",
|
||||||
|
"psr6"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/symfony/cache/tree/v7.2.1"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://symfony.com/sponsor",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/fabpot",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2024-12-07T08:08:50+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/cache-contracts",
|
||||||
|
"version": "v3.5.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/cache-contracts.git",
|
||||||
|
"reference": "15a4f8e5cd3bce9aeafc882b1acab39ec8de2c1b"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/cache-contracts/zipball/15a4f8e5cd3bce9aeafc882b1acab39ec8de2c1b",
|
||||||
|
"reference": "15a4f8e5cd3bce9aeafc882b1acab39ec8de2c1b",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.1",
|
||||||
|
"psr/cache": "^3.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-main": "3.5-dev"
|
||||||
|
},
|
||||||
|
"thanks": {
|
||||||
|
"name": "symfony/contracts",
|
||||||
|
"url": "https://github.com/symfony/contracts"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Contracts\\Cache\\": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nicolas Grekas",
|
||||||
|
"email": "p@tchwork.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Generic abstractions related to caching",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"keywords": [
|
||||||
|
"abstractions",
|
||||||
|
"contracts",
|
||||||
|
"decoupling",
|
||||||
|
"interfaces",
|
||||||
|
"interoperability",
|
||||||
|
"standards"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/symfony/cache-contracts/tree/v3.5.1"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://symfony.com/sponsor",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/fabpot",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2024-09-25T14:20:29+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/deprecation-contracts",
|
||||||
|
"version": "v3.5.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/deprecation-contracts.git",
|
||||||
|
"reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6",
|
||||||
|
"reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.1"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-main": "3.5-dev"
|
||||||
|
},
|
||||||
|
"thanks": {
|
||||||
|
"name": "symfony/contracts",
|
||||||
|
"url": "https://github.com/symfony/contracts"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"function.php"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nicolas Grekas",
|
||||||
|
"email": "p@tchwork.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A generic function and convention to trigger deprecation notices",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.1"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://symfony.com/sponsor",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/fabpot",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2024-09-25T14:20:29+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/expression-language",
|
||||||
|
"version": "v6.4.13",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/expression-language.git",
|
||||||
|
"reference": "3524904fb026356a5230cd197f9a4e6a61e0e7df"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/expression-language/zipball/3524904fb026356a5230cd197f9a4e6a61e0e7df",
|
||||||
|
"reference": "3524904fb026356a5230cd197f9a4e6a61e0e7df",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.1",
|
||||||
|
"symfony/cache": "^5.4|^6.0|^7.0",
|
||||||
|
"symfony/deprecation-contracts": "^2.5|^3",
|
||||||
|
"symfony/service-contracts": "^2.5|^3"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Component\\ExpressionLanguage\\": ""
|
||||||
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Fabien Potencier",
|
||||||
|
"email": "fabien@symfony.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Provides an engine that can compile and evaluate expressions",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/symfony/expression-language/tree/v6.4.13"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://symfony.com/sponsor",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/fabpot",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2024-10-09T08:40:40+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/service-contracts",
|
||||||
|
"version": "v3.5.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/service-contracts.git",
|
||||||
|
"reference": "e53260aabf78fb3d63f8d79d69ece59f80d5eda0"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/e53260aabf78fb3d63f8d79d69ece59f80d5eda0",
|
||||||
|
"reference": "e53260aabf78fb3d63f8d79d69ece59f80d5eda0",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.1",
|
||||||
|
"psr/container": "^1.1|^2.0",
|
||||||
|
"symfony/deprecation-contracts": "^2.5|^3"
|
||||||
|
},
|
||||||
|
"conflict": {
|
||||||
|
"ext-psr": "<1.1|>=2"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-main": "3.5-dev"
|
||||||
|
},
|
||||||
|
"thanks": {
|
||||||
|
"name": "symfony/contracts",
|
||||||
|
"url": "https://github.com/symfony/contracts"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Contracts\\Service\\": ""
|
||||||
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Test/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nicolas Grekas",
|
||||||
|
"email": "p@tchwork.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Generic abstractions related to writing services",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"keywords": [
|
||||||
|
"abstractions",
|
||||||
|
"contracts",
|
||||||
|
"decoupling",
|
||||||
|
"interfaces",
|
||||||
|
"interoperability",
|
||||||
|
"standards"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/symfony/service-contracts/tree/v3.5.1"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://symfony.com/sponsor",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/fabpot",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2024-09-25T14:20:29+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/var-exporter",
|
||||||
|
"version": "v7.2.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/var-exporter.git",
|
||||||
|
"reference": "1a6a89f95a46af0f142874c9d650a6358d13070d"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/var-exporter/zipball/1a6a89f95a46af0f142874c9d650a6358d13070d",
|
||||||
|
"reference": "1a6a89f95a46af0f142874c9d650a6358d13070d",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.2"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"symfony/property-access": "^6.4|^7.0",
|
||||||
|
"symfony/serializer": "^6.4|^7.0",
|
||||||
|
"symfony/var-dumper": "^6.4|^7.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Component\\VarExporter\\": ""
|
||||||
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nicolas Grekas",
|
||||||
|
"email": "p@tchwork.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Allows exporting any serializable PHP data structure to plain PHP code",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"keywords": [
|
||||||
|
"clone",
|
||||||
|
"construct",
|
||||||
|
"export",
|
||||||
|
"hydrate",
|
||||||
|
"instantiate",
|
||||||
|
"lazy-loading",
|
||||||
|
"proxy",
|
||||||
|
"serialize"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/symfony/var-exporter/tree/v7.2.0"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://symfony.com/sponsor",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/fabpot",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2024-10-18T07:58:17+00:00"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"packages-dev": [],
|
||||||
|
"aliases": [],
|
||||||
|
"minimum-stability": "stable",
|
||||||
|
"stability-flags": {},
|
||||||
|
"prefer-stable": false,
|
||||||
|
"prefer-lowest": false,
|
||||||
|
"platform": {},
|
||||||
|
"platform-dev": {},
|
||||||
|
"plugin-api-version": "2.6.0"
|
||||||
|
}
|
||||||
@@ -538,7 +538,7 @@
|
|||||||
bottom: -1px;
|
bottom: -1px;
|
||||||
z-index: 5;
|
z-index: 5;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
opcity: 0;
|
opacity: 0;
|
||||||
background: #6f6f6f;
|
background: #6f6f6f;
|
||||||
|
|
||||||
-webkit-transition: all .2s ease;
|
-webkit-transition: all .2s ease;
|
||||||
|
|||||||
14
css/sls.css
14
css/sls.css
@@ -9,7 +9,7 @@ h1 {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2, h3, h4 {
|
h2, h3, h4, h5 {
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
}
|
}
|
||||||
h3 {
|
h3 {
|
||||||
@@ -22,6 +22,11 @@ h4 {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
/*margin-bottom: 2em;*/
|
/*margin-bottom: 2em;*/
|
||||||
}
|
}
|
||||||
|
h5 {
|
||||||
|
font-weight: 200;
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -511,6 +516,13 @@ h3.greenstyle {
|
|||||||
.font10 {
|
.font10 {
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
}
|
}
|
||||||
|
.alert {
|
||||||
|
color: red;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
.redtext {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
input[type="text"], textarea {
|
input[type="text"], textarea {
|
||||||
|
|||||||
145
edit_bdd.php
145
edit_bdd.php
@@ -1,145 +0,0 @@
|
|||||||
<?php require ("3-protect.php");
|
|
||||||
include 'localize.php';
|
|
||||||
$domain = 'sentier';
|
|
||||||
localize($domain);
|
|
||||||
include 'functions.php';
|
|
||||||
|
|
||||||
$base = 'db_photo.sqlite3';
|
|
||||||
$conn = new PDO("sqlite:$base");
|
|
||||||
$msg = "";
|
|
||||||
$req_edit = "";
|
|
||||||
|
|
||||||
if (isset($_SESSION["user"])) {
|
|
||||||
if ((isset($_POST["edit"])) && ($_POST["edit"] == "edit")) {
|
|
||||||
|
|
||||||
if (isset($_POST['coche']) && (! empty($_POST['coche']))) {
|
|
||||||
$rr = "";
|
|
||||||
foreach($_POST['coche'] as $key => $value) {
|
|
||||||
$r = "id = '" . $value . "' OR ";
|
|
||||||
$rr .= $r;
|
|
||||||
}
|
|
||||||
|
|
||||||
$req = substr($rr, 0, -4);
|
|
||||||
$req_edit = "SELECT * FROM photos WHERE " . $req . " ORDER BY id";
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$url = "view_bdd.php?message=" . urlencode(gettext("No images select !"));
|
|
||||||
header("location: $url");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$url = "view_bdd.php?message=" . urlencode(gettext("No images select !"));
|
|
||||||
header("location: $url");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$url = "admin.php?message=" . urlencode(gettext("Please log in !"));
|
|
||||||
header("location: $url");
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
<!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 echo gettext('View photos in Sqlite base'); ?></title>
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="css/sls.css" />
|
|
||||||
<link rel='stylesheet' href='lc-lightbox/css/lc_lightbox.min.css' />
|
|
||||||
<link rel='stylesheet' href='lc-lightbox/css/open_close_fx.css' />
|
|
||||||
<link rel='stylesheet' href='lc-lightbox/skins/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" />
|
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
|
||||||
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
|
|
||||||
|
|
||||||
<?php
|
|
||||||
debug_to_console($_GET);
|
|
||||||
debug_to_console($req_edit);
|
|
||||||
|
|
||||||
$base = 'db_photo.sqlite3';
|
|
||||||
|
|
||||||
echo '<h1>' . gettext('Edit database') . ': ' . $base . '</h1><br />';
|
|
||||||
|
|
||||||
echo '<h3>' . $msg . '</h3>';
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
|
||||||
$conn = new PDO('sqlite:db_photo.sqlite3');
|
|
||||||
$stmt = $conn->prepare($req_edit);
|
|
||||||
$stmt->execute();
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?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('Speed') . '</th><th>' . gettext('Iso') . '</th><th>' . gettext('Aperture') . '</th><th>' . gettext('Expo. correct') . '</th>';
|
|
||||||
echo '<th>' . gettext('Model') . '</th><th>' . gettext('Lens') . '</th><th>' . gettext('Focal') . '</th><th>' . gettext('Metering') . '</th><th>' . gettext('Program') . '</th><th>' . gettext('Wb') . '</th>';
|
|
||||||
|
|
||||||
echo '<th>' . gettext('Flash') . '</th><th>' . gettext('Software') . '</th><th>' . gettext('Keywords') . '</th><th>' . gettext('Title') . '</th><th>' . gettext('Creator') . '</th><th>' . gettext('City') . '</th><th>' . gettext('Department') . '</th><th>' . gettext('Code') . '</th><th>' . gettext('Country') . '</th><th>' . gettext('Copyright') . '</th><th>' . gettext('Legende') . '</th>';
|
|
||||||
echo '</thead>';
|
|
||||||
echo '<tbody>';
|
|
||||||
|
|
||||||
|
|
||||||
$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><td>' . $row['dateoriginal'] . '</td>';
|
|
||||||
echo '<td>' . $row['speed'] . '</td><td>' . $row['iso'] . '</td><td>' . $row['aperture'] . '</td><td>' . $row['correctexpo'] . '</td>';
|
|
||||||
echo '<td>' . $row['model'] . '</td>';
|
|
||||||
echo '<td><input type="text" id="lens" name="lens[]" value="' . $row['lens'] . '" size=""></td>';
|
|
||||||
echo '<td>' . $row['focal'] . '</td><td>' . $row['metering'] . '</td><td>' . $row['program'] . '</td><td>' . $row['wb'] . '</td>';
|
|
||||||
echo '<td>' . $row['flash'] . '</td><td>' . $row['software'] . '</td>';
|
|
||||||
//echo '<td><input type="text" id="keywords" name="keywords[]" value="' . $row['keywords'] . '" size=""></td>';
|
|
||||||
echo "<td><input type='text' id='keywords' name='keywords[]' value='" . $row['keywords'] . "' size=''></td>";
|
|
||||||
echo '<td><input type="text" id="title" name="title[]" value="' . $row['title'] . '" size=""></td>';
|
|
||||||
echo '<td><input type="text" id="creator" name="creator[]" value="' . $row['creator'] . '" size=""></td>';
|
|
||||||
|
|
||||||
echo '<td><input type="text" id="city" name="city[]" value="' . $row['city'] . '" size=""></td>';
|
|
||||||
echo '<td><input type="text" id="department" name="department[]" value="' . $row['department'] . '" size=""></td>';
|
|
||||||
echo '<td><input type="text" id="code" name="code[]" value="' . $row['code'] . '" size=""></td>';
|
|
||||||
echo '<td><input type="text" id="country" name="country[]" value="' . $row['country'] . '" size=""></td>';
|
|
||||||
|
|
||||||
echo '<td><input type="text" id="copyright" name="copyright[]" value="' . $row['copyright'] . '" size=""></td>';
|
|
||||||
echo '<td><input type="text" id="legende" name="legende[]" value="' . $row['legende'] . '" size=""></td></tr>';
|
|
||||||
|
|
||||||
echo '<input type="hidden" id="id" name="id[]" 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="photo-du-mois.php" title="<?php echo gettext("Picture of the month"); ?>"><?php echo gettext("Picture of the month"); ?></a> | <a href="maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="admin.php" title="<?php echo gettext("Admin page"); ?>"><?php echo gettext("Admin page"); ?></a></p>
|
|
||||||
|
|
||||||
<p><em><small>© 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
|
|
||||||
|
|
||||||
<script src='lc-lightbox/js/lc_lightbox.min.js' type='text/javascript'></script>
|
|
||||||
<script src='lc-lightbox/lib/AlloyFinger/alloy_finger.min.js' type='text/javascript'></script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
|
|
||||||
@@ -204,7 +204,7 @@ function create_thumb($thumb_w, $thumb_h, $image) {
|
|||||||
|
|
||||||
list($origin_w, $origin_h) = getimagesize($image);
|
list($origin_w, $origin_h) = getimagesize($image);
|
||||||
$origin_ratio = round($origin_w / $origin_h, 1);
|
$origin_ratio = round($origin_w / $origin_h, 1);
|
||||||
$outFile = str_replace("photos/img", "photos/thumb", $image);
|
$outFile = str_replace("../photos/img", "../photos/thumb", $image);
|
||||||
|
|
||||||
if ($origin_w != null && $origin_h != null) {
|
if ($origin_w != null && $origin_h != null) {
|
||||||
if ($thumb_w / $thumb_h > $origin_ratio) {
|
if ($thumb_w / $thumb_h > $origin_ratio) {
|
||||||
@@ -229,7 +229,7 @@ if ($origin_w != null && $origin_h != null) {
|
|||||||
|
|
||||||
function in_bdd($image) {
|
function in_bdd($image) {
|
||||||
try {
|
try {
|
||||||
$conn3 = new PDO('sqlite:db_photo.sqlite3');
|
$conn3 = new PDO('sqlite:../db_photo.sqlite3');
|
||||||
#$query3 = "SELECT filename FROM photos WHERE instr(filename, '". $file . "') > 0;";
|
#$query3 = "SELECT filename FROM photos WHERE instr(filename, '". $file . "') > 0;";
|
||||||
$query3 = "SELECT filename FROM photos WHERE filename = :filename";
|
$query3 = "SELECT filename FROM photos WHERE filename = :filename";
|
||||||
$stmt = $conn3->prepare($query3);
|
$stmt = $conn3->prepare($query3);
|
||||||
@@ -373,6 +373,7 @@ function conv_date($dateoriginal, $format) {
|
|||||||
|
|
||||||
function data_for_lightbox($data) {
|
function data_for_lightbox($data) {
|
||||||
|
|
||||||
|
global $chemin;
|
||||||
//$query4 = "INSERT OR IGNORE INTO photos (filename, filesize, dateoriginal, lens, speed, correctexpo, iso, usercomment, comment, model, metering, flash, focal, program, wb, mode, width, height, html, aperture, software, lat, long, alt, keywords, title, creator, city, department, code, country, copyright, legende);
|
//$query4 = "INSERT OR IGNORE INTO photos (filename, filesize, dateoriginal, lens, speed, correctexpo, iso, usercomment, comment, model, metering, flash, focal, program, wb, mode, width, height, html, aperture, software, lat, long, alt, keywords, title, creator, city, department, code, country, copyright, legende);
|
||||||
|
|
||||||
$filename = $data['filename'];
|
$filename = $data['filename'];
|
||||||
@@ -420,16 +421,20 @@ function data_for_lightbox($data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($gps)) {
|
if (!empty($gps)) {
|
||||||
$map = '<a href = "https://maps.google.com/maps?q=' . $gps . '&t=&z=9&ie=UTF8&iwloc=&output=embed" title="' . $title . '" data-lcl-txt="' . $legende . '">' . " \u{30FB} \u{2693} " . '</a>';
|
$map = '<a href = "https://maps.google.com/maps?q=' . $gps . '&t=&z=9&ie=UTF8&iwloc=&output=embed" title="' . $title . '" data-lcl-txt="' . $legende . '">' . " \u{30FB} \u{2693} " . '</a>';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$map = '';
|
$map = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$creator = $data['creator'];
|
$creator = $data['creator'];
|
||||||
|
|
||||||
$big = host() . $data['filename'];
|
$big = host() . $chemin . $data['filename'];
|
||||||
$thumb = host() . str_replace("photos/img", "photos/thumb", $data['filename']);
|
$thumb = host() . str_replace("img", "thumb", $chemin) . $data['filename'];
|
||||||
|
|
||||||
|
// origine
|
||||||
|
//$big = host() . $data['filename'];
|
||||||
|
//$thumb = host() . str_replace("../photos/img", "../photos/thumb", $data['filename']);
|
||||||
|
|
||||||
$keywords = str_replace(',', " \u{30FB} ", clean_keywords($data['keywords']));
|
$keywords = str_replace(',', " \u{30FB} ", clean_keywords($data['keywords']));
|
||||||
$copyright = $data['copyright'];
|
$copyright = $data['copyright'];
|
||||||
|
|||||||
97
i18n_setup.php
Normal file
97
i18n_setup.php
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Verifies if the given $locale is supported in the project
|
||||||
|
* @param string $locale
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
|
||||||
|
function list_locale_server($dir) {
|
||||||
|
$lange = array();
|
||||||
|
$iterator = new DirectoryIterator($dir);
|
||||||
|
foreach ($iterator as $ff) {
|
||||||
|
if ($ff->isDot() OR $ff->isFile()) { continue; }
|
||||||
|
if ($ff->isDir()) {
|
||||||
|
$d = $ff->getFilename();
|
||||||
|
if (($d != "nocache") AND (strpos($d, "_"))) {
|
||||||
|
$e = strtok($d, "_");
|
||||||
|
$lange[] = $d;
|
||||||
|
$lange[] = $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//print_r($lange);
|
||||||
|
return $lange;
|
||||||
|
}
|
||||||
|
|
||||||
|
function valid($locale) {
|
||||||
|
//return in_array($locale, ['en_US', 'en', 'fr_FR', 'fr', 'de_DE', 'de', 'es_ES', 'es']);
|
||||||
|
global $dir_locales;
|
||||||
|
$l = list_locale_server($dir_locales);
|
||||||
|
return in_array($locale, $l);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ------------------------------------*/
|
||||||
|
/* Settings */
|
||||||
|
/* ------------------------------------*/
|
||||||
|
|
||||||
|
$dir_locales = __DIR__ . '/Locale';
|
||||||
|
|
||||||
|
//setting the source/default locale, for informational purposes
|
||||||
|
$lang = 'en_US';
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (isset($_GET['lang']) && valid($_GET['lang'])) {
|
||||||
|
// the locale can be changed through the query-string
|
||||||
|
$lang = $_GET['lang']; //you should sanitize this!
|
||||||
|
//setcookie('lang', $lang); //it's stored in a cookie so it can be reused
|
||||||
|
setcookie('lang', $lang, time() + (86400 * 30), "/"); //it's stored in a cookie so it can be reused
|
||||||
|
*/
|
||||||
|
if (isset($_POST['lang']) && valid($_POST['lang'])) {
|
||||||
|
// the locale can be changed through the query-string
|
||||||
|
$lang = $_POST['lang']; //you should sanitize this!
|
||||||
|
//setcookie('lang', $lang); //it's stored in a cookie so it can be reused
|
||||||
|
setcookie('lang', $lang, time() + (86400 * 30), "/"); //it's stored in a cookie so it can be reused
|
||||||
|
|
||||||
|
} elseif (isset($_SESSION['language']) && valid($_SESSION['language'])) {
|
||||||
|
// if the cookie is present instead, let's just keep it
|
||||||
|
$lang = $_SESSION['language']; //you should sanitize this!
|
||||||
|
|
||||||
|
} elseif (isset($_COOKIE['lang']) && valid($_COOKIE['lang'])) {
|
||||||
|
// if the cookie is present instead, let's just keep it
|
||||||
|
$lang = $_COOKIE['lang']; //you should sanitize this!
|
||||||
|
|
||||||
|
} elseif (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
||||||
|
// default: look for the languages the browser says the user accepts
|
||||||
|
$langs = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
||||||
|
array_walk($langs, function (&$lang) { $lang = strtr(strtok($lang, ';'), ['-' => '_']); });
|
||||||
|
foreach ($langs as $browser_lang) {
|
||||||
|
if (valid($browser_lang)) {
|
||||||
|
$lang = $browser_lang;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// here we define the global system locale given the found language
|
||||||
|
putenv("LANG=$lang");
|
||||||
|
|
||||||
|
// this might be useful for date functions (LC_TIME) or money formatting (LC_MONETARY), for instance
|
||||||
|
setlocale(LC_ALL, $lang);
|
||||||
|
|
||||||
|
// this will make Gettext look for ../locales/<lang>/LC_MESSAGES/main.mo
|
||||||
|
bindtextdomain('sentier', __DIR__ . '/Locale/');
|
||||||
|
|
||||||
|
// indicates in what encoding the file should be read
|
||||||
|
bind_textdomain_codeset('sentier', 'UTF-8');
|
||||||
|
|
||||||
|
// if your application has additional domains, as cited before, you should bind them here as well
|
||||||
|
//bindtextdomain('forum', '../locales');
|
||||||
|
//bind_textdomain_codeset('forum', 'UTF-8');
|
||||||
|
|
||||||
|
// here we indicate the default domain the gettext() calls will respond to
|
||||||
|
textdomain('sentier');
|
||||||
|
|
||||||
|
// this would look for the string in forum.mo instead of main.mo
|
||||||
|
// echo dgettext('forum', 'Welcome back!');
|
||||||
|
?>
|
||||||
44
index.php
44
index.php
@@ -1,16 +1,25 @@
|
|||||||
<?php include 'localize.php';
|
<?php
|
||||||
|
session_start();
|
||||||
|
include 'i18n_setup.php';
|
||||||
|
/*include 'localize.php';
|
||||||
$domain = 'sentier';
|
$domain = 'sentier';
|
||||||
localize($domain);
|
localize($domain);
|
||||||
|
*/
|
||||||
include 'functions.php';
|
include 'functions.php';
|
||||||
|
/*
|
||||||
|
_pr($_REQUEST); // [lang] => es_ES
|
||||||
|
_pr($_SESSION); // [language] => es_ES
|
||||||
|
_pr($_POST);
|
||||||
|
_pr($_GET); // [lang] => es_ES
|
||||||
|
*/
|
||||||
?>
|
?>
|
||||||
<?php session_start(); ?>
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta name="description" content="Sur le sentier: photos prises au cours de mes ballades" />
|
<meta name="description" content="Sur le sentier: <?php echo gettext('photos taken during my walks'); ?>...">
|
||||||
<title>Sur le sentier...</title>
|
<title>Sur le sentier...</title>
|
||||||
|
|
||||||
<meta name="msapplication-TileColor" content="#2b5797">
|
<meta name="msapplication-TileColor" content="#2b5797">
|
||||||
@@ -22,34 +31,25 @@ include 'functions.php';
|
|||||||
<link rel="manifest" href="/icons/site.webmanifest">
|
<link rel="manifest" href="/icons/site.webmanifest">
|
||||||
<link rel="shortcut icon" href="/icons/favicon.ico">
|
<link rel="shortcut icon" href="/icons/favicon.ico">
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
|
||||||
<script src="vegas/js/vegas.min.js"></script>
|
<script src="vegas/js/vegas.min.js"></script>
|
||||||
<script src="js/matomo-sls.js"></script>
|
<script src="js/matomo-sls.js"></script>
|
||||||
<link href='https://fonts.googleapis.com/css?family=Coming+Soon' rel='stylesheet' type='text/css'>
|
<link href='https://fonts.googleapis.com/css?family=Coming+Soon' rel='stylesheet' type='text/css'>
|
||||||
<!-- Patrick+Hand|Josefin+Sans|Coming+Soon|Comfortaa|Pontano+Sans|Rock+Salt -->
|
<!-- Patrick+Hand|Josefin+Sans|Coming+Soon|Comfortaa|Pontano+Sans|Rock+Salt -->
|
||||||
<link rel="stylesheet" type="text/css" href="vegas/js/vegas.min.css" />
|
<link rel="stylesheet" type="text/css" href="vegas/js/vegas.min.css">
|
||||||
<link rel="stylesheet" type="text/css" href="vegas/js/vegas-style.css" />
|
<link rel="stylesheet" type="text/css" href="vegas/js/vegas-style.css">
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="css/sls.css" />
|
<link rel="stylesheet" type="text/css" href="css/sls.css">
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
//Get a list of file paths using the glob function.
|
//Get a list of file paths using the glob function.
|
||||||
$fileList = glob('vegas/img/*.{jpg,jpeg,JPG,JPEG,heic,HEIC,webp,WEBP}', GLOB_BRACE);
|
$fileList = glob('vegas/img/*.{jpg,jpeg,JPG,JPEG,heic,HEIC,webp,WEBP}', GLOB_BRACE);
|
||||||
|
|
||||||
$pv_sslport=443;
|
|
||||||
$pv_serverport=80;
|
|
||||||
$pv_servername="sur-le-sentier.fr";
|
|
||||||
|
|
||||||
$pv_URIprotocol = isset($_SERVER["HTTPS"]) ? (($_SERVER["HTTPS"]==="on" || $_SERVER["HTTPS"]===1 || $_SERVER["SERVER_PORT"]===$pv_sslport) ? "https://" : "http://") : (($_SERVER["SERVER_PORT"]===$pv_sslport) ? "https://" : "http://");
|
|
||||||
$host = $pv_URIprotocol . $_SERVER['HTTP_HOST'];
|
|
||||||
|
|
||||||
$wp = (($_SERVER['SERVER_NAME'] == "sur-le-sentier.fr") ? "blog" : "wordpress");
|
$wp = (($_SERVER['SERVER_NAME'] == "sur-le-sentier.fr") ? "blog" : "wordpress");
|
||||||
?>
|
?>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<?php //echo "Session language: " . $_SESSION['language']; ?>
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
$("#exemple, body").vegas({
|
$("#exemple, body").vegas({
|
||||||
@@ -99,7 +99,7 @@ $("#exemple, body").vegas({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="icn">
|
<div class="icn">
|
||||||
<!--a title="mail" href="mailto:contact.clicclac.info?subject=[Contact] sur-le-sentier.fr"-->
|
<!--a title="mail" href="mailto:contact.clicclac.info?subject=[Contact] sur-le-sentier.fr"-->host()
|
||||||
<a title="mail" href="/<?php echo $wp; ?>/contact/">
|
<a title="mail" href="/<?php echo $wp; ?>/contact/">
|
||||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve">
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve">
|
||||||
<metadata> Svg Vector Icons : http://www.onlinewebfonts.com/icon </metadata>
|
<metadata> Svg Vector Icons : http://www.onlinewebfonts.com/icon </metadata>
|
||||||
@@ -109,7 +109,8 @@ $("#exemple, body").vegas({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="icn">
|
<div class="icn">
|
||||||
<a title="rss" href="<?php echo $host . "/" . $wp; ?>/feed/">
|
<?php //echo $host . "/" . $wp; ?>
|
||||||
|
<a title="rss" href="<?php host() . "/" . $wp; ?>/feed/">
|
||||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve">
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve">
|
||||||
<metadata> Svg Vector Icons : http://www.onlinewebfonts.com/icon </metadata>
|
<metadata> Svg Vector Icons : http://www.onlinewebfonts.com/icon </metadata>
|
||||||
<g><path d="M143.6,722.7c-37.1,0-68.7,13-94.7,39c-26,26-39,57.5-39,94.6c0,37.1,13,68.7,39,94.7c26,26,57.5,39,94.7,39s68.7-13,94.6-39c26-26,39-57.5,39-94.7c0-37.1-13-68.7-39-94.6C212.3,735.7,180.7,722.7,143.6,722.7z"/><path d="M451.2,548.7c-52.4-52.9-112.5-95-180.3-126.3c-67.7-31.3-138.7-50-213-56h-3.5c-12.1,0-22,3.9-29.9,11.8c-9.7,8.3-14.6,19.3-14.6,32.7v94c0,11.6,3.8,21.6,11.5,29.9c7.7,8.4,17.3,13,28.9,13.9c106.2,10.2,197.1,53,272.5,128.4c75.4,75.4,118.2,166.2,128.4,272.5c0.9,11.6,5.6,21.2,13.9,28.9c8.4,7.7,18.3,11.5,29.9,11.5h94c13.5,0,24.4-4.9,32.7-14.6c8.8-9.3,12.8-20.4,11.8-33.4c-6-74.2-24.7-145.2-56-212.9C546.2,661.2,504.1,601.1,451.2,548.7z"/><path d="M906.4,594.3c-49.6-111.1-117.8-209.8-204.6-296.1c-86.3-86.8-185-155-296.1-204.6C294.5,43.9,178.2,16.1,56.6,10h-2.1c-12.1,0-22.3,4.2-30.6,12.5c-9.3,8.3-13.9,19-13.9,32v99.5c0,11.6,4.1,21.7,12.2,30.3c8.1,8.6,18,13.1,29.6,13.6c99.8,6,194.5,29.7,284.3,71c89.8,41.3,167.7,95,233.8,161.1C636,496.2,689.7,574.1,731,663.9c41.3,89.8,64.7,184.5,70.3,284.3c0.5,11.6,5,21.5,13.6,29.6c8.6,8.1,18.9,12.2,31,12.2h99.5c13,0,23.6-4.6,32-13.9c9.3-9.3,13.4-20.2,12.5-32.7C983.9,821.8,956,705.4,906.4,594.3z"/></g>
|
<g><path d="M143.6,722.7c-37.1,0-68.7,13-94.7,39c-26,26-39,57.5-39,94.6c0,37.1,13,68.7,39,94.7c26,26,57.5,39,94.7,39s68.7-13,94.6-39c26-26,39-57.5,39-94.7c0-37.1-13-68.7-39-94.6C212.3,735.7,180.7,722.7,143.6,722.7z"/><path d="M451.2,548.7c-52.4-52.9-112.5-95-180.3-126.3c-67.7-31.3-138.7-50-213-56h-3.5c-12.1,0-22,3.9-29.9,11.8c-9.7,8.3-14.6,19.3-14.6,32.7v94c0,11.6,3.8,21.6,11.5,29.9c7.7,8.4,17.3,13,28.9,13.9c106.2,10.2,197.1,53,272.5,128.4c75.4,75.4,118.2,166.2,128.4,272.5c0.9,11.6,5.6,21.2,13.9,28.9c8.4,7.7,18.3,11.5,29.9,11.5h94c13.5,0,24.4-4.9,32.7-14.6c8.8-9.3,12.8-20.4,11.8-33.4c-6-74.2-24.7-145.2-56-212.9C546.2,661.2,504.1,601.1,451.2,548.7z"/><path d="M906.4,594.3c-49.6-111.1-117.8-209.8-204.6-296.1c-86.3-86.8-185-155-296.1-204.6C294.5,43.9,178.2,16.1,56.6,10h-2.1c-12.1,0-22.3,4.2-30.6,12.5c-9.3,8.3-13.9,19-13.9,32v99.5c0,11.6,4.1,21.7,12.2,30.3c8.1,8.6,18,13.1,29.6,13.6c99.8,6,194.5,29.7,284.3,71c89.8,41.3,167.7,95,233.8,161.1C636,496.2,689.7,574.1,731,663.9c41.3,89.8,64.7,184.5,70.3,284.3c0.5,11.6,5,21.5,13.6,29.6c8.6,8.1,18.9,12.2,31,12.2h99.5c13,0,23.6-4.6,32-13.9c9.3-9.3,13.4-20.2,12.5-32.7C983.9,821.8,956,705.4,906.4,594.3z"/></g>
|
||||||
@@ -136,7 +137,7 @@ $("#exemple, body").vegas({
|
|||||||
|
|
||||||
|
|
||||||
<div class="indexForm">
|
<div class="indexForm">
|
||||||
<form name="langSelect" action="index.php" method="get" >
|
<form name="langSelect" action="index.php" method="post" >
|
||||||
<select name="lang" id="lang" class="mySelect">
|
<select name="lang" id="lang" class="mySelect">
|
||||||
<option value="">Language</option>
|
<option value="">Language</option>
|
||||||
<option value="de_DE">German</option>
|
<option value="de_DE">German</option>
|
||||||
@@ -150,8 +151,7 @@ $("#exemple, body").vegas({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="vegas-info">
|
<div class="vegas-info">
|
||||||
<!-- close sesssion -->
|
<?php echo gettext('Powered by'); ?> <a href="https://wordpress.org">WordPress</a> - <a href="https://www.zenphoto.org">Zenphoto</a> - <a href="https://vegas.jaysalvat.com">Vegas Background Slideshow 2</a>. <a href="">License des photos</a>. © 2013-<?php echo date('Y'); ?> sur-le-sentier.fr
|
||||||
<!--a href="close.php">close</a--><?php echo gettext('Powered by'); ?> <a href="https://wordpress.org">WordPress</a> - <a href="https://www.zenphoto.org">Zenphoto</a> - <a href="https://vegas.jaysalvat.com">Vegas Background Slideshow 2</a>. <a href="">License des photos</a>. © 2013-<?php echo date('Y'); ?> sur-le-sentier.fr
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
23
localize.php
23
localize.php
@@ -220,13 +220,34 @@ function localize($domain) {
|
|||||||
echo "langue: " . $langue . "<br>";
|
echo "langue: " . $langue . "<br>";
|
||||||
*/
|
*/
|
||||||
|
|
||||||
putenv('LC_ALL=' . $langue);
|
putenv('LC_ALL=' . $langue); // $langue = fr_FR.utf8
|
||||||
$loc = setlocale(LC_ALL, $langue);
|
$loc = setlocale(LC_ALL, $langue);
|
||||||
|
|
||||||
|
bindtextdomain($domain, $root . '/Locale/nocache'); // by-pass gettext() cache. Now the cache is forced to flush every time.
|
||||||
bindtextdomain($domain, $root . '/Locale/');
|
bindtextdomain($domain, $root . '/Locale/');
|
||||||
bind_textdomain_codeset($domain, 'UTF-8');
|
bind_textdomain_codeset($domain, 'UTF-8');
|
||||||
textdomain($domain);
|
textdomain($domain);
|
||||||
|
|
||||||
$nation = array('fr_FR' => gettext('French'), 'en_US' => gettext('English') , 'de_DE' => gettext('German'), 'es_ES' => gettext('Spanish') );
|
$nation = array('fr_FR' => gettext('French'), 'en_US' => gettext('English') , 'de_DE' => gettext('German'), 'es_ES' => gettext('Spanish') );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function motranslator($domain) {
|
||||||
|
require('vendor/autoload.php');
|
||||||
|
|
||||||
|
// Create loader object
|
||||||
|
$loader = new PhpMyAdmin\MoTranslator\Loader();
|
||||||
|
|
||||||
|
// Set locale
|
||||||
|
//$loader->setlocale('fr');
|
||||||
|
$loader->setlocale('fr_FR.utf8');
|
||||||
|
|
||||||
|
// Set default text domain
|
||||||
|
$loader->textdomain('sentier');
|
||||||
|
|
||||||
|
// Set path where to look for a domain
|
||||||
|
//$loader->bindtextdomain('sentier', __DIR__ . '/data/locale/');
|
||||||
|
$loader->bindtextdomain('sentier', __DIR__ . '/Locale/');
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
37
maps.php
37
maps.php
@@ -1,22 +1,35 @@
|
|||||||
<?php session_start();
|
<?php
|
||||||
include 'localize.php';
|
session_start();
|
||||||
$domain = 'sentier';
|
include 'i18n_setup.php';
|
||||||
localize($domain);
|
/*include 'localize.php';
|
||||||
include 'functions.php';
|
$domain = 'sentier';
|
||||||
|
localize($domain);
|
||||||
|
*/
|
||||||
|
include 'functions.php';
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="description" content="Sur le sentier: la photos du mois">
|
||||||
<title><?php echo gettext("Maps"); ?></title>
|
<title><?php echo gettext("Maps"); ?></title>
|
||||||
|
<meta name="msapplication-TileColor" content="#2b5797">
|
||||||
|
<meta name="msapplication-config" content="/icons/browserconfig.xml">
|
||||||
|
<meta name="theme-color" content="#ffffff">
|
||||||
|
<link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-touch-icon.png">
|
||||||
|
<link rel="icon" type="image/png" sizes="32x32" href="/icons/favicon-32x32.png">
|
||||||
|
<link rel="icon" type="image/png" sizes="16x16" href="/icons/favicon-16x16.png">
|
||||||
|
<link rel="manifest" href="/icons/site.webmanifest">
|
||||||
|
<link rel="shortcut icon" href="/icons/favicon.ico">
|
||||||
|
|
||||||
<link rel="stylesheet" href="css/sls.css">
|
<link rel="stylesheet" href="css/sls.css">
|
||||||
|
|
||||||
<link rel='stylesheet' href='lc-lightbox/css/lc_lightbox.min.css' />
|
<link rel='stylesheet' href='lc-lightbox/css/lc_lightbox.min.css'>
|
||||||
<link rel='stylesheet' href='lc-lightbox/css/open_close_fx.css' />
|
<link rel='stylesheet' href='lc-lightbox/css/open_close_fx.css'>
|
||||||
<link rel='stylesheet' href='lc-lightbox/skins/minimal.css' />
|
<link rel='stylesheet' href='lc-lightbox/skins/minimal.css'>
|
||||||
<style>
|
<style>
|
||||||
#map{
|
#map{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -157,7 +170,7 @@
|
|||||||
<div id="mapCanvas"></div>
|
<div id="mapCanvas"></div>
|
||||||
|
|
||||||
|
|
||||||
<script type='text/javascript'>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
var $obj = lc_lightbox('.gm_thumb a', {
|
var $obj = lc_lightbox('.gm_thumb a', {
|
||||||
@@ -187,8 +200,8 @@
|
|||||||
|
|
||||||
<p><em><small>© 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
|
<p><em><small>© 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
|
||||||
|
|
||||||
<script src='lc-lightbox/js/lc_lightbox.min.js' type='text/javascript'></script>
|
<script src='lc-lightbox/js/lc_lightbox.min.js'></script>
|
||||||
<script src='lc-lightbox/lib/AlloyFinger/alloy_finger.min.js' type='text/javascript'></script>
|
<script src='lc-lightbox/lib/AlloyFinger/alloy_finger.min.js'></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +1,45 @@
|
|||||||
<?php session_start(); ?>
|
<?php
|
||||||
|
session_start();
|
||||||
|
include 'i18n_setup.php';
|
||||||
|
/*include 'localize.php';
|
||||||
|
$domain = 'sentier';
|
||||||
|
localize($domain);
|
||||||
|
*/
|
||||||
|
include 'functions.php';
|
||||||
|
/*
|
||||||
|
_pr($_REQUEST); //
|
||||||
|
_pr($_SESSION); // [language] => de_DE
|
||||||
|
_pr($_POST); //
|
||||||
|
_pr($_GET); //
|
||||||
|
_pr($_COOKIE);
|
||||||
|
|
||||||
|
$locale = Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE']); // fr_FR
|
||||||
|
echo $locale;
|
||||||
|
*/
|
||||||
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
<title><?php //echo gettext("Picture of the month"); ?></title>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="description" content="Sur le sentier: la photos du mois">
|
||||||
|
<title><?php echo gettext("Picture of the month"); ?></title>
|
||||||
|
<meta name="msapplication-TileColor" content="#2b5797">
|
||||||
|
<meta name="msapplication-config" content="/icons/browserconfig.xml">
|
||||||
|
<meta name="theme-color" content="#ffffff">
|
||||||
|
<link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-touch-icon.png">
|
||||||
|
<link rel="icon" type="image/png" sizes="32x32" href="/icons/favicon-32x32.png">
|
||||||
|
<link rel="icon" type="image/png" sizes="16x16" href="/icons/favicon-16x16.png">
|
||||||
|
<link rel="manifest" href="/icons/site.webmanifest">
|
||||||
|
<link rel="shortcut icon" href="/icons/favicon.ico">
|
||||||
|
|
||||||
<link rel="stylesheet" href="css/sls.css">
|
<link rel="stylesheet" href="css/sls.css">
|
||||||
|
|
||||||
<link rel='stylesheet' href='lc-lightbox/css/lc_lightbox.min.css' />
|
<link rel="stylesheet" href="lc-lightbox/css/lc_lightbox.min.css">
|
||||||
<link rel='stylesheet' href='lc-lightbox/css/open_close_fx.css' />
|
<link rel="stylesheet" href="lc-lightbox/css/open_close_fx.css">
|
||||||
<link rel='stylesheet' href='lc-lightbox/skins/minimal.css' />
|
<link rel="stylesheet" href="lc-lightbox/skins/minimal.css">
|
||||||
|
|
||||||
<?php
|
|
||||||
include 'localize.php';
|
|
||||||
$domain = 'sentier';
|
|
||||||
localize($domain);
|
|
||||||
include 'functions.php';
|
|
||||||
?>
|
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
|
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
@@ -34,13 +55,13 @@ else $page = intval($_GET['page']);
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
//$base = $_SERVER['DOCUMENT_ROOT'] . '/db_photo.sqlite3';
|
$chemin = 'photos/img/';
|
||||||
|
|
||||||
$base = 'db_photo.sqlite3';
|
$base = 'db_photo.sqlite3';
|
||||||
|
|
||||||
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/" . $base)) {
|
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/" . $base)) {
|
||||||
try {
|
try {
|
||||||
//$conn4 = new PDO('sqlite:db_photo.sqlite3');
|
$conn4 = new PDO("sqlite:$base");
|
||||||
$conn4 = new PDO('sqlite:db_photo.sqlite3');
|
|
||||||
// WHERE id='26'
|
// WHERE id='26'
|
||||||
$query4 = "SELECT filename, filesize, dateoriginal, lens, speed, correctexpo, iso, usercomment, comment, model, metering, flash, focal, program, wb, mode, width, height, html, aperture, software, lat, long, alt, keywords, title, creator, city, department, code, country, copyright, legende FROM photos ORDER BY dateoriginal DESC LIMIT ? OFFSET ?";
|
$query4 = "SELECT filename, filesize, dateoriginal, lens, speed, correctexpo, iso, usercomment, comment, model, metering, flash, focal, program, wb, mode, width, height, html, aperture, software, lat, long, alt, keywords, title, creator, city, department, code, country, copyright, legende FROM photos ORDER BY dateoriginal DESC LIMIT ? OFFSET ?";
|
||||||
//nb d'archive par page
|
//nb d'archive par page
|
||||||
@@ -67,6 +88,11 @@ else exit("Database " . $base . " does not exist !");
|
|||||||
<p class="month"><?php echo month($result[0]['dateoriginal']); ?></p>
|
<p class="month"><?php echo month($result[0]['dateoriginal']); ?></p>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
//_pr($result[0]);
|
||||||
|
|
||||||
|
//$thumbnail = host() . str_replace("img", "thumb", $chemin) . $result[0]['filename'];
|
||||||
|
//$full = host() . $chemin . $result[0]['filename'];
|
||||||
|
|
||||||
$lb = data_for_lightbox($result[0]);
|
$lb = data_for_lightbox($result[0]);
|
||||||
|
|
||||||
//_pr($lb);
|
//_pr($lb);
|
||||||
@@ -84,8 +110,10 @@ else exit("Database " . $base . " does not exist !");
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
echo '<div class="cadre" id="lcl_month">';
|
echo '<div class="cadre" id="lcl_month">';
|
||||||
|
//echo '<a href ="' . $full . '" title="' . htmlspecialchars($lb['title']) . '" data-lcl-txt="' . htmlspecialchars($lb['description']) .'" data-lcl-author="' . htmlspecialchars($lb['creator']) . '">';
|
||||||
|
//echo '<img src="' . $full . '" alt="' . htmlspecialchars($lb['title']) . '" class="trois">';
|
||||||
echo '<a href ="' . $lb['big'] . '" title="' . htmlspecialchars($lb['title']) . '" data-lcl-txt="' . htmlspecialchars($lb['description']) .'" data-lcl-author="' . htmlspecialchars($lb['creator']) . '">';
|
echo '<a href ="' . $lb['big'] . '" title="' . htmlspecialchars($lb['title']) . '" data-lcl-txt="' . htmlspecialchars($lb['description']) .'" data-lcl-author="' . htmlspecialchars($lb['creator']) . '">';
|
||||||
echo '<img src="' . $lb['big'] . '" alt="' . htmlspecialchars($lb['title']) . '" class="trois" />';
|
echo '<img src="' . $lb['big'] . '" alt="' . htmlspecialchars($lb['title']) . '" class="trois">';
|
||||||
echo "</a>";
|
echo "</a>";
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
@@ -146,9 +174,13 @@ else exit("Database " . $base . " does not exist !");
|
|||||||
//_pr($result[$i]);
|
//_pr($result[$i]);
|
||||||
//debug_to_console($result[$i]);
|
//debug_to_console($result[$i]);
|
||||||
|
|
||||||
|
//$thumbnail = host() . str_replace("img", "thumb", $chemin) . $result[$i]['filename'];
|
||||||
|
//$full = host() . $chemin . $result[$i]['filename'];
|
||||||
|
|
||||||
$lb = data_for_lightbox($result[$i]);
|
$lb = data_for_lightbox($result[$i]);
|
||||||
|
|
||||||
//
|
//_pr($lb);
|
||||||
|
|
||||||
if (!empty($lb['gps'])) {
|
if (!empty($lb['gps'])) {
|
||||||
$map = '<a href = "https://maps.google.com/maps?q=' . $lb['gps'] . '&t=&z=9&ie=UTF8&iwloc=&output=embed" title="' . $lb['title'] . '" data-lcl-txt="' . $lb['legende'] . '">' . " \u{30FB} \u{2693} " . '</a>';
|
$map = '<a href = "https://maps.google.com/maps?q=' . $lb['gps'] . '&t=&z=9&ie=UTF8&iwloc=&output=embed" title="' . $lb['title'] . '" data-lcl-txt="' . $lb['legende'] . '">' . " \u{30FB} \u{2693} " . '</a>';
|
||||||
|
|
||||||
@@ -157,17 +189,12 @@ else exit("Database " . $base . " does not exist !");
|
|||||||
$meta = '';
|
$meta = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// data-lcl-author="' . htmlspecialchars($lb['exif']) . '"
|
|
||||||
//
|
|
||||||
|
|
||||||
echo '<div class="item">';
|
echo '<div class="item">';
|
||||||
//echo '<a href ="' . $lb['big'] . '" title="' . htmlspecialchars($lb['title']) . '" data-lcl-txt="' . htmlspecialchars($lb['title']) .'" data-lcl-author="' . htmlspecialchars($meta) . '">';
|
|
||||||
//echo '<a href ="' . $lb['big'] . '" title="' . htmlspecialchars($lb['title']) . '" data-lcl-txt="' . htmlspecialchars($lb['exif']) . '" data-lcl-author="' . htmlspecialchars($lb['creator']) . '">';
|
|
||||||
// '" by="par' .
|
|
||||||
|
|
||||||
echo '<a href ="' . $lb['big'] . '" title="' . htmlspecialchars($lb['title']) . '" data-lcl-txt="' . htmlspecialchars($lb['description']) . '" data-lcl-author="' . htmlspecialchars($lb['creator']) . '">';
|
echo '<a href ="' . $lb['big'] . '" title="' . htmlspecialchars($lb['title']) . '" data-lcl-txt="' . htmlspecialchars($lb['description']) . '" data-lcl-author="' . htmlspecialchars($lb['creator']) . '">';
|
||||||
|
|
||||||
echo '<img src="' . $lb['thumb'] . '" alt="' . htmlspecialchars($lb['title']) . '" />';
|
echo '<img src="' . $lb['thumb'] . '" alt="' . htmlspecialchars($lb['title']) . '">';
|
||||||
echo "</a>";
|
echo "</a>";
|
||||||
echo '<span class="caption">' . month($date) . '</span>';
|
echo '<span class="caption">' . month($date) . '</span>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
@@ -194,7 +221,7 @@ else exit("Database " . $base . " does not exist !");
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type='text/javascript'>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var $obj = lc_lightbox('#lcl_gallery a', {
|
var $obj = lc_lightbox('#lcl_gallery a', {
|
||||||
img_zoom : true, // whether to enable zooming system
|
img_zoom : true, // whether to enable zooming system
|
||||||
@@ -322,8 +349,8 @@ echo '</div>';
|
|||||||
|
|
||||||
<p><em><small>© 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
|
<p><em><small>© 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
|
||||||
|
|
||||||
<script src='lc-lightbox/js/lc_lightbox.min.js' type='text/javascript'></script>
|
<script src='lc-lightbox/js/lc_lightbox.min.js'></script>
|
||||||
<script src='lc-lightbox/lib/AlloyFinger/alloy_finger.min.js' type='text/javascript'></script>
|
<script src='lc-lightbox/lib/AlloyFinger/alloy_finger.min.js'></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
BIN
photos/11_2024.jpg
Normal file
BIN
photos/11_2024.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 333 KiB |
BIN
photos/5_2005.jpg
Normal file
BIN
photos/5_2005.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 145 KiB |
BIN
photos/6_2005.jpg
Normal file
BIN
photos/6_2005.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 70 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 894 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 21 KiB |
39
translator.php
Normal file
39
translator.php
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require('vendor/autoload.php');
|
||||||
|
include 'localize.php';
|
||||||
|
$domain = 'sentier';
|
||||||
|
|
||||||
|
// Create loader object
|
||||||
|
$loader = new PhpMyAdmin\MoTranslator\Loader();
|
||||||
|
|
||||||
|
// Set locale
|
||||||
|
$loader->setlocale('fr_FR.utf8');
|
||||||
|
|
||||||
|
// Set default text domain
|
||||||
|
$loader->textdomain($domain);
|
||||||
|
|
||||||
|
// Set path where to look for a domain
|
||||||
|
$loader->bindtextdomain($domain, __DIR__ . '/Locale/');
|
||||||
|
|
||||||
|
// Get translator
|
||||||
|
$translator = $loader->getTranslator();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Now you can use Translator API (see below)
|
||||||
|
|
||||||
|
echo $translator->gettext('String');
|
||||||
|
|
||||||
|
echo $translator->gettext('Aperture Priority');
|
||||||
|
|
||||||
|
//echo $translator->getTranslations();
|
||||||
|
/*
|
||||||
|
echo $translator->setTranslations([
|
||||||
|
'String' => 'Chaîne',
|
||||||
|
'Number' => 'Nombre',
|
||||||
|
]);
|
||||||
|
|
||||||
|
echo $translator->gettext('String');
|
||||||
|
*/
|
||||||
|
?>
|
||||||
19
translator_gettext.php
Normal file
19
translator_gettext.php
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
require('vendor/autoload.php');
|
||||||
|
|
||||||
|
// Load compatibility layer
|
||||||
|
PhpMyAdmin\MoTranslator\Loader::loadFunctions();
|
||||||
|
|
||||||
|
$langue = "fr_FR.utf8";
|
||||||
|
// Configure
|
||||||
|
_setlocale(LC_MESSAGES, $langue);
|
||||||
|
_textdomain('sentier');
|
||||||
|
_bindtextdomain('sentier', __DIR__ . '/Locale/');
|
||||||
|
_bind_textdomain_codeset('sentier', 'UTF-8');
|
||||||
|
|
||||||
|
// Use functions
|
||||||
|
echo _gettext('All photos');
|
||||||
|
echo __('Aperture Priority');
|
||||||
|
|
||||||
|
echo _gettext('motranslator');
|
||||||
|
?>
|
||||||
25
vendor/autoload.php
vendored
Normal file
25
vendor/autoload.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload.php @generated by Composer
|
||||||
|
|
||||||
|
if (PHP_VERSION_ID < 50600) {
|
||||||
|
if (!headers_sent()) {
|
||||||
|
header('HTTP/1.1 500 Internal Server Error');
|
||||||
|
}
|
||||||
|
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
|
||||||
|
if (!ini_get('display_errors')) {
|
||||||
|
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
||||||
|
fwrite(STDERR, $err);
|
||||||
|
} elseif (!headers_sent()) {
|
||||||
|
echo $err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
trigger_error(
|
||||||
|
$err,
|
||||||
|
E_USER_ERROR
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once __DIR__ . '/composer/autoload_real.php';
|
||||||
|
|
||||||
|
return ComposerAutoloaderInitf0f23926796d6825a9caf18ca123a270::getLoader();
|
||||||
579
vendor/composer/ClassLoader.php
vendored
Normal file
579
vendor/composer/ClassLoader.php
vendored
Normal file
@@ -0,0 +1,579 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Composer.
|
||||||
|
*
|
||||||
|
* (c) Nils Adermann <naderman@naderman.de>
|
||||||
|
* Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Composer\Autoload;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
||||||
|
*
|
||||||
|
* $loader = new \Composer\Autoload\ClassLoader();
|
||||||
|
*
|
||||||
|
* // register classes with namespaces
|
||||||
|
* $loader->add('Symfony\Component', __DIR__.'/component');
|
||||||
|
* $loader->add('Symfony', __DIR__.'/framework');
|
||||||
|
*
|
||||||
|
* // activate the autoloader
|
||||||
|
* $loader->register();
|
||||||
|
*
|
||||||
|
* // to enable searching the include path (eg. for PEAR packages)
|
||||||
|
* $loader->setUseIncludePath(true);
|
||||||
|
*
|
||||||
|
* In this example, if you try to use a class in the Symfony\Component
|
||||||
|
* namespace or one of its children (Symfony\Component\Console for instance),
|
||||||
|
* the autoloader will first look for the class under the component/
|
||||||
|
* directory, and it will then fallback to the framework/ directory if not
|
||||||
|
* found before giving up.
|
||||||
|
*
|
||||||
|
* This class is loosely based on the Symfony UniversalClassLoader.
|
||||||
|
*
|
||||||
|
* @author Fabien Potencier <fabien@symfony.com>
|
||||||
|
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
* @see https://www.php-fig.org/psr/psr-0/
|
||||||
|
* @see https://www.php-fig.org/psr/psr-4/
|
||||||
|
*/
|
||||||
|
class ClassLoader
|
||||||
|
{
|
||||||
|
/** @var \Closure(string):void */
|
||||||
|
private static $includeFile;
|
||||||
|
|
||||||
|
/** @var string|null */
|
||||||
|
private $vendorDir;
|
||||||
|
|
||||||
|
// PSR-4
|
||||||
|
/**
|
||||||
|
* @var array<string, array<string, int>>
|
||||||
|
*/
|
||||||
|
private $prefixLengthsPsr4 = array();
|
||||||
|
/**
|
||||||
|
* @var array<string, list<string>>
|
||||||
|
*/
|
||||||
|
private $prefixDirsPsr4 = array();
|
||||||
|
/**
|
||||||
|
* @var list<string>
|
||||||
|
*/
|
||||||
|
private $fallbackDirsPsr4 = array();
|
||||||
|
|
||||||
|
// PSR-0
|
||||||
|
/**
|
||||||
|
* List of PSR-0 prefixes
|
||||||
|
*
|
||||||
|
* Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
|
||||||
|
*
|
||||||
|
* @var array<string, array<string, list<string>>>
|
||||||
|
*/
|
||||||
|
private $prefixesPsr0 = array();
|
||||||
|
/**
|
||||||
|
* @var list<string>
|
||||||
|
*/
|
||||||
|
private $fallbackDirsPsr0 = array();
|
||||||
|
|
||||||
|
/** @var bool */
|
||||||
|
private $useIncludePath = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array<string, string>
|
||||||
|
*/
|
||||||
|
private $classMap = array();
|
||||||
|
|
||||||
|
/** @var bool */
|
||||||
|
private $classMapAuthoritative = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array<string, bool>
|
||||||
|
*/
|
||||||
|
private $missingClasses = array();
|
||||||
|
|
||||||
|
/** @var string|null */
|
||||||
|
private $apcuPrefix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array<string, self>
|
||||||
|
*/
|
||||||
|
private static $registeredLoaders = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string|null $vendorDir
|
||||||
|
*/
|
||||||
|
public function __construct($vendorDir = null)
|
||||||
|
{
|
||||||
|
$this->vendorDir = $vendorDir;
|
||||||
|
self::initializeIncludeClosure();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, list<string>>
|
||||||
|
*/
|
||||||
|
public function getPrefixes()
|
||||||
|
{
|
||||||
|
if (!empty($this->prefixesPsr0)) {
|
||||||
|
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
|
||||||
|
}
|
||||||
|
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, list<string>>
|
||||||
|
*/
|
||||||
|
public function getPrefixesPsr4()
|
||||||
|
{
|
||||||
|
return $this->prefixDirsPsr4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return list<string>
|
||||||
|
*/
|
||||||
|
public function getFallbackDirs()
|
||||||
|
{
|
||||||
|
return $this->fallbackDirsPsr0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return list<string>
|
||||||
|
*/
|
||||||
|
public function getFallbackDirsPsr4()
|
||||||
|
{
|
||||||
|
return $this->fallbackDirsPsr4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, string> Array of classname => path
|
||||||
|
*/
|
||||||
|
public function getClassMap()
|
||||||
|
{
|
||||||
|
return $this->classMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, string> $classMap Class to filename map
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function addClassMap(array $classMap)
|
||||||
|
{
|
||||||
|
if ($this->classMap) {
|
||||||
|
$this->classMap = array_merge($this->classMap, $classMap);
|
||||||
|
} else {
|
||||||
|
$this->classMap = $classMap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a set of PSR-0 directories for a given prefix, either
|
||||||
|
* appending or prepending to the ones previously set for this prefix.
|
||||||
|
*
|
||||||
|
* @param string $prefix The prefix
|
||||||
|
* @param list<string>|string $paths The PSR-0 root directories
|
||||||
|
* @param bool $prepend Whether to prepend the directories
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function add($prefix, $paths, $prepend = false)
|
||||||
|
{
|
||||||
|
$paths = (array) $paths;
|
||||||
|
if (!$prefix) {
|
||||||
|
if ($prepend) {
|
||||||
|
$this->fallbackDirsPsr0 = array_merge(
|
||||||
|
$paths,
|
||||||
|
$this->fallbackDirsPsr0
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$this->fallbackDirsPsr0 = array_merge(
|
||||||
|
$this->fallbackDirsPsr0,
|
||||||
|
$paths
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$first = $prefix[0];
|
||||||
|
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
||||||
|
$this->prefixesPsr0[$first][$prefix] = $paths;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($prepend) {
|
||||||
|
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||||
|
$paths,
|
||||||
|
$this->prefixesPsr0[$first][$prefix]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||||
|
$this->prefixesPsr0[$first][$prefix],
|
||||||
|
$paths
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a set of PSR-4 directories for a given namespace, either
|
||||||
|
* appending or prepending to the ones previously set for this namespace.
|
||||||
|
*
|
||||||
|
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||||
|
* @param list<string>|string $paths The PSR-4 base directories
|
||||||
|
* @param bool $prepend Whether to prepend the directories
|
||||||
|
*
|
||||||
|
* @throws \InvalidArgumentException
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function addPsr4($prefix, $paths, $prepend = false)
|
||||||
|
{
|
||||||
|
$paths = (array) $paths;
|
||||||
|
if (!$prefix) {
|
||||||
|
// Register directories for the root namespace.
|
||||||
|
if ($prepend) {
|
||||||
|
$this->fallbackDirsPsr4 = array_merge(
|
||||||
|
$paths,
|
||||||
|
$this->fallbackDirsPsr4
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$this->fallbackDirsPsr4 = array_merge(
|
||||||
|
$this->fallbackDirsPsr4,
|
||||||
|
$paths
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
||||||
|
// Register directories for a new namespace.
|
||||||
|
$length = strlen($prefix);
|
||||||
|
if ('\\' !== $prefix[$length - 1]) {
|
||||||
|
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||||
|
}
|
||||||
|
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||||
|
$this->prefixDirsPsr4[$prefix] = $paths;
|
||||||
|
} elseif ($prepend) {
|
||||||
|
// Prepend directories for an already registered namespace.
|
||||||
|
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||||
|
$paths,
|
||||||
|
$this->prefixDirsPsr4[$prefix]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// Append directories for an already registered namespace.
|
||||||
|
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||||
|
$this->prefixDirsPsr4[$prefix],
|
||||||
|
$paths
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a set of PSR-0 directories for a given prefix,
|
||||||
|
* replacing any others previously set for this prefix.
|
||||||
|
*
|
||||||
|
* @param string $prefix The prefix
|
||||||
|
* @param list<string>|string $paths The PSR-0 base directories
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function set($prefix, $paths)
|
||||||
|
{
|
||||||
|
if (!$prefix) {
|
||||||
|
$this->fallbackDirsPsr0 = (array) $paths;
|
||||||
|
} else {
|
||||||
|
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a set of PSR-4 directories for a given namespace,
|
||||||
|
* replacing any others previously set for this namespace.
|
||||||
|
*
|
||||||
|
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||||
|
* @param list<string>|string $paths The PSR-4 base directories
|
||||||
|
*
|
||||||
|
* @throws \InvalidArgumentException
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setPsr4($prefix, $paths)
|
||||||
|
{
|
||||||
|
if (!$prefix) {
|
||||||
|
$this->fallbackDirsPsr4 = (array) $paths;
|
||||||
|
} else {
|
||||||
|
$length = strlen($prefix);
|
||||||
|
if ('\\' !== $prefix[$length - 1]) {
|
||||||
|
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||||
|
}
|
||||||
|
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||||
|
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turns on searching the include path for class files.
|
||||||
|
*
|
||||||
|
* @param bool $useIncludePath
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setUseIncludePath($useIncludePath)
|
||||||
|
{
|
||||||
|
$this->useIncludePath = $useIncludePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can be used to check if the autoloader uses the include path to check
|
||||||
|
* for classes.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function getUseIncludePath()
|
||||||
|
{
|
||||||
|
return $this->useIncludePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turns off searching the prefix and fallback directories for classes
|
||||||
|
* that have not been registered with the class map.
|
||||||
|
*
|
||||||
|
* @param bool $classMapAuthoritative
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setClassMapAuthoritative($classMapAuthoritative)
|
||||||
|
{
|
||||||
|
$this->classMapAuthoritative = $classMapAuthoritative;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should class lookup fail if not found in the current class map?
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isClassMapAuthoritative()
|
||||||
|
{
|
||||||
|
return $this->classMapAuthoritative;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
||||||
|
*
|
||||||
|
* @param string|null $apcuPrefix
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setApcuPrefix($apcuPrefix)
|
||||||
|
{
|
||||||
|
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The APCu prefix in use, or null if APCu caching is not enabled.
|
||||||
|
*
|
||||||
|
* @return string|null
|
||||||
|
*/
|
||||||
|
public function getApcuPrefix()
|
||||||
|
{
|
||||||
|
return $this->apcuPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers this instance as an autoloader.
|
||||||
|
*
|
||||||
|
* @param bool $prepend Whether to prepend the autoloader or not
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register($prepend = false)
|
||||||
|
{
|
||||||
|
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
||||||
|
|
||||||
|
if (null === $this->vendorDir) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($prepend) {
|
||||||
|
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
|
||||||
|
} else {
|
||||||
|
unset(self::$registeredLoaders[$this->vendorDir]);
|
||||||
|
self::$registeredLoaders[$this->vendorDir] = $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregisters this instance as an autoloader.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function unregister()
|
||||||
|
{
|
||||||
|
spl_autoload_unregister(array($this, 'loadClass'));
|
||||||
|
|
||||||
|
if (null !== $this->vendorDir) {
|
||||||
|
unset(self::$registeredLoaders[$this->vendorDir]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the given class or interface.
|
||||||
|
*
|
||||||
|
* @param string $class The name of the class
|
||||||
|
* @return true|null True if loaded, null otherwise
|
||||||
|
*/
|
||||||
|
public function loadClass($class)
|
||||||
|
{
|
||||||
|
if ($file = $this->findFile($class)) {
|
||||||
|
$includeFile = self::$includeFile;
|
||||||
|
$includeFile($file);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the path to the file where the class is defined.
|
||||||
|
*
|
||||||
|
* @param string $class The name of the class
|
||||||
|
*
|
||||||
|
* @return string|false The path if found, false otherwise
|
||||||
|
*/
|
||||||
|
public function findFile($class)
|
||||||
|
{
|
||||||
|
// class map lookup
|
||||||
|
if (isset($this->classMap[$class])) {
|
||||||
|
return $this->classMap[$class];
|
||||||
|
}
|
||||||
|
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (null !== $this->apcuPrefix) {
|
||||||
|
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
|
||||||
|
if ($hit) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$file = $this->findFileWithExtension($class, '.php');
|
||||||
|
|
||||||
|
// Search for Hack files if we are running on HHVM
|
||||||
|
if (false === $file && defined('HHVM_VERSION')) {
|
||||||
|
$file = $this->findFileWithExtension($class, '.hh');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null !== $this->apcuPrefix) {
|
||||||
|
apcu_add($this->apcuPrefix.$class, $file);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (false === $file) {
|
||||||
|
// Remember that this class does not exist.
|
||||||
|
$this->missingClasses[$class] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the currently registered loaders keyed by their corresponding vendor directories.
|
||||||
|
*
|
||||||
|
* @return array<string, self>
|
||||||
|
*/
|
||||||
|
public static function getRegisteredLoaders()
|
||||||
|
{
|
||||||
|
return self::$registeredLoaders;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $class
|
||||||
|
* @param string $ext
|
||||||
|
* @return string|false
|
||||||
|
*/
|
||||||
|
private function findFileWithExtension($class, $ext)
|
||||||
|
{
|
||||||
|
// PSR-4 lookup
|
||||||
|
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
||||||
|
|
||||||
|
$first = $class[0];
|
||||||
|
if (isset($this->prefixLengthsPsr4[$first])) {
|
||||||
|
$subPath = $class;
|
||||||
|
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
||||||
|
$subPath = substr($subPath, 0, $lastPos);
|
||||||
|
$search = $subPath . '\\';
|
||||||
|
if (isset($this->prefixDirsPsr4[$search])) {
|
||||||
|
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
|
||||||
|
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
||||||
|
if (file_exists($file = $dir . $pathEnd)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PSR-4 fallback dirs
|
||||||
|
foreach ($this->fallbackDirsPsr4 as $dir) {
|
||||||
|
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PSR-0 lookup
|
||||||
|
if (false !== $pos = strrpos($class, '\\')) {
|
||||||
|
// namespaced class name
|
||||||
|
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
||||||
|
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
||||||
|
} else {
|
||||||
|
// PEAR-like class name
|
||||||
|
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($this->prefixesPsr0[$first])) {
|
||||||
|
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
||||||
|
if (0 === strpos($class, $prefix)) {
|
||||||
|
foreach ($dirs as $dir) {
|
||||||
|
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PSR-0 fallback dirs
|
||||||
|
foreach ($this->fallbackDirsPsr0 as $dir) {
|
||||||
|
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PSR-0 include paths.
|
||||||
|
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private static function initializeIncludeClosure()
|
||||||
|
{
|
||||||
|
if (self::$includeFile !== null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scope isolated include.
|
||||||
|
*
|
||||||
|
* Prevents access to $this/self from included files.
|
||||||
|
*
|
||||||
|
* @param string $file
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
self::$includeFile = \Closure::bind(static function($file) {
|
||||||
|
include $file;
|
||||||
|
}, null, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
362
vendor/composer/InstalledVersions.php
vendored
Normal file
362
vendor/composer/InstalledVersions.php
vendored
Normal file
@@ -0,0 +1,362 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Composer.
|
||||||
|
*
|
||||||
|
* (c) Nils Adermann <naderman@naderman.de>
|
||||||
|
* Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Composer;
|
||||||
|
|
||||||
|
use Composer\Autoload\ClassLoader;
|
||||||
|
use Composer\Semver\VersionParser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class is copied in every Composer installed project and available to all
|
||||||
|
*
|
||||||
|
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
|
||||||
|
*
|
||||||
|
* To require its presence, you can require `composer-runtime-api ^2.0`
|
||||||
|
*
|
||||||
|
* @final
|
||||||
|
*/
|
||||||
|
class InstalledVersions
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var mixed[]|null
|
||||||
|
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
|
||||||
|
*/
|
||||||
|
private static $installed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool|null
|
||||||
|
*/
|
||||||
|
private static $canGetVendors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array[]
|
||||||
|
* @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||||
|
*/
|
||||||
|
private static $installedByVendor = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of all package names which are present, either by being installed, replaced or provided
|
||||||
|
*
|
||||||
|
* @return string[]
|
||||||
|
* @psalm-return list<string>
|
||||||
|
*/
|
||||||
|
public static function getInstalledPackages()
|
||||||
|
{
|
||||||
|
$packages = array();
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
$packages[] = array_keys($installed['versions']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (1 === \count($packages)) {
|
||||||
|
return $packages[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of all package names with a specific type e.g. 'library'
|
||||||
|
*
|
||||||
|
* @param string $type
|
||||||
|
* @return string[]
|
||||||
|
* @psalm-return list<string>
|
||||||
|
*/
|
||||||
|
public static function getInstalledPackagesByType($type)
|
||||||
|
{
|
||||||
|
$packagesByType = array();
|
||||||
|
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
foreach ($installed['versions'] as $name => $package) {
|
||||||
|
if (isset($package['type']) && $package['type'] === $type) {
|
||||||
|
$packagesByType[] = $name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $packagesByType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the given package is installed
|
||||||
|
*
|
||||||
|
* This also returns true if the package name is provided or replaced by another package
|
||||||
|
*
|
||||||
|
* @param string $packageName
|
||||||
|
* @param bool $includeDevRequirements
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function isInstalled($packageName, $includeDevRequirements = true)
|
||||||
|
{
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
if (isset($installed['versions'][$packageName])) {
|
||||||
|
return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the given package satisfies a version constraint
|
||||||
|
*
|
||||||
|
* e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
|
||||||
|
*
|
||||||
|
* Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
|
||||||
|
*
|
||||||
|
* @param VersionParser $parser Install composer/semver to have access to this class and functionality
|
||||||
|
* @param string $packageName
|
||||||
|
* @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function satisfies(VersionParser $parser, $packageName, $constraint)
|
||||||
|
{
|
||||||
|
$constraint = $parser->parseConstraints((string) $constraint);
|
||||||
|
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
|
||||||
|
|
||||||
|
return $provided->matches($constraint);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a version constraint representing all the range(s) which are installed for a given package
|
||||||
|
*
|
||||||
|
* It is easier to use this via isInstalled() with the $constraint argument if you need to check
|
||||||
|
* whether a given version of a package is installed, and not just whether it exists
|
||||||
|
*
|
||||||
|
* @param string $packageName
|
||||||
|
* @return string Version constraint usable with composer/semver
|
||||||
|
*/
|
||||||
|
public static function getVersionRanges($packageName)
|
||||||
|
{
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
if (!isset($installed['versions'][$packageName])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$ranges = array();
|
||||||
|
if (isset($installed['versions'][$packageName]['pretty_version'])) {
|
||||||
|
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
|
||||||
|
}
|
||||||
|
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
|
||||||
|
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
|
||||||
|
}
|
||||||
|
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
|
||||||
|
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
|
||||||
|
}
|
||||||
|
if (array_key_exists('provided', $installed['versions'][$packageName])) {
|
||||||
|
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode(' || ', $ranges);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $packageName
|
||||||
|
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
|
||||||
|
*/
|
||||||
|
public static function getVersion($packageName)
|
||||||
|
{
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
if (!isset($installed['versions'][$packageName])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($installed['versions'][$packageName]['version'])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $installed['versions'][$packageName]['version'];
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $packageName
|
||||||
|
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
|
||||||
|
*/
|
||||||
|
public static function getPrettyVersion($packageName)
|
||||||
|
{
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
if (!isset($installed['versions'][$packageName])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $installed['versions'][$packageName]['pretty_version'];
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $packageName
|
||||||
|
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
|
||||||
|
*/
|
||||||
|
public static function getReference($packageName)
|
||||||
|
{
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
if (!isset($installed['versions'][$packageName])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($installed['versions'][$packageName]['reference'])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $installed['versions'][$packageName]['reference'];
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $packageName
|
||||||
|
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
|
||||||
|
*/
|
||||||
|
public static function getInstallPath($packageName)
|
||||||
|
{
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
if (!isset($installed['versions'][$packageName])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
* @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
|
||||||
|
*/
|
||||||
|
public static function getRootPackage()
|
||||||
|
{
|
||||||
|
$installed = self::getInstalled();
|
||||||
|
|
||||||
|
return $installed[0]['root'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the raw installed.php data for custom implementations
|
||||||
|
*
|
||||||
|
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
|
||||||
|
* @return array[]
|
||||||
|
* @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
|
||||||
|
*/
|
||||||
|
public static function getRawData()
|
||||||
|
{
|
||||||
|
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
|
||||||
|
|
||||||
|
if (null === self::$installed) {
|
||||||
|
// only require the installed.php file if this file is loaded from its dumped location,
|
||||||
|
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
||||||
|
if (substr(__DIR__, -8, 1) !== 'C') {
|
||||||
|
self::$installed = include __DIR__ . '/installed.php';
|
||||||
|
} else {
|
||||||
|
self::$installed = array();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$installed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the raw data of all installed.php which are currently loaded for custom implementations
|
||||||
|
*
|
||||||
|
* @return array[]
|
||||||
|
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||||
|
*/
|
||||||
|
public static function getAllRawData()
|
||||||
|
{
|
||||||
|
return self::getInstalled();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lets you reload the static array from another file
|
||||||
|
*
|
||||||
|
* This is only useful for complex integrations in which a project needs to use
|
||||||
|
* this class but then also needs to execute another project's autoloader in process,
|
||||||
|
* and wants to ensure both projects have access to their version of installed.php.
|
||||||
|
*
|
||||||
|
* A typical case would be PHPUnit, where it would need to make sure it reads all
|
||||||
|
* the data it needs from this class, then call reload() with
|
||||||
|
* `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
|
||||||
|
* the project in which it runs can then also use this class safely, without
|
||||||
|
* interference between PHPUnit's dependencies and the project's dependencies.
|
||||||
|
*
|
||||||
|
* @param array[] $data A vendor/composer/installed.php data set
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
|
||||||
|
*/
|
||||||
|
public static function reload($data)
|
||||||
|
{
|
||||||
|
self::$installed = $data;
|
||||||
|
self::$installedByVendor = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array[]
|
||||||
|
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||||
|
*/
|
||||||
|
private static function getInstalled()
|
||||||
|
{
|
||||||
|
if (null === self::$canGetVendors) {
|
||||||
|
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
|
||||||
|
}
|
||||||
|
|
||||||
|
$installed = array();
|
||||||
|
$copiedLocalDir = false;
|
||||||
|
|
||||||
|
if (self::$canGetVendors) {
|
||||||
|
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
|
||||||
|
if (isset(self::$installedByVendor[$vendorDir])) {
|
||||||
|
$installed[] = self::$installedByVendor[$vendorDir];
|
||||||
|
} elseif (is_file($vendorDir.'/composer/installed.php')) {
|
||||||
|
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
|
||||||
|
$required = require $vendorDir.'/composer/installed.php';
|
||||||
|
self::$installedByVendor[$vendorDir] = $required;
|
||||||
|
$installed[] = $required;
|
||||||
|
if (strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
|
||||||
|
self::$installed = $required;
|
||||||
|
$copiedLocalDir = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null === self::$installed) {
|
||||||
|
// only require the installed.php file if this file is loaded from its dumped location,
|
||||||
|
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
||||||
|
if (substr(__DIR__, -8, 1) !== 'C') {
|
||||||
|
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
|
||||||
|
$required = require __DIR__ . '/installed.php';
|
||||||
|
self::$installed = $required;
|
||||||
|
} else {
|
||||||
|
self::$installed = array();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self::$installed !== array() && !$copiedLocalDir) {
|
||||||
|
$installed[] = self::$installed;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $installed;
|
||||||
|
}
|
||||||
|
}
|
||||||
21
vendor/composer/LICENSE
vendored
Normal file
21
vendor/composer/LICENSE
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
Copyright (c) Nils Adermann, Jordi Boggiano
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
|
||||||
11
vendor/composer/autoload_classmap.php
vendored
Normal file
11
vendor/composer/autoload_classmap.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_classmap.php @generated by Composer
|
||||||
|
|
||||||
|
$vendorDir = dirname(__DIR__);
|
||||||
|
$baseDir = dirname($vendorDir);
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
||||||
|
'<27>' => $vendorDir . '/symfony/cache/Traits/ValueWrapper.php',
|
||||||
|
);
|
||||||
10
vendor/composer/autoload_files.php
vendored
Normal file
10
vendor/composer/autoload_files.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_files.php @generated by Composer
|
||||||
|
|
||||||
|
$vendorDir = dirname(__DIR__);
|
||||||
|
$baseDir = dirname($vendorDir);
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
|
||||||
|
);
|
||||||
9
vendor/composer/autoload_namespaces.php
vendored
Normal file
9
vendor/composer/autoload_namespaces.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_namespaces.php @generated by Composer
|
||||||
|
|
||||||
|
$vendorDir = dirname(__DIR__);
|
||||||
|
$baseDir = dirname($vendorDir);
|
||||||
|
|
||||||
|
return array(
|
||||||
|
);
|
||||||
18
vendor/composer/autoload_psr4.php
vendored
Normal file
18
vendor/composer/autoload_psr4.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_psr4.php @generated by Composer
|
||||||
|
|
||||||
|
$vendorDir = dirname(__DIR__);
|
||||||
|
$baseDir = dirname($vendorDir);
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'Symfony\\Contracts\\Service\\' => array($vendorDir . '/symfony/service-contracts'),
|
||||||
|
'Symfony\\Contracts\\Cache\\' => array($vendorDir . '/symfony/cache-contracts'),
|
||||||
|
'Symfony\\Component\\VarExporter\\' => array($vendorDir . '/symfony/var-exporter'),
|
||||||
|
'Symfony\\Component\\ExpressionLanguage\\' => array($vendorDir . '/symfony/expression-language'),
|
||||||
|
'Symfony\\Component\\Cache\\' => array($vendorDir . '/symfony/cache'),
|
||||||
|
'Psr\\Log\\' => array($vendorDir . '/psr/log/src'),
|
||||||
|
'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
|
||||||
|
'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'),
|
||||||
|
'PhpMyAdmin\\MoTranslator\\' => array($vendorDir . '/phpmyadmin/motranslator/src'),
|
||||||
|
);
|
||||||
50
vendor/composer/autoload_real.php
vendored
Normal file
50
vendor/composer/autoload_real.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_real.php @generated by Composer
|
||||||
|
|
||||||
|
class ComposerAutoloaderInitf0f23926796d6825a9caf18ca123a270
|
||||||
|
{
|
||||||
|
private static $loader;
|
||||||
|
|
||||||
|
public static function loadClassLoader($class)
|
||||||
|
{
|
||||||
|
if ('Composer\Autoload\ClassLoader' === $class) {
|
||||||
|
require __DIR__ . '/ClassLoader.php';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Composer\Autoload\ClassLoader
|
||||||
|
*/
|
||||||
|
public static function getLoader()
|
||||||
|
{
|
||||||
|
if (null !== self::$loader) {
|
||||||
|
return self::$loader;
|
||||||
|
}
|
||||||
|
|
||||||
|
require __DIR__ . '/platform_check.php';
|
||||||
|
|
||||||
|
spl_autoload_register(array('ComposerAutoloaderInitf0f23926796d6825a9caf18ca123a270', 'loadClassLoader'), true, true);
|
||||||
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||||
|
spl_autoload_unregister(array('ComposerAutoloaderInitf0f23926796d6825a9caf18ca123a270', 'loadClassLoader'));
|
||||||
|
|
||||||
|
require __DIR__ . '/autoload_static.php';
|
||||||
|
call_user_func(\Composer\Autoload\ComposerStaticInitf0f23926796d6825a9caf18ca123a270::getInitializer($loader));
|
||||||
|
|
||||||
|
$loader->register(true);
|
||||||
|
|
||||||
|
$filesToLoad = \Composer\Autoload\ComposerStaticInitf0f23926796d6825a9caf18ca123a270::$files;
|
||||||
|
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||||
|
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||||
|
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||||
|
|
||||||
|
require $file;
|
||||||
|
}
|
||||||
|
}, null, null);
|
||||||
|
foreach ($filesToLoad as $fileIdentifier => $file) {
|
||||||
|
$requireFile($fileIdentifier, $file);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $loader;
|
||||||
|
}
|
||||||
|
}
|
||||||
84
vendor/composer/autoload_static.php
vendored
Normal file
84
vendor/composer/autoload_static.php
vendored
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_static.php @generated by Composer
|
||||||
|
|
||||||
|
namespace Composer\Autoload;
|
||||||
|
|
||||||
|
class ComposerStaticInitf0f23926796d6825a9caf18ca123a270
|
||||||
|
{
|
||||||
|
public static $files = array (
|
||||||
|
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
|
||||||
|
);
|
||||||
|
|
||||||
|
public static $prefixLengthsPsr4 = array (
|
||||||
|
'S' =>
|
||||||
|
array (
|
||||||
|
'Symfony\\Contracts\\Service\\' => 26,
|
||||||
|
'Symfony\\Contracts\\Cache\\' => 24,
|
||||||
|
'Symfony\\Component\\VarExporter\\' => 30,
|
||||||
|
'Symfony\\Component\\ExpressionLanguage\\' => 37,
|
||||||
|
'Symfony\\Component\\Cache\\' => 24,
|
||||||
|
),
|
||||||
|
'P' =>
|
||||||
|
array (
|
||||||
|
'Psr\\Log\\' => 8,
|
||||||
|
'Psr\\Container\\' => 14,
|
||||||
|
'Psr\\Cache\\' => 10,
|
||||||
|
'PhpMyAdmin\\MoTranslator\\' => 24,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
public static $prefixDirsPsr4 = array (
|
||||||
|
'Symfony\\Contracts\\Service\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/symfony/service-contracts',
|
||||||
|
),
|
||||||
|
'Symfony\\Contracts\\Cache\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/symfony/cache-contracts',
|
||||||
|
),
|
||||||
|
'Symfony\\Component\\VarExporter\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/symfony/var-exporter',
|
||||||
|
),
|
||||||
|
'Symfony\\Component\\ExpressionLanguage\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/symfony/expression-language',
|
||||||
|
),
|
||||||
|
'Symfony\\Component\\Cache\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/symfony/cache',
|
||||||
|
),
|
||||||
|
'Psr\\Log\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/psr/log/src',
|
||||||
|
),
|
||||||
|
'Psr\\Container\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/psr/container/src',
|
||||||
|
),
|
||||||
|
'Psr\\Cache\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/psr/cache/src',
|
||||||
|
),
|
||||||
|
'PhpMyAdmin\\MoTranslator\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/phpmyadmin/motranslator/src',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
public static $classMap = array (
|
||||||
|
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
||||||
|
'<27>' => __DIR__ . '/..' . '/symfony/cache/Traits/ValueWrapper.php',
|
||||||
|
);
|
||||||
|
|
||||||
|
public static function getInitializer(ClassLoader $loader)
|
||||||
|
{
|
||||||
|
return \Closure::bind(function () use ($loader) {
|
||||||
|
$loader->prefixLengthsPsr4 = ComposerStaticInitf0f23926796d6825a9caf18ca123a270::$prefixLengthsPsr4;
|
||||||
|
$loader->prefixDirsPsr4 = ComposerStaticInitf0f23926796d6825a9caf18ca123a270::$prefixDirsPsr4;
|
||||||
|
$loader->classMap = ComposerStaticInitf0f23926796d6825a9caf18ca123a270::$classMap;
|
||||||
|
|
||||||
|
}, null, ClassLoader::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
709
vendor/composer/installed.json
vendored
Normal file
709
vendor/composer/installed.json
vendored
Normal file
@@ -0,0 +1,709 @@
|
|||||||
|
{
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "phpmyadmin/motranslator",
|
||||||
|
"version": "5.3.1",
|
||||||
|
"version_normalized": "5.3.1.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/phpmyadmin/motranslator.git",
|
||||||
|
"reference": "d03b4d9c608e7265091bf6decc05323d16c7c047"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/phpmyadmin/motranslator/zipball/d03b4d9c608e7265091bf6decc05323d16c7c047",
|
||||||
|
"reference": "d03b4d9c608e7265091bf6decc05323d16c7c047",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^7.1 || ^8.0",
|
||||||
|
"symfony/expression-language": "^4.0 || ^5.0 || ^6.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpmyadmin/coding-standard": "^3.0.0",
|
||||||
|
"phpstan/phpstan": "^1.4.6",
|
||||||
|
"phpunit/phpunit": "^7.4 || ^8 || ^9"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"ext-apcu": "Needed for ACPu-backed translation cache"
|
||||||
|
},
|
||||||
|
"time": "2023-08-23T18:32:07+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"PhpMyAdmin\\MoTranslator\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"GPL-2.0-or-later"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "The phpMyAdmin Team",
|
||||||
|
"email": "developers@phpmyadmin.net",
|
||||||
|
"homepage": "https://www.phpmyadmin.net/team/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Translation API for PHP using Gettext MO files",
|
||||||
|
"homepage": "https://github.com/phpmyadmin/motranslator",
|
||||||
|
"keywords": [
|
||||||
|
"gettext",
|
||||||
|
"i18n",
|
||||||
|
"mo",
|
||||||
|
"translator"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/phpmyadmin/motranslator/issues",
|
||||||
|
"source": "https://github.com/phpmyadmin/motranslator"
|
||||||
|
},
|
||||||
|
"install-path": "../phpmyadmin/motranslator"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "psr/cache",
|
||||||
|
"version": "3.0.0",
|
||||||
|
"version_normalized": "3.0.0.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/php-fig/cache.git",
|
||||||
|
"reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf",
|
||||||
|
"reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.0.0"
|
||||||
|
},
|
||||||
|
"time": "2021-02-03T23:26:27+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "1.0.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Psr\\Cache\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "PHP-FIG",
|
||||||
|
"homepage": "https://www.php-fig.org/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Common interface for caching libraries",
|
||||||
|
"keywords": [
|
||||||
|
"cache",
|
||||||
|
"psr",
|
||||||
|
"psr-6"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/php-fig/cache/tree/3.0.0"
|
||||||
|
},
|
||||||
|
"install-path": "../psr/cache"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "psr/container",
|
||||||
|
"version": "2.0.2",
|
||||||
|
"version_normalized": "2.0.2.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/php-fig/container.git",
|
||||||
|
"reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963",
|
||||||
|
"reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=7.4.0"
|
||||||
|
},
|
||||||
|
"time": "2021-11-05T16:47:00+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.0.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Psr\\Container\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "PHP-FIG",
|
||||||
|
"homepage": "https://www.php-fig.org/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Common Container Interface (PHP FIG PSR-11)",
|
||||||
|
"homepage": "https://github.com/php-fig/container",
|
||||||
|
"keywords": [
|
||||||
|
"PSR-11",
|
||||||
|
"container",
|
||||||
|
"container-interface",
|
||||||
|
"container-interop",
|
||||||
|
"psr"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/php-fig/container/issues",
|
||||||
|
"source": "https://github.com/php-fig/container/tree/2.0.2"
|
||||||
|
},
|
||||||
|
"install-path": "../psr/container"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "psr/log",
|
||||||
|
"version": "3.0.2",
|
||||||
|
"version_normalized": "3.0.2.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/php-fig/log.git",
|
||||||
|
"reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3",
|
||||||
|
"reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.0.0"
|
||||||
|
},
|
||||||
|
"time": "2024-09-11T13:17:53+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "3.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Psr\\Log\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "PHP-FIG",
|
||||||
|
"homepage": "https://www.php-fig.org/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Common interface for logging libraries",
|
||||||
|
"homepage": "https://github.com/php-fig/log",
|
||||||
|
"keywords": [
|
||||||
|
"log",
|
||||||
|
"psr",
|
||||||
|
"psr-3"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/php-fig/log/tree/3.0.2"
|
||||||
|
},
|
||||||
|
"install-path": "../psr/log"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/cache",
|
||||||
|
"version": "v7.2.1",
|
||||||
|
"version_normalized": "7.2.1.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/cache.git",
|
||||||
|
"reference": "e7e983596b744c4539f31e79b0350a6cf5878a20"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/cache/zipball/e7e983596b744c4539f31e79b0350a6cf5878a20",
|
||||||
|
"reference": "e7e983596b744c4539f31e79b0350a6cf5878a20",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.2",
|
||||||
|
"psr/cache": "^2.0|^3.0",
|
||||||
|
"psr/log": "^1.1|^2|^3",
|
||||||
|
"symfony/cache-contracts": "^2.5|^3",
|
||||||
|
"symfony/deprecation-contracts": "^2.5|^3.0",
|
||||||
|
"symfony/service-contracts": "^2.5|^3",
|
||||||
|
"symfony/var-exporter": "^6.4|^7.0"
|
||||||
|
},
|
||||||
|
"conflict": {
|
||||||
|
"doctrine/dbal": "<3.6",
|
||||||
|
"symfony/dependency-injection": "<6.4",
|
||||||
|
"symfony/http-kernel": "<6.4",
|
||||||
|
"symfony/var-dumper": "<6.4"
|
||||||
|
},
|
||||||
|
"provide": {
|
||||||
|
"psr/cache-implementation": "2.0|3.0",
|
||||||
|
"psr/simple-cache-implementation": "1.0|2.0|3.0",
|
||||||
|
"symfony/cache-implementation": "1.1|2.0|3.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"cache/integration-tests": "dev-master",
|
||||||
|
"doctrine/dbal": "^3.6|^4",
|
||||||
|
"predis/predis": "^1.1|^2.0",
|
||||||
|
"psr/simple-cache": "^1.0|^2.0|^3.0",
|
||||||
|
"symfony/clock": "^6.4|^7.0",
|
||||||
|
"symfony/config": "^6.4|^7.0",
|
||||||
|
"symfony/dependency-injection": "^6.4|^7.0",
|
||||||
|
"symfony/filesystem": "^6.4|^7.0",
|
||||||
|
"symfony/http-kernel": "^6.4|^7.0",
|
||||||
|
"symfony/messenger": "^6.4|^7.0",
|
||||||
|
"symfony/var-dumper": "^6.4|^7.0"
|
||||||
|
},
|
||||||
|
"time": "2024-12-07T08:08:50+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Component\\Cache\\": ""
|
||||||
|
},
|
||||||
|
"classmap": [
|
||||||
|
"Traits/ValueWrapper.php"
|
||||||
|
],
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nicolas Grekas",
|
||||||
|
"email": "p@tchwork.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Provides extended PSR-6, PSR-16 (and tags) implementations",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"keywords": [
|
||||||
|
"caching",
|
||||||
|
"psr6"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/symfony/cache/tree/v7.2.1"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://symfony.com/sponsor",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/fabpot",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"install-path": "../symfony/cache"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/cache-contracts",
|
||||||
|
"version": "v3.5.1",
|
||||||
|
"version_normalized": "3.5.1.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/cache-contracts.git",
|
||||||
|
"reference": "15a4f8e5cd3bce9aeafc882b1acab39ec8de2c1b"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/cache-contracts/zipball/15a4f8e5cd3bce9aeafc882b1acab39ec8de2c1b",
|
||||||
|
"reference": "15a4f8e5cd3bce9aeafc882b1acab39ec8de2c1b",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.1",
|
||||||
|
"psr/cache": "^3.0"
|
||||||
|
},
|
||||||
|
"time": "2024-09-25T14:20:29+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-main": "3.5-dev"
|
||||||
|
},
|
||||||
|
"thanks": {
|
||||||
|
"name": "symfony/contracts",
|
||||||
|
"url": "https://github.com/symfony/contracts"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Contracts\\Cache\\": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nicolas Grekas",
|
||||||
|
"email": "p@tchwork.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Generic abstractions related to caching",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"keywords": [
|
||||||
|
"abstractions",
|
||||||
|
"contracts",
|
||||||
|
"decoupling",
|
||||||
|
"interfaces",
|
||||||
|
"interoperability",
|
||||||
|
"standards"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/symfony/cache-contracts/tree/v3.5.1"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://symfony.com/sponsor",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/fabpot",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"install-path": "../symfony/cache-contracts"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/deprecation-contracts",
|
||||||
|
"version": "v3.5.1",
|
||||||
|
"version_normalized": "3.5.1.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/deprecation-contracts.git",
|
||||||
|
"reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6",
|
||||||
|
"reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.1"
|
||||||
|
},
|
||||||
|
"time": "2024-09-25T14:20:29+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-main": "3.5-dev"
|
||||||
|
},
|
||||||
|
"thanks": {
|
||||||
|
"name": "symfony/contracts",
|
||||||
|
"url": "https://github.com/symfony/contracts"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"function.php"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nicolas Grekas",
|
||||||
|
"email": "p@tchwork.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A generic function and convention to trigger deprecation notices",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.1"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://symfony.com/sponsor",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/fabpot",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"install-path": "../symfony/deprecation-contracts"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/expression-language",
|
||||||
|
"version": "v6.4.13",
|
||||||
|
"version_normalized": "6.4.13.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/expression-language.git",
|
||||||
|
"reference": "3524904fb026356a5230cd197f9a4e6a61e0e7df"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/expression-language/zipball/3524904fb026356a5230cd197f9a4e6a61e0e7df",
|
||||||
|
"reference": "3524904fb026356a5230cd197f9a4e6a61e0e7df",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.1",
|
||||||
|
"symfony/cache": "^5.4|^6.0|^7.0",
|
||||||
|
"symfony/deprecation-contracts": "^2.5|^3",
|
||||||
|
"symfony/service-contracts": "^2.5|^3"
|
||||||
|
},
|
||||||
|
"time": "2024-10-09T08:40:40+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Component\\ExpressionLanguage\\": ""
|
||||||
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Fabien Potencier",
|
||||||
|
"email": "fabien@symfony.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Provides an engine that can compile and evaluate expressions",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/symfony/expression-language/tree/v6.4.13"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://symfony.com/sponsor",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/fabpot",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"install-path": "../symfony/expression-language"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/service-contracts",
|
||||||
|
"version": "v3.5.1",
|
||||||
|
"version_normalized": "3.5.1.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/service-contracts.git",
|
||||||
|
"reference": "e53260aabf78fb3d63f8d79d69ece59f80d5eda0"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/e53260aabf78fb3d63f8d79d69ece59f80d5eda0",
|
||||||
|
"reference": "e53260aabf78fb3d63f8d79d69ece59f80d5eda0",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.1",
|
||||||
|
"psr/container": "^1.1|^2.0",
|
||||||
|
"symfony/deprecation-contracts": "^2.5|^3"
|
||||||
|
},
|
||||||
|
"conflict": {
|
||||||
|
"ext-psr": "<1.1|>=2"
|
||||||
|
},
|
||||||
|
"time": "2024-09-25T14:20:29+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-main": "3.5-dev"
|
||||||
|
},
|
||||||
|
"thanks": {
|
||||||
|
"name": "symfony/contracts",
|
||||||
|
"url": "https://github.com/symfony/contracts"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Contracts\\Service\\": ""
|
||||||
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Test/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nicolas Grekas",
|
||||||
|
"email": "p@tchwork.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Generic abstractions related to writing services",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"keywords": [
|
||||||
|
"abstractions",
|
||||||
|
"contracts",
|
||||||
|
"decoupling",
|
||||||
|
"interfaces",
|
||||||
|
"interoperability",
|
||||||
|
"standards"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/symfony/service-contracts/tree/v3.5.1"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://symfony.com/sponsor",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/fabpot",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"install-path": "../symfony/service-contracts"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/var-exporter",
|
||||||
|
"version": "v7.2.0",
|
||||||
|
"version_normalized": "7.2.0.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/var-exporter.git",
|
||||||
|
"reference": "1a6a89f95a46af0f142874c9d650a6358d13070d"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/var-exporter/zipball/1a6a89f95a46af0f142874c9d650a6358d13070d",
|
||||||
|
"reference": "1a6a89f95a46af0f142874c9d650a6358d13070d",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.2"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"symfony/property-access": "^6.4|^7.0",
|
||||||
|
"symfony/serializer": "^6.4|^7.0",
|
||||||
|
"symfony/var-dumper": "^6.4|^7.0"
|
||||||
|
},
|
||||||
|
"time": "2024-10-18T07:58:17+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Component\\VarExporter\\": ""
|
||||||
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nicolas Grekas",
|
||||||
|
"email": "p@tchwork.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Allows exporting any serializable PHP data structure to plain PHP code",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"keywords": [
|
||||||
|
"clone",
|
||||||
|
"construct",
|
||||||
|
"export",
|
||||||
|
"hydrate",
|
||||||
|
"instantiate",
|
||||||
|
"lazy-loading",
|
||||||
|
"proxy",
|
||||||
|
"serialize"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/symfony/var-exporter/tree/v7.2.0"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://symfony.com/sponsor",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/fabpot",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"install-path": "../symfony/var-exporter"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"dev-package-names": []
|
||||||
|
}
|
||||||
131
vendor/composer/installed.php
vendored
Normal file
131
vendor/composer/installed.php
vendored
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
<?php return array(
|
||||||
|
'root' => array(
|
||||||
|
'name' => '__root__',
|
||||||
|
'pretty_version' => 'dev-master',
|
||||||
|
'version' => 'dev-master',
|
||||||
|
'reference' => '4c22f27eb63b45502b3a4a42004e6d40d7da55a3',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../../',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev' => true,
|
||||||
|
),
|
||||||
|
'versions' => array(
|
||||||
|
'__root__' => array(
|
||||||
|
'pretty_version' => 'dev-master',
|
||||||
|
'version' => 'dev-master',
|
||||||
|
'reference' => '4c22f27eb63b45502b3a4a42004e6d40d7da55a3',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../../',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'phpmyadmin/motranslator' => array(
|
||||||
|
'pretty_version' => '5.3.1',
|
||||||
|
'version' => '5.3.1.0',
|
||||||
|
'reference' => 'd03b4d9c608e7265091bf6decc05323d16c7c047',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../phpmyadmin/motranslator',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'psr/cache' => array(
|
||||||
|
'pretty_version' => '3.0.0',
|
||||||
|
'version' => '3.0.0.0',
|
||||||
|
'reference' => 'aa5030cfa5405eccfdcb1083ce040c2cb8d253bf',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../psr/cache',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'psr/cache-implementation' => array(
|
||||||
|
'dev_requirement' => false,
|
||||||
|
'provided' => array(
|
||||||
|
0 => '2.0|3.0',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'psr/container' => array(
|
||||||
|
'pretty_version' => '2.0.2',
|
||||||
|
'version' => '2.0.2.0',
|
||||||
|
'reference' => 'c71ecc56dfe541dbd90c5360474fbc405f8d5963',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../psr/container',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'psr/log' => array(
|
||||||
|
'pretty_version' => '3.0.2',
|
||||||
|
'version' => '3.0.2.0',
|
||||||
|
'reference' => 'f16e1d5863e37f8d8c2a01719f5b34baa2b714d3',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../psr/log',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'psr/simple-cache-implementation' => array(
|
||||||
|
'dev_requirement' => false,
|
||||||
|
'provided' => array(
|
||||||
|
0 => '1.0|2.0|3.0',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'symfony/cache' => array(
|
||||||
|
'pretty_version' => 'v7.2.1',
|
||||||
|
'version' => '7.2.1.0',
|
||||||
|
'reference' => 'e7e983596b744c4539f31e79b0350a6cf5878a20',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../symfony/cache',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'symfony/cache-contracts' => array(
|
||||||
|
'pretty_version' => 'v3.5.1',
|
||||||
|
'version' => '3.5.1.0',
|
||||||
|
'reference' => '15a4f8e5cd3bce9aeafc882b1acab39ec8de2c1b',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../symfony/cache-contracts',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'symfony/cache-implementation' => array(
|
||||||
|
'dev_requirement' => false,
|
||||||
|
'provided' => array(
|
||||||
|
0 => '1.1|2.0|3.0',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'symfony/deprecation-contracts' => array(
|
||||||
|
'pretty_version' => 'v3.5.1',
|
||||||
|
'version' => '3.5.1.0',
|
||||||
|
'reference' => '74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../symfony/deprecation-contracts',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'symfony/expression-language' => array(
|
||||||
|
'pretty_version' => 'v6.4.13',
|
||||||
|
'version' => '6.4.13.0',
|
||||||
|
'reference' => '3524904fb026356a5230cd197f9a4e6a61e0e7df',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../symfony/expression-language',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'symfony/service-contracts' => array(
|
||||||
|
'pretty_version' => 'v3.5.1',
|
||||||
|
'version' => '3.5.1.0',
|
||||||
|
'reference' => 'e53260aabf78fb3d63f8d79d69ece59f80d5eda0',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../symfony/service-contracts',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'symfony/var-exporter' => array(
|
||||||
|
'pretty_version' => 'v7.2.0',
|
||||||
|
'version' => '7.2.0.0',
|
||||||
|
'reference' => '1a6a89f95a46af0f142874c9d650a6358d13070d',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../symfony/var-exporter',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
26
vendor/composer/platform_check.php
vendored
Normal file
26
vendor/composer/platform_check.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// platform_check.php @generated by Composer
|
||||||
|
|
||||||
|
$issues = array();
|
||||||
|
|
||||||
|
if (!(PHP_VERSION_ID >= 80200)) {
|
||||||
|
$issues[] = 'Your Composer dependencies require a PHP version ">= 8.2.0". You are running ' . PHP_VERSION . '.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($issues) {
|
||||||
|
if (!headers_sent()) {
|
||||||
|
header('HTTP/1.1 500 Internal Server Error');
|
||||||
|
}
|
||||||
|
if (!ini_get('display_errors')) {
|
||||||
|
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
||||||
|
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
|
||||||
|
} elseif (!headers_sent()) {
|
||||||
|
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
trigger_error(
|
||||||
|
'Composer detected issues in your platform: ' . implode(' ', $issues),
|
||||||
|
E_USER_ERROR
|
||||||
|
);
|
||||||
|
}
|
||||||
104
vendor/phpmyadmin/motranslator/CHANGELOG.md
vendored
Normal file
104
vendor/phpmyadmin/motranslator/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
# Change Log
|
||||||
|
|
||||||
|
## [5.3.1] - 2023-08-23
|
||||||
|
|
||||||
|
* Add function guards to the global functions (#44)
|
||||||
|
|
||||||
|
## [5.3.0] - 2022-04-26
|
||||||
|
|
||||||
|
* Add support for Symfony 6
|
||||||
|
* Split out `.mo` parsing to separate `MoParser` class
|
||||||
|
* Added `CacheInterface` so alternate cache implementations are pluggable
|
||||||
|
* Added `ApcuCache` implementation to leverage shared in-memory translation cache
|
||||||
|
|
||||||
|
## [5.2.0] - 2021-02-05
|
||||||
|
|
||||||
|
* Fix "Translator::selectString() must be of the type integer, boolean returned" (#37)
|
||||||
|
* Fix "TypeError: StringReader::readintarray() ($count) must be of type int, float given" failing tests on ARM (#36)
|
||||||
|
* Add support for getting and setting all translations (#30)
|
||||||
|
|
||||||
|
## [5.1.0] - 2020-11-15
|
||||||
|
|
||||||
|
* Allow PHPUnit 9 (#35)
|
||||||
|
* Fix some typos
|
||||||
|
* Sync config files
|
||||||
|
* Allow PHP 8.0
|
||||||
|
|
||||||
|
## [5.0.0] - 2020-02-28
|
||||||
|
|
||||||
|
* Drop support for PHP 5.3, PHP 5.4, PHP 5.5, PHP 5.6, PHP 7.0 and HHVM
|
||||||
|
* Enabled strict mode on PHP files
|
||||||
|
* Add support for Symfony 5 (#34)
|
||||||
|
* Add support for phpunit 8
|
||||||
|
* Rename CHANGES.md to CHANGELOG.md and follow a standard format
|
||||||
|
|
||||||
|
## [4.0] - 2018-02-12
|
||||||
|
|
||||||
|
* The library no longer changes system locales.
|
||||||
|
|
||||||
|
## [3.4] - 2017-12-15
|
||||||
|
|
||||||
|
* Added Translator::setTranslation method.
|
||||||
|
|
||||||
|
## [3.3] - 2017-06-01
|
||||||
|
|
||||||
|
* Add support for switching locales for Loader instance.
|
||||||
|
|
||||||
|
## [3.2] - 2017-05-23
|
||||||
|
|
||||||
|
* Various fixes when handling corrupted mo files.
|
||||||
|
|
||||||
|
## [3.1] - 2017-05-15
|
||||||
|
|
||||||
|
* Documentation improvements.
|
||||||
|
|
||||||
|
## [3.0] - 2017-01-23
|
||||||
|
|
||||||
|
* All classes moved to the PhpMyAdmin namespace.
|
||||||
|
|
||||||
|
## [2.2] - 2017-01-07
|
||||||
|
|
||||||
|
* Coding style cleanup.
|
||||||
|
* Avoid installing tests using composer.
|
||||||
|
|
||||||
|
## [2.1] - 2016-12-21
|
||||||
|
|
||||||
|
* Various code cleanups.
|
||||||
|
* Added support for PHP 5.3.
|
||||||
|
|
||||||
|
## [2.0] - 2016-10-13
|
||||||
|
|
||||||
|
* Consistently use camelCase in API.
|
||||||
|
* No more relies on using eval().
|
||||||
|
* Depends on symfony/expression-language for calculations.
|
||||||
|
|
||||||
|
## [1.2] - 2016-09-22
|
||||||
|
|
||||||
|
* Stricter validation of plural expression.
|
||||||
|
|
||||||
|
## [1.1] - 2016-08-29
|
||||||
|
|
||||||
|
* Improved handling of corrupted mo files.
|
||||||
|
* Minor performance improvements.
|
||||||
|
* Stricter validation of plural expression.
|
||||||
|
|
||||||
|
## [1.0] - 2016-04-27
|
||||||
|
|
||||||
|
* Documentation improvements.
|
||||||
|
* Testsuite improvements.
|
||||||
|
|
||||||
|
## [0.4] - 2016-03-02
|
||||||
|
|
||||||
|
* Fixed test failures with hhvm due to broken putenv.
|
||||||
|
|
||||||
|
## [0.3] - 2016-03-01
|
||||||
|
|
||||||
|
* Added Loader::detectlocale method.
|
||||||
|
|
||||||
|
## [0.2] - 2016-02-24
|
||||||
|
|
||||||
|
* Marked PHP 5.4 and 5.5 as supported.
|
||||||
|
|
||||||
|
## [0.1] - 2016-02-23
|
||||||
|
|
||||||
|
* Initial release.
|
||||||
76
vendor/phpmyadmin/motranslator/CODE_OF_CONDUCT.md
vendored
Normal file
76
vendor/phpmyadmin/motranslator/CODE_OF_CONDUCT.md
vendored
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
# Contributor Covenant Code of Conduct
|
||||||
|
|
||||||
|
## Our Pledge
|
||||||
|
|
||||||
|
In the interest of fostering an open and welcoming environment, we as
|
||||||
|
contributors and maintainers pledge to making participation in our project and
|
||||||
|
our community a harassment-free experience for everyone, regardless of age, body
|
||||||
|
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||||
|
level of experience, education, socio-economic status, nationality, personal
|
||||||
|
appearance, race, religion, or sexual identity and orientation.
|
||||||
|
|
||||||
|
## Our Standards
|
||||||
|
|
||||||
|
Examples of behavior that contributes to creating a positive environment
|
||||||
|
include:
|
||||||
|
|
||||||
|
* Using welcoming and inclusive language
|
||||||
|
* Being respectful of differing viewpoints and experiences
|
||||||
|
* Gracefully accepting constructive criticism
|
||||||
|
* Focusing on what is best for the community
|
||||||
|
* Showing empathy towards other community members
|
||||||
|
|
||||||
|
Examples of unacceptable behavior by participants include:
|
||||||
|
|
||||||
|
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||||
|
advances
|
||||||
|
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||||
|
* Public or private harassment
|
||||||
|
* Publishing others' private information, such as a physical or electronic
|
||||||
|
address, without explicit permission
|
||||||
|
* Other conduct which could reasonably be considered inappropriate in a
|
||||||
|
professional setting
|
||||||
|
|
||||||
|
## Our Responsibilities
|
||||||
|
|
||||||
|
Project maintainers are responsible for clarifying the standards of acceptable
|
||||||
|
behavior and are expected to take appropriate and fair corrective action in
|
||||||
|
response to any instances of unacceptable behavior.
|
||||||
|
|
||||||
|
Project maintainers have the right and responsibility to remove, edit, or
|
||||||
|
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||||
|
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||||
|
permanently any contributor for other behaviors that they deem inappropriate,
|
||||||
|
threatening, offensive, or harmful.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
This Code of Conduct applies both within project spaces and in public spaces
|
||||||
|
when an individual is representing the project or its community. Examples of
|
||||||
|
representing a project or community include using an official project e-mail
|
||||||
|
address, posting via an official social media account, or acting as an appointed
|
||||||
|
representative at an online or offline event. Representation of a project may be
|
||||||
|
further defined and clarified by project maintainers.
|
||||||
|
|
||||||
|
## Enforcement
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
|
reported by contacting the project team at info@phpmyadmin.net. All
|
||||||
|
complaints will be reviewed and investigated and will result in a response that
|
||||||
|
is deemed necessary and appropriate to the circumstances. The project team is
|
||||||
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||||
|
Further details of specific enforcement policies may be posted separately.
|
||||||
|
|
||||||
|
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||||
|
faith may face temporary or permanent repercussions as determined by other
|
||||||
|
members of the project's leadership.
|
||||||
|
|
||||||
|
## Attribution
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||||
|
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||||
|
|
||||||
|
[homepage]: https://www.contributor-covenant.org
|
||||||
|
|
||||||
|
For answers to common questions about this code of conduct, see
|
||||||
|
https://www.contributor-covenant.org/faq
|
||||||
42
vendor/phpmyadmin/motranslator/CONTRIBUTING.md
vendored
Normal file
42
vendor/phpmyadmin/motranslator/CONTRIBUTING.md
vendored
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# Contributing to motranslator
|
||||||
|
|
||||||
|
## Reporting issues
|
||||||
|
|
||||||
|
Our issue tracker is hosted at GitHub:
|
||||||
|
|
||||||
|
https://github.com/phpmyadmin/motranslator/issues
|
||||||
|
|
||||||
|
Please search for existing issues before reporting new ones.
|
||||||
|
|
||||||
|
## Working with Git checkout
|
||||||
|
|
||||||
|
The dependencies are managed by Composer, to get them all installed (or update
|
||||||
|
on consequent runs) do:
|
||||||
|
|
||||||
|
```
|
||||||
|
composer update
|
||||||
|
```
|
||||||
|
|
||||||
|
## Submitting patches
|
||||||
|
|
||||||
|
Please submit your patches using GitHub pull requests, this allows us to review
|
||||||
|
them and to run automated tests on the code.
|
||||||
|
|
||||||
|
## Coding standards
|
||||||
|
|
||||||
|
We do follow PSR-1 and PSR-2 coding standards.
|
||||||
|
|
||||||
|
You can use phpcbf to fix the code to match our expectations:
|
||||||
|
|
||||||
|
```
|
||||||
|
composer run phpcbf
|
||||||
|
```
|
||||||
|
|
||||||
|
## Testsuite
|
||||||
|
|
||||||
|
Our code comes with quite comprehensive testsuite, it is automatically executed
|
||||||
|
on every commit and pull request, you can also run it locally:
|
||||||
|
|
||||||
|
```
|
||||||
|
composer run phpunit
|
||||||
|
```
|
||||||
339
vendor/phpmyadmin/motranslator/LICENSE
vendored
Normal file
339
vendor/phpmyadmin/motranslator/LICENSE
vendored
Normal file
@@ -0,0 +1,339 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Lesser General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
{description}
|
||||||
|
Copyright (C) {year} {fullname}
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
{signature of Ty Coon}, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License.
|
||||||
29
vendor/phpmyadmin/motranslator/PERFORMANCE.md
vendored
Normal file
29
vendor/phpmyadmin/motranslator/PERFORMANCE.md
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# Performance
|
||||||
|
|
||||||
|
This library was tweaked for best performance for single use - translating
|
||||||
|
application with many strings using mo file. Current benchmarks show it's about
|
||||||
|
four times faster than original php-gettext.
|
||||||
|
|
||||||
|
There are two benchmark scripts in the code:
|
||||||
|
|
||||||
|
* ``benchmark-context.php`` - benchmarks context usage
|
||||||
|
* ``benchmark-plural.php`` - benchmarks plural evaluation
|
||||||
|
* ``benchmark.php`` - benchmarks file parsing
|
||||||
|
* ``benchmark-apcu.php`` - benchmarks file parsing with APCu cache enabled
|
||||||
|
|
||||||
|
## Performance measurements
|
||||||
|
|
||||||
|
The performance improvements based on individual changes in the code:
|
||||||
|
|
||||||
|
| Stage | Seconds |
|
||||||
|
| -------------- | --------------- |
|
||||||
|
| Original code | 4.7929680347443 |
|
||||||
|
| Remove nocache | 4.6308250427246 |
|
||||||
|
| Direct endian | 4.5883052349091 |
|
||||||
|
| Remove attribs | 4.5297479629517 |
|
||||||
|
| String reader | 1.8148958683014 |
|
||||||
|
| No offset | 1.2436759471893 |
|
||||||
|
| Less attribs | 1.1722540855408 |
|
||||||
|
| Remove shift | 1.0970499515533 |
|
||||||
|
| Magic order | 1.0868430137634 |
|
||||||
|
|
||||||
242
vendor/phpmyadmin/motranslator/README.md
vendored
Normal file
242
vendor/phpmyadmin/motranslator/README.md
vendored
Normal file
@@ -0,0 +1,242 @@
|
|||||||
|
# motranslator
|
||||||
|
|
||||||
|
Translation API for PHP using Gettext MO files.
|
||||||
|
|
||||||
|

|
||||||
|
[](https://codecov.io/github/phpmyadmin/motranslator?branch=master)
|
||||||
|
[](https://scrutinizer-ci.com/g/phpmyadmin/motranslator/?branch=master)
|
||||||
|
[](https://packagist.org/packages/phpmyadmin/motranslator)
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
* All strings are stored in memory for fast lookup
|
||||||
|
* Fast loading of MO files
|
||||||
|
* Low level API for reading MO files
|
||||||
|
* Emulation of Gettext API
|
||||||
|
* No use of `eval()` for plural equation
|
||||||
|
|
||||||
|
## Limitations
|
||||||
|
|
||||||
|
* Default `InMemoryCache` not suitable for huge MO files which you don't want to store in memory
|
||||||
|
* Input and output encoding has to match (preferably UTF-8)
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Please use [Composer][1] to install:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
composer require phpmyadmin/motranslator
|
||||||
|
```
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
The API documentation is available at <https://develdocs.phpmyadmin.net/motranslator/>.
|
||||||
|
|
||||||
|
## Object API usage
|
||||||
|
|
||||||
|
```php
|
||||||
|
// Create loader object
|
||||||
|
$loader = new PhpMyAdmin\MoTranslator\Loader();
|
||||||
|
|
||||||
|
// Set locale
|
||||||
|
$loader->setlocale('cs');
|
||||||
|
|
||||||
|
// Set default text domain
|
||||||
|
$loader->textdomain('domain');
|
||||||
|
|
||||||
|
// Set path where to look for a domain
|
||||||
|
$loader->bindtextdomain('domain', __DIR__ . '/data/locale/');
|
||||||
|
|
||||||
|
// Get translator
|
||||||
|
$translator = $loader->getTranslator();
|
||||||
|
|
||||||
|
// Now you can use Translator API (see below)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Low level API usage
|
||||||
|
|
||||||
|
```php
|
||||||
|
// Directly load the mo file
|
||||||
|
// You can use null to not load a file and the use a setter to set the translations
|
||||||
|
$cache = new PhpMyAdmin\MoTranslator\Cache\InMemoryCache(new PhpMyAdmin\MoTranslator\MoParser('./path/to/file.mo'));
|
||||||
|
$translator = new PhpMyAdmin\MoTranslator\Translator($cache);
|
||||||
|
|
||||||
|
// Now you can use Translator API (see below)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Translator API usage
|
||||||
|
|
||||||
|
```php
|
||||||
|
// Translate string
|
||||||
|
echo $translator->gettext('String');
|
||||||
|
|
||||||
|
// Translate plural string
|
||||||
|
echo $translator->ngettext('String', 'Plural string', $count);
|
||||||
|
|
||||||
|
// Translate string with context
|
||||||
|
echo $translator->pgettext('Context', 'String');
|
||||||
|
|
||||||
|
// Translate plural string with context
|
||||||
|
echo $translator->npgettext('Context', 'String', 'Plural string', $count);
|
||||||
|
|
||||||
|
// Get the translations
|
||||||
|
echo $translator->getTranslations();
|
||||||
|
|
||||||
|
// All getters and setters below are more to be used if you are using a manual loading mode
|
||||||
|
// Example: $translator = new PhpMyAdmin\MoTranslator\Translator(null);
|
||||||
|
|
||||||
|
// Set a translation
|
||||||
|
echo $translator->setTranslation('Test', 'Translation for "Test" key');
|
||||||
|
|
||||||
|
// Set translations
|
||||||
|
echo $translator->setTranslations([
|
||||||
|
'Test' => 'Translation for "Test" key',
|
||||||
|
'Test 2' => 'Translation for "Test 2" key',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Use the translation
|
||||||
|
echo $translator->gettext('Test 2'); // -> Translation for "Test 2" key
|
||||||
|
```
|
||||||
|
|
||||||
|
## Gettext compatibility usage
|
||||||
|
|
||||||
|
```php
|
||||||
|
// Load compatibility layer
|
||||||
|
PhpMyAdmin\MoTranslator\Loader::loadFunctions();
|
||||||
|
|
||||||
|
// Configure
|
||||||
|
_setlocale(LC_MESSAGES, 'cs');
|
||||||
|
_textdomain('phpmyadmin');
|
||||||
|
_bindtextdomain('phpmyadmin', __DIR__ . '/data/locale/');
|
||||||
|
_bind_textdomain_codeset('phpmyadmin', 'UTF-8');
|
||||||
|
|
||||||
|
// Use functions
|
||||||
|
echo _gettext('Type');
|
||||||
|
echo __('Type');
|
||||||
|
|
||||||
|
// It also support other Gettext functions
|
||||||
|
_dnpgettext($domain, $msgctxt, $msgid, $msgidPlural, $number);
|
||||||
|
_dngettext($domain, $msgid, $msgidPlural, $number);
|
||||||
|
_npgettext($msgctxt, $msgid, $msgidPlural, $number);
|
||||||
|
_ngettext($msgid, $msgidPlural, $number);
|
||||||
|
_dpgettext($domain, $msgctxt, $msgid);
|
||||||
|
_dgettext($domain, $msgid);
|
||||||
|
_pgettext($msgctxt, $msgid);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Using APCu-backed cache
|
||||||
|
|
||||||
|
If you have the [APCu][5] extension installed you can use it for storing the translation cache. The `.mo` file
|
||||||
|
will then only be loaded once and all processes will share the same cache, reducing memory usage and resulting in
|
||||||
|
performance comparable to the native `gettext` extension.
|
||||||
|
|
||||||
|
If you are using `Loader`, pass it an `ApcuCacheFactory` _before_ getting the translator instance:
|
||||||
|
|
||||||
|
```php
|
||||||
|
PhpMyAdmin\MoTranslator\Loader::setCacheFactory(
|
||||||
|
new PhpMyAdmin\MoTranslator\Cache\AcpuCacheFactory()
|
||||||
|
);
|
||||||
|
$loader = new PhpMyAdmin\MoTranslator\Loader();
|
||||||
|
|
||||||
|
// Proceed as before
|
||||||
|
```
|
||||||
|
|
||||||
|
If you are using the low level API, instantiate the `ApcuCache` directly:
|
||||||
|
|
||||||
|
```php
|
||||||
|
$cache = new PhpMyAdmin\MoTranslator\Cache\ApcuCache(
|
||||||
|
new PhpMyAdmin\MoTranslator\MoParser('./path/to/file.mo'),
|
||||||
|
'de_DE', // the locale
|
||||||
|
'phpmyadmin' // the domain
|
||||||
|
);
|
||||||
|
$translator = new PhpMyAdmin\MoTranslator\Translator($cache);
|
||||||
|
|
||||||
|
// Proceed as before
|
||||||
|
```
|
||||||
|
|
||||||
|
By default, APCu will cache the translations until next server restart and prefix the cache entries with `mo_` to
|
||||||
|
avoid clashes with other cache entries. You can control this behaviour by passing `$ttl` and `$prefix` arguments, either
|
||||||
|
to the `ApcuCacheFactory` or when instantiating `ApcuCache`:
|
||||||
|
|
||||||
|
```php
|
||||||
|
PhpMyAdmin\MoTranslator\Loader::setCacheFactory(
|
||||||
|
new PhpMyAdmin\MoTranslator\Cache\AcpuCacheFactory(
|
||||||
|
3600, // cache for 1 hour
|
||||||
|
true, // reload on cache miss
|
||||||
|
'custom_' // custom prefix for cache entries
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$loader = new PhpMyAdmin\MoTranslator\Loader();
|
||||||
|
|
||||||
|
// or...
|
||||||
|
|
||||||
|
$cache = new PhpMyAdmin\MoTranslator\Cache\ApcuCache(
|
||||||
|
new PhpMyAdmin\MoTranslator\MoParser('./path/to/file.mo'),
|
||||||
|
'de_DE',
|
||||||
|
'phpmyadmin',
|
||||||
|
3600, // cache for 1 hour
|
||||||
|
true, // reload on cache miss
|
||||||
|
'custom_' // custom prefix for cache entries
|
||||||
|
);
|
||||||
|
$translator = new PhpMyAdmin\MoTranslator\Translator($cache);
|
||||||
|
```
|
||||||
|
|
||||||
|
If you receive updated translation files you can load them without restarting the server using the low-level API:
|
||||||
|
|
||||||
|
```php
|
||||||
|
$parser = new PhpMyAdmin\MoTranslator\MoParser('./path/to/file.mo');
|
||||||
|
$cache = new PhpMyAdmin\MoTranslator\Cache\ApcuCache($parser, 'de_DE', 'phpmyadmin');
|
||||||
|
$parser->parseIntoCache($cache);
|
||||||
|
```
|
||||||
|
|
||||||
|
You should ensure APCu has enough memory to store all your translations, along with any other entries you use it
|
||||||
|
for. If an entry is evicted from cache, the `.mo` file will be re-parsed, impacting performance. See the
|
||||||
|
`apc.shm_size` and `apc.shm_segments` [documentation][6] and monitor cache usage when first rolling out.
|
||||||
|
|
||||||
|
If your `.mo` files are missing lots of translations, the first time a missing entry is requested the `.mo` file
|
||||||
|
will be re-parsed. Again, this will impact performance until all the missing entries are hit once. You can turn off this
|
||||||
|
behaviour by setting the `$reloadOnMiss` argument to `false`. If you do this it is _critical_ that APCu has enough
|
||||||
|
memory, or users will see untranslated text when entries are evicted.
|
||||||
|
|
||||||
|
## History
|
||||||
|
|
||||||
|
This library is based on [php-gettext][2]. It adds some performance
|
||||||
|
improvements and ability to install using [Composer][1].
|
||||||
|
|
||||||
|
## Motivation
|
||||||
|
|
||||||
|
Motivation for this library includes:
|
||||||
|
|
||||||
|
* The [php-gettext][2] library is not maintained anymore
|
||||||
|
* It doesn't work with recent PHP version (phpMyAdmin has patched version)
|
||||||
|
* It relies on `eval()` function for plural equations what can have severe security implications, see [CVE-2016-6175][4]
|
||||||
|
* It's not possible to install it using [Composer][1]
|
||||||
|
* There was place for performance improvements in the library
|
||||||
|
|
||||||
|
### Why not to use native gettext in PHP?
|
||||||
|
|
||||||
|
We've tried that, but it's not a viable solution:
|
||||||
|
|
||||||
|
* You can not use locales not known to system, what is something you can not
|
||||||
|
control from web application. This gets even more tricky with minimalist
|
||||||
|
virtualisation containers.
|
||||||
|
* Changing the MO file usually leads to PHP segmentation fault. It (or rather
|
||||||
|
Gettext library) caches headers of MO file and if it's content is changed
|
||||||
|
(for example new version is uploaded to server) it tries to access new data
|
||||||
|
with old references. This is bug known for ages:
|
||||||
|
https://bugs.php.net/bug.php?id=45943
|
||||||
|
|
||||||
|
### Why use Gettext and not JSON, YAML or whatever?
|
||||||
|
|
||||||
|
We want translators to be able to use their favorite tools and we want us to be
|
||||||
|
able to use wide range of tools available with Gettext as well such as
|
||||||
|
[web based translation using Weblate][3]. Using custom format usually adds
|
||||||
|
another barrier for translators and we want to make it easy for them to
|
||||||
|
contribute.
|
||||||
|
|
||||||
|
[1]:https://getcomposer.org/
|
||||||
|
[2]:https://launchpad.net/php-gettext
|
||||||
|
[3]:https://weblate.org/
|
||||||
|
[4]: https://www.cve.org/CVERecord?id=CVE-2016-6175
|
||||||
|
[5]:https://www.php.net/manual/en/book.apcu.php
|
||||||
|
[6]:https://www.php.net/manual/en/apcu.configuration.php
|
||||||
29
vendor/phpmyadmin/motranslator/benchmark-apcu.php
vendored
Normal file
29
vendor/phpmyadmin/motranslator/benchmark-apcu.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
require './vendor/autoload.php';
|
||||||
|
|
||||||
|
$files = [
|
||||||
|
'big' => './tests/data/big.mo',
|
||||||
|
'little' => './tests/data/little.mo',
|
||||||
|
];
|
||||||
|
|
||||||
|
$start = microtime(true);
|
||||||
|
|
||||||
|
for ($i = 0; $i < 2000; ++$i) {
|
||||||
|
foreach ($files as $domain => $filename) {
|
||||||
|
$translator = new PhpMyAdmin\MoTranslator\Translator(
|
||||||
|
new PhpMyAdmin\MoTranslator\Cache\ApcuCache(
|
||||||
|
new PhpMyAdmin\MoTranslator\MoParser($filename), 'foo', $domain
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$translator->gettext('Column');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$end = microtime(true);
|
||||||
|
|
||||||
|
$diff = $end - $start;
|
||||||
|
|
||||||
|
echo 'Execution took ' . $diff . ' seconds' . "\n";
|
||||||
56
vendor/phpmyadmin/motranslator/composer.json
vendored
Normal file
56
vendor/phpmyadmin/motranslator/composer.json
vendored
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
{
|
||||||
|
"name": "phpmyadmin/motranslator",
|
||||||
|
"description": "Translation API for PHP using Gettext MO files",
|
||||||
|
"license": "GPL-2.0-or-later",
|
||||||
|
"keywords": ["gettext", "mo", "translator", "i18n"],
|
||||||
|
"homepage": "https://github.com/phpmyadmin/motranslator",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "The phpMyAdmin Team",
|
||||||
|
"email": "developers@phpmyadmin.net",
|
||||||
|
"homepage": "https://www.phpmyadmin.net/team/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/phpmyadmin/motranslator/issues",
|
||||||
|
"source": "https://github.com/phpmyadmin/motranslator"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"phpcbf": "@php phpcbf",
|
||||||
|
"phpcs": "@php phpcs",
|
||||||
|
"phpstan": "@php phpstan",
|
||||||
|
"phpunit": "@php phpunit",
|
||||||
|
"test": [
|
||||||
|
"@phpcs",
|
||||||
|
"@phpstan",
|
||||||
|
"@phpunit"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^7.1 || ^8.0",
|
||||||
|
"symfony/expression-language": "^4.0 || ^5.0 || ^6.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^7.4 || ^8 || ^9",
|
||||||
|
"phpmyadmin/coding-standard": "^3.0.0",
|
||||||
|
"phpstan/phpstan": "^1.4.6"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"PhpMyAdmin\\MoTranslator\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"PhpMyAdmin\\MoTranslator\\Tests\\": "tests"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"allow-plugins": {
|
||||||
|
"dealerdirect/phpcodesniffer-composer-installer": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"ext-apcu": "Needed for ACPu-backed translation cache"
|
||||||
|
}
|
||||||
|
}
|
||||||
31
vendor/phpmyadmin/motranslator/phpunit.xml.dist
vendored
Normal file
31
vendor/phpmyadmin/motranslator/phpunit.xml.dist
vendored
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<phpunit backupGlobals="false"
|
||||||
|
backupStaticAttributes="false"
|
||||||
|
bootstrap="vendor/autoload.php"
|
||||||
|
beStrictAboutOutputDuringTests="true"
|
||||||
|
colors="true"
|
||||||
|
verbose="true"
|
||||||
|
convertErrorsToExceptions="true"
|
||||||
|
convertNoticesToExceptions="true"
|
||||||
|
convertWarningsToExceptions="true"
|
||||||
|
processIsolation="false"
|
||||||
|
stopOnFailure="false">
|
||||||
|
<logging>
|
||||||
|
<log type="coverage-clover" target="build/logs/clover.xml" />
|
||||||
|
</logging>
|
||||||
|
<testsuites>
|
||||||
|
<testsuite name="Main">
|
||||||
|
<directory suffix=".php">./tests</directory>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
||||||
|
<filter>
|
||||||
|
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||||
|
<directory suffix=".php">src/</directory>
|
||||||
|
</whitelist>
|
||||||
|
</filter>
|
||||||
|
<php>
|
||||||
|
<ini name="display_errors" value="On" />
|
||||||
|
<ini name="display_startup_errors" value="On" />
|
||||||
|
<ini name="error_reporting" value="E_ALL" />
|
||||||
|
</php>
|
||||||
|
</phpunit>
|
||||||
136
vendor/phpmyadmin/motranslator/src/Cache/ApcuCache.php
vendored
Normal file
136
vendor/phpmyadmin/motranslator/src/Cache/ApcuCache.php
vendored
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace PhpMyAdmin\MoTranslator\Cache;
|
||||||
|
|
||||||
|
use PhpMyAdmin\MoTranslator\CacheException;
|
||||||
|
use PhpMyAdmin\MoTranslator\MoParser;
|
||||||
|
|
||||||
|
use function apcu_enabled;
|
||||||
|
use function apcu_entry;
|
||||||
|
use function apcu_exists;
|
||||||
|
use function apcu_fetch;
|
||||||
|
use function apcu_store;
|
||||||
|
use function array_combine;
|
||||||
|
use function array_keys;
|
||||||
|
use function array_map;
|
||||||
|
use function assert;
|
||||||
|
use function function_exists;
|
||||||
|
use function is_array;
|
||||||
|
use function is_string;
|
||||||
|
|
||||||
|
final class ApcuCache implements CacheInterface
|
||||||
|
{
|
||||||
|
public const LOADED_KEY = '__TRANSLATIONS_LOADED__';
|
||||||
|
|
||||||
|
/** @var MoParser */
|
||||||
|
private $parser;
|
||||||
|
/** @var string */
|
||||||
|
private $locale;
|
||||||
|
/** @var string */
|
||||||
|
private $domain;
|
||||||
|
/** @var int */
|
||||||
|
private $ttl;
|
||||||
|
/** @var bool */
|
||||||
|
private $reloadOnMiss;
|
||||||
|
/** @var string */
|
||||||
|
private $prefix;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
MoParser $parser,
|
||||||
|
string $locale,
|
||||||
|
string $domain,
|
||||||
|
int $ttl = 0,
|
||||||
|
bool $reloadOnMiss = true,
|
||||||
|
string $prefix = 'mo_'
|
||||||
|
) {
|
||||||
|
if (! (function_exists('apcu_enabled') && apcu_enabled())) {
|
||||||
|
throw new CacheException('ACPu extension must be installed and enabled');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->parser = $parser;
|
||||||
|
$this->locale = $locale;
|
||||||
|
$this->domain = $domain;
|
||||||
|
$this->ttl = $ttl;
|
||||||
|
$this->reloadOnMiss = $reloadOnMiss;
|
||||||
|
$this->prefix = $prefix;
|
||||||
|
|
||||||
|
$this->ensureTranslationsLoaded();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get(string $msgid): string
|
||||||
|
{
|
||||||
|
$msgstr = apcu_fetch($this->getKey($msgid), $success);
|
||||||
|
if ($success && is_string($msgstr)) {
|
||||||
|
return $msgstr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $this->reloadOnMiss) {
|
||||||
|
return $msgid;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->reloadOnMiss($msgid);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function reloadOnMiss(string $msgid): string
|
||||||
|
{
|
||||||
|
// store original if translation is not present
|
||||||
|
$cached = apcu_entry($this->getKey($msgid), static function () use ($msgid) {
|
||||||
|
return $msgid;
|
||||||
|
}, $this->ttl);
|
||||||
|
// if another process has updated cache, return early
|
||||||
|
if ($cached !== $msgid && is_string($cached)) {
|
||||||
|
return $cached;
|
||||||
|
}
|
||||||
|
|
||||||
|
// reload .mo file, in case entry has been evicted
|
||||||
|
$this->parser->parseIntoCache($this);
|
||||||
|
|
||||||
|
$msgstr = apcu_fetch($this->getKey($msgid), $success);
|
||||||
|
|
||||||
|
return $success && is_string($msgstr) ? $msgstr : $msgid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function set(string $msgid, string $msgstr): void
|
||||||
|
{
|
||||||
|
apcu_store($this->getKey($msgid), $msgstr, $this->ttl);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function has(string $msgid): bool
|
||||||
|
{
|
||||||
|
return apcu_exists($this->getKey($msgid));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setAll(array $translations): void
|
||||||
|
{
|
||||||
|
$keys = array_map(function (string $msgid): string {
|
||||||
|
return $this->getKey($msgid);
|
||||||
|
}, array_keys($translations));
|
||||||
|
$translations = array_combine($keys, $translations);
|
||||||
|
assert(is_array($translations));
|
||||||
|
|
||||||
|
apcu_store($translations, null, $this->ttl);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getKey(string $msgid): string
|
||||||
|
{
|
||||||
|
return $this->prefix . $this->locale . '.' . $this->domain . '.' . $msgid;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function ensureTranslationsLoaded(): void
|
||||||
|
{
|
||||||
|
// Try to prevent cache slam if multiple processes are trying to load translations. There is still a race
|
||||||
|
// between the exists check and creating the entry, but at least it's small
|
||||||
|
$key = $this->getKey(self::LOADED_KEY);
|
||||||
|
$loaded = apcu_exists($key) || apcu_entry($key, static function (): int {
|
||||||
|
return 0;
|
||||||
|
}, $this->ttl);
|
||||||
|
if ($loaded) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->parser->parseIntoCache($this);
|
||||||
|
apcu_store($this->getKey(self::LOADED_KEY), 1, $this->ttl);
|
||||||
|
}
|
||||||
|
}
|
||||||
29
vendor/phpmyadmin/motranslator/src/Cache/ApcuCacheFactory.php
vendored
Normal file
29
vendor/phpmyadmin/motranslator/src/Cache/ApcuCacheFactory.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace PhpMyAdmin\MoTranslator\Cache;
|
||||||
|
|
||||||
|
use PhpMyAdmin\MoTranslator\MoParser;
|
||||||
|
|
||||||
|
final class ApcuCacheFactory implements CacheFactoryInterface
|
||||||
|
{
|
||||||
|
/** @var int */
|
||||||
|
private $ttl;
|
||||||
|
/** @var bool */
|
||||||
|
private $reloadOnMiss;
|
||||||
|
/** @var string */
|
||||||
|
private $prefix;
|
||||||
|
|
||||||
|
public function __construct(int $ttl = 0, bool $reloadOnMiss = true, string $prefix = 'mo_')
|
||||||
|
{
|
||||||
|
$this->ttl = $ttl;
|
||||||
|
$this->reloadOnMiss = $reloadOnMiss;
|
||||||
|
$this->prefix = $prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getInstance(MoParser $parser, string $locale, string $domain): CacheInterface
|
||||||
|
{
|
||||||
|
return new ApcuCache($parser, $locale, $domain, $this->ttl, $this->reloadOnMiss, $this->prefix);
|
||||||
|
}
|
||||||
|
}
|
||||||
12
vendor/phpmyadmin/motranslator/src/Cache/CacheFactoryInterface.php
vendored
Normal file
12
vendor/phpmyadmin/motranslator/src/Cache/CacheFactoryInterface.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace PhpMyAdmin\MoTranslator\Cache;
|
||||||
|
|
||||||
|
use PhpMyAdmin\MoTranslator\MoParser;
|
||||||
|
|
||||||
|
interface CacheFactoryInterface
|
||||||
|
{
|
||||||
|
public function getInstance(MoParser $parser, string $locale, string $domain): CacheInterface;
|
||||||
|
}
|
||||||
33
vendor/phpmyadmin/motranslator/src/Cache/CacheInterface.php
vendored
Normal file
33
vendor/phpmyadmin/motranslator/src/Cache/CacheInterface.php
vendored
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace PhpMyAdmin\MoTranslator\Cache;
|
||||||
|
|
||||||
|
interface CacheInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Returns cached `msgstr` if it is in cache, otherwise `$msgid`
|
||||||
|
*/
|
||||||
|
public function get(string $msgid): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Caches `$msgstr` value for key `$mesid`
|
||||||
|
*/
|
||||||
|
public function set(string $msgid, string $msgstr): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if cache has entry for `$msgid`
|
||||||
|
*/
|
||||||
|
public function has(string $msgid): bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Populates cache with array of `$msgid => $msgstr` entries
|
||||||
|
*
|
||||||
|
* This will overwrite existing values for `$msgid`, but is not guaranteed to clear cache of existing entries
|
||||||
|
* not present in `$translations`.
|
||||||
|
*
|
||||||
|
* @param array<string, string> $translations
|
||||||
|
*/
|
||||||
|
public function setAll(array $translations): void;
|
||||||
|
}
|
||||||
13
vendor/phpmyadmin/motranslator/src/Cache/GetAllInterface.php
vendored
Normal file
13
vendor/phpmyadmin/motranslator/src/Cache/GetAllInterface.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace PhpMyAdmin\MoTranslator\Cache;
|
||||||
|
|
||||||
|
interface GetAllInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
|
public function getAll(): array;
|
||||||
|
}
|
||||||
49
vendor/phpmyadmin/motranslator/src/Cache/InMemoryCache.php
vendored
Normal file
49
vendor/phpmyadmin/motranslator/src/Cache/InMemoryCache.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace PhpMyAdmin\MoTranslator\Cache;
|
||||||
|
|
||||||
|
use PhpMyAdmin\MoTranslator\MoParser;
|
||||||
|
|
||||||
|
use function array_key_exists;
|
||||||
|
|
||||||
|
final class InMemoryCache implements CacheInterface, GetAllInterface
|
||||||
|
{
|
||||||
|
/** @var array<string, string> */
|
||||||
|
private $cache;
|
||||||
|
|
||||||
|
public function __construct(MoParser $parser)
|
||||||
|
{
|
||||||
|
$this->cache = [];
|
||||||
|
$parser->parseIntoCache($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get(string $msgid): string
|
||||||
|
{
|
||||||
|
return array_key_exists($msgid, $this->cache) ? $this->cache[$msgid] : $msgid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function set(string $msgid, string $msgstr): void
|
||||||
|
{
|
||||||
|
$this->cache[$msgid] = $msgstr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function has(string $msgid): bool
|
||||||
|
{
|
||||||
|
return array_key_exists($msgid, $this->cache);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setAll(array $translations): void
|
||||||
|
{
|
||||||
|
$this->cache = $translations;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getAll(): array
|
||||||
|
{
|
||||||
|
return $this->cache;
|
||||||
|
}
|
||||||
|
}
|
||||||
11
vendor/phpmyadmin/motranslator/src/CacheException.php
vendored
Normal file
11
vendor/phpmyadmin/motranslator/src/CacheException.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace PhpMyAdmin\MoTranslator;
|
||||||
|
|
||||||
|
use DomainException;
|
||||||
|
|
||||||
|
final class CacheException extends DomainException
|
||||||
|
{
|
||||||
|
}
|
||||||
318
vendor/phpmyadmin/motranslator/src/Loader.php
vendored
Normal file
318
vendor/phpmyadmin/motranslator/src/Loader.php
vendored
Normal file
@@ -0,0 +1,318 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright (c) 2005 Steven Armstrong <sa at c-area dot ch>
|
||||||
|
Copyright (c) 2009 Danilo Segan <danilo@kvota.net>
|
||||||
|
Copyright (c) 2016 Michal Čihař <michal@cihar.com>
|
||||||
|
|
||||||
|
This file is part of MoTranslator.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace PhpMyAdmin\MoTranslator;
|
||||||
|
|
||||||
|
use PhpMyAdmin\MoTranslator\Cache\CacheFactoryInterface;
|
||||||
|
use PhpMyAdmin\MoTranslator\Cache\InMemoryCache;
|
||||||
|
|
||||||
|
use function array_push;
|
||||||
|
use function file_exists;
|
||||||
|
use function getenv;
|
||||||
|
use function in_array;
|
||||||
|
use function preg_match;
|
||||||
|
use function sprintf;
|
||||||
|
|
||||||
|
class Loader
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Loader instance.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
* @var Loader
|
||||||
|
*/
|
||||||
|
private static $instance = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Factory to return a factory responsible for returning a `CacheInterface`
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
* @var CacheFactoryInterface|null
|
||||||
|
*/
|
||||||
|
private static $cacheFactory = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default gettext domain to use.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $defaultDomain = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configured locale.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $locale = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loaded domains.
|
||||||
|
*
|
||||||
|
* @var array<string,array<string,Translator>>
|
||||||
|
*/
|
||||||
|
private $domains = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bound paths for domains.
|
||||||
|
*
|
||||||
|
* @var array<string,string>
|
||||||
|
*/
|
||||||
|
private $paths = ['' => './'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the singleton Loader object.
|
||||||
|
*
|
||||||
|
* @return Loader object
|
||||||
|
*/
|
||||||
|
public static function getInstance(): Loader
|
||||||
|
{
|
||||||
|
if (self::$instance === null) {
|
||||||
|
self::$instance = new self();
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads global localization functions.
|
||||||
|
*/
|
||||||
|
public static function loadFunctions(): void
|
||||||
|
{
|
||||||
|
require_once __DIR__ . '/functions.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Figure out all possible locale names and start with the most
|
||||||
|
* specific ones. I.e. for sr_CS.UTF-8@latin, look through all of
|
||||||
|
* sr_CS.UTF-8@latin, sr_CS@latin, sr@latin, sr_CS.UTF-8, sr_CS, sr.
|
||||||
|
*
|
||||||
|
* @param string $locale Locale code
|
||||||
|
*
|
||||||
|
* @return string[] list of locales to try for any POSIX-style locale specification
|
||||||
|
*/
|
||||||
|
public static function listLocales(string $locale): array
|
||||||
|
{
|
||||||
|
$localeNames = [];
|
||||||
|
|
||||||
|
if ($locale) {
|
||||||
|
if (
|
||||||
|
preg_match(
|
||||||
|
'/^(?P<lang>[a-z]{2,3})' // language code
|
||||||
|
. '(?:_(?P<country>[A-Z]{2}))?' // country code
|
||||||
|
. '(?:\\.(?P<charset>[-A-Za-z0-9_]+))?' // charset
|
||||||
|
. '(?:@(?P<modifier>[-A-Za-z0-9_]+))?$/', // @ modifier
|
||||||
|
$locale,
|
||||||
|
$matches
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
$lang = $matches['lang'] ?? null;
|
||||||
|
$country = $matches['country'] ?? null;
|
||||||
|
$charset = $matches['charset'] ?? null;
|
||||||
|
$modifier = $matches['modifier'] ?? null;
|
||||||
|
|
||||||
|
if ($modifier) {
|
||||||
|
if ($country) {
|
||||||
|
if ($charset) {
|
||||||
|
array_push(
|
||||||
|
$localeNames,
|
||||||
|
sprintf('%s_%s.%s@%s', $lang, $country, $charset, $modifier)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
array_push(
|
||||||
|
$localeNames,
|
||||||
|
sprintf('%s_%s@%s', $lang, $country, $modifier)
|
||||||
|
);
|
||||||
|
} elseif ($charset) {
|
||||||
|
array_push(
|
||||||
|
$localeNames,
|
||||||
|
sprintf('%s.%s@%s', $lang, $charset, $modifier)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
array_push(
|
||||||
|
$localeNames,
|
||||||
|
sprintf('%s@%s', $lang, $modifier)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($country) {
|
||||||
|
if ($charset) {
|
||||||
|
array_push(
|
||||||
|
$localeNames,
|
||||||
|
sprintf('%s_%s.%s', $lang, $country, $charset)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
array_push(
|
||||||
|
$localeNames,
|
||||||
|
sprintf('%s_%s', $lang, $country)
|
||||||
|
);
|
||||||
|
} elseif ($charset) {
|
||||||
|
array_push(
|
||||||
|
$localeNames,
|
||||||
|
sprintf('%s.%s', $lang, $charset)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
array_push($localeNames, $lang);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the locale name doesn't match POSIX style, just include it as-is.
|
||||||
|
if (! in_array($locale, $localeNames)) {
|
||||||
|
array_push($localeNames, $locale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $localeNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets factory responsible for composing a `CacheInterface`
|
||||||
|
*/
|
||||||
|
public static function setCacheFactory(?CacheFactoryInterface $cacheFactory): void
|
||||||
|
{
|
||||||
|
self::$cacheFactory = $cacheFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns Translator object for domain or for default domain.
|
||||||
|
*
|
||||||
|
* @param string $domain Translation domain
|
||||||
|
*/
|
||||||
|
public function getTranslator(string $domain = ''): Translator
|
||||||
|
{
|
||||||
|
if (empty($domain)) {
|
||||||
|
$domain = $this->defaultDomain;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! isset($this->domains[$this->locale])) {
|
||||||
|
$this->domains[$this->locale] = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! isset($this->domains[$this->locale][$domain])) {
|
||||||
|
if (isset($this->paths[$domain])) {
|
||||||
|
$base = $this->paths[$domain];
|
||||||
|
} else {
|
||||||
|
$base = './';
|
||||||
|
}
|
||||||
|
|
||||||
|
$localeNames = $this->listLocales($this->locale);
|
||||||
|
|
||||||
|
$filename = '';
|
||||||
|
foreach ($localeNames as $locale) {
|
||||||
|
$filename = $base . '/' . $locale . '/LC_MESSAGES/' . $domain . '.mo';
|
||||||
|
if (file_exists($filename)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// We don't care about invalid path, we will get fallback
|
||||||
|
// translator here
|
||||||
|
$moParser = new MoParser($filename);
|
||||||
|
if (self::$cacheFactory instanceof CacheFactoryInterface) {
|
||||||
|
$cache = self::$cacheFactory->getInstance($moParser, $this->locale, $domain);
|
||||||
|
} else {
|
||||||
|
$cache = new InMemoryCache($moParser);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->domains[$this->locale][$domain] = new Translator($cache);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->domains[$this->locale][$domain];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the path for a domain.
|
||||||
|
*
|
||||||
|
* @param string $domain Domain name
|
||||||
|
* @param string $path Path where to find locales
|
||||||
|
*/
|
||||||
|
public function bindtextdomain(string $domain, string $path): void
|
||||||
|
{
|
||||||
|
$this->paths[$domain] = $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the default domain.
|
||||||
|
*
|
||||||
|
* @param string $domain Domain name
|
||||||
|
*/
|
||||||
|
public function textdomain(string $domain): void
|
||||||
|
{
|
||||||
|
$this->defaultDomain = $domain;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a requested locale.
|
||||||
|
*
|
||||||
|
* @param string $locale Locale name
|
||||||
|
*
|
||||||
|
* @return string Set or current locale
|
||||||
|
*/
|
||||||
|
public function setlocale(string $locale): string
|
||||||
|
{
|
||||||
|
if (! empty($locale)) {
|
||||||
|
$this->locale = $locale;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->locale;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detects currently configured locale.
|
||||||
|
*
|
||||||
|
* It checks:
|
||||||
|
*
|
||||||
|
* - global lang variable
|
||||||
|
* - environment for LC_ALL, LC_MESSAGES and LANG
|
||||||
|
*
|
||||||
|
* @return string with locale name
|
||||||
|
*/
|
||||||
|
public function detectlocale(): string
|
||||||
|
{
|
||||||
|
if (isset($GLOBALS['lang'])) {
|
||||||
|
return $GLOBALS['lang'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$locale = getenv('LC_ALL');
|
||||||
|
if ($locale !== false) {
|
||||||
|
return $locale;
|
||||||
|
}
|
||||||
|
|
||||||
|
$locale = getenv('LC_MESSAGES');
|
||||||
|
if ($locale !== false) {
|
||||||
|
return $locale;
|
||||||
|
}
|
||||||
|
|
||||||
|
$locale = getenv('LANG');
|
||||||
|
if ($locale !== false) {
|
||||||
|
return $locale;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'en';
|
||||||
|
}
|
||||||
|
}
|
||||||
109
vendor/phpmyadmin/motranslator/src/MoParser.php
vendored
Normal file
109
vendor/phpmyadmin/motranslator/src/MoParser.php
vendored
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace PhpMyAdmin\MoTranslator;
|
||||||
|
|
||||||
|
use PhpMyAdmin\MoTranslator\Cache\CacheInterface;
|
||||||
|
|
||||||
|
use function is_readable;
|
||||||
|
use function strcmp;
|
||||||
|
|
||||||
|
final class MoParser
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* None error.
|
||||||
|
*/
|
||||||
|
public const ERROR_NONE = 0;
|
||||||
|
/**
|
||||||
|
* File does not exist.
|
||||||
|
*/
|
||||||
|
public const ERROR_DOES_NOT_EXIST = 1;
|
||||||
|
/**
|
||||||
|
* File has bad magic number.
|
||||||
|
*/
|
||||||
|
public const ERROR_BAD_MAGIC = 2;
|
||||||
|
/**
|
||||||
|
* Error while reading file, probably too short.
|
||||||
|
*/
|
||||||
|
public const ERROR_READING = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Big endian mo file magic bytes.
|
||||||
|
*/
|
||||||
|
public const MAGIC_BE = "\x95\x04\x12\xde";
|
||||||
|
/**
|
||||||
|
* Little endian mo file magic bytes.
|
||||||
|
*/
|
||||||
|
public const MAGIC_LE = "\xde\x12\x04\x95";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse error code (0 if no error).
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $error = self::ERROR_NONE;
|
||||||
|
|
||||||
|
/** @var string|null */
|
||||||
|
private $filename;
|
||||||
|
|
||||||
|
public function __construct(?string $filename)
|
||||||
|
{
|
||||||
|
$this->filename = $filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses .mo file and stores results to `$cache`
|
||||||
|
*/
|
||||||
|
public function parseIntoCache(CacheInterface $cache): void
|
||||||
|
{
|
||||||
|
if ($this->filename === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! is_readable($this->filename)) {
|
||||||
|
$this->error = self::ERROR_DOES_NOT_EXIST;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$stream = new StringReader($this->filename);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$magic = $stream->read(0, 4);
|
||||||
|
if (strcmp($magic, self::MAGIC_LE) === 0) {
|
||||||
|
$unpack = 'V';
|
||||||
|
} elseif (strcmp($magic, self::MAGIC_BE) === 0) {
|
||||||
|
$unpack = 'N';
|
||||||
|
} else {
|
||||||
|
$this->error = self::ERROR_BAD_MAGIC;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Parse header */
|
||||||
|
$total = $stream->readint($unpack, 8);
|
||||||
|
$originals = $stream->readint($unpack, 12);
|
||||||
|
$translations = $stream->readint($unpack, 16);
|
||||||
|
|
||||||
|
/* get original and translations tables */
|
||||||
|
$totalTimesTwo = (int) ($total * 2);// Fix for issue #36 on ARM
|
||||||
|
$tableOriginals = $stream->readintarray($unpack, $originals, $totalTimesTwo);
|
||||||
|
$tableTranslations = $stream->readintarray($unpack, $translations, $totalTimesTwo);
|
||||||
|
|
||||||
|
/* read all strings to the cache */
|
||||||
|
for ($i = 0; $i < $total; ++$i) {
|
||||||
|
$iTimesTwo = $i * 2;
|
||||||
|
$iPlusOne = $iTimesTwo + 1;
|
||||||
|
$iPlusTwo = $iTimesTwo + 2;
|
||||||
|
$original = $stream->read($tableOriginals[$iPlusTwo], $tableOriginals[$iPlusOne]);
|
||||||
|
$translation = $stream->read($tableTranslations[$iPlusTwo], $tableTranslations[$iPlusOne]);
|
||||||
|
$cache->set($original, $translation);
|
||||||
|
}
|
||||||
|
} catch (ReaderException $e) {
|
||||||
|
$this->error = self::ERROR_READING;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
35
vendor/phpmyadmin/motranslator/src/ReaderException.php
vendored
Normal file
35
vendor/phpmyadmin/motranslator/src/ReaderException.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003, 2005, 2006, 2009 Danilo Segan <danilo@kvota.net>.
|
||||||
|
Copyright (c) 2016 Michal Čihař <michal@cihar.com>
|
||||||
|
|
||||||
|
This file is part of MoTranslator.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace PhpMyAdmin\MoTranslator;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exception thrown when file can not be read.
|
||||||
|
*/
|
||||||
|
class ReaderException extends Exception
|
||||||
|
{
|
||||||
|
}
|
||||||
116
vendor/phpmyadmin/motranslator/src/StringReader.php
vendored
Normal file
116
vendor/phpmyadmin/motranslator/src/StringReader.php
vendored
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003, 2005, 2006, 2009 Danilo Segan <danilo@kvota.net>.
|
||||||
|
Copyright (c) 2016 Michal Čihař <michal@cihar.com>
|
||||||
|
|
||||||
|
This file is part of MoTranslator.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace PhpMyAdmin\MoTranslator;
|
||||||
|
|
||||||
|
use function file_get_contents;
|
||||||
|
use function strlen;
|
||||||
|
use function substr;
|
||||||
|
use function unpack;
|
||||||
|
|
||||||
|
use const PHP_INT_MAX;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple wrapper around string buffer for
|
||||||
|
* random access and values parsing.
|
||||||
|
*/
|
||||||
|
class StringReader
|
||||||
|
{
|
||||||
|
/** @var string */
|
||||||
|
private $string;
|
||||||
|
/** @var int */
|
||||||
|
private $length;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $filename Name of file to load
|
||||||
|
*/
|
||||||
|
public function __construct(string $filename)
|
||||||
|
{
|
||||||
|
$this->string = (string) file_get_contents($filename);
|
||||||
|
$this->length = strlen($this->string);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read number of bytes from given offset.
|
||||||
|
*
|
||||||
|
* @param int $pos Offset
|
||||||
|
* @param int $bytes Number of bytes to read
|
||||||
|
*/
|
||||||
|
public function read(int $pos, int $bytes): string
|
||||||
|
{
|
||||||
|
if ($pos + $bytes > $this->length) {
|
||||||
|
throw new ReaderException('Not enough bytes!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = substr($this->string, $pos, $bytes);
|
||||||
|
|
||||||
|
return $data === false ? '' : $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads a 32bit integer from the stream.
|
||||||
|
*
|
||||||
|
* @param string $unpack Unpack string
|
||||||
|
* @param int $pos Position
|
||||||
|
*
|
||||||
|
* @return int Integer from the stream
|
||||||
|
*/
|
||||||
|
public function readint(string $unpack, int $pos): int
|
||||||
|
{
|
||||||
|
$data = unpack($unpack, $this->read($pos, 4));
|
||||||
|
if ($data === false) {
|
||||||
|
return PHP_INT_MAX;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $data[1];
|
||||||
|
|
||||||
|
/* We're reading unsigned int, but PHP will happily
|
||||||
|
* give us negative number on 32-bit platforms.
|
||||||
|
*
|
||||||
|
* See also documentation:
|
||||||
|
* https://secure.php.net/manual/en/function.unpack.php#refsect1-function.unpack-notes
|
||||||
|
*/
|
||||||
|
return $result < 0 ? PHP_INT_MAX : $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads an array of integers from the stream.
|
||||||
|
*
|
||||||
|
* @param string $unpack Unpack string
|
||||||
|
* @param int $pos Position
|
||||||
|
* @param int $count How many elements should be read
|
||||||
|
*
|
||||||
|
* @return int[] Array of Integers
|
||||||
|
*/
|
||||||
|
public function readintarray(string $unpack, int $pos, int $count): array
|
||||||
|
{
|
||||||
|
$data = unpack($unpack . $count, $this->read($pos, 4 * $count));
|
||||||
|
if ($data === false) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
388
vendor/phpmyadmin/motranslator/src/Translator.php
vendored
Normal file
388
vendor/phpmyadmin/motranslator/src/Translator.php
vendored
Normal file
@@ -0,0 +1,388 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003, 2009 Danilo Segan <danilo@kvota.net>.
|
||||||
|
Copyright (c) 2005 Nico Kaiser <nico@siriux.net>
|
||||||
|
Copyright (c) 2016 Michal Čihař <michal@cihar.com>
|
||||||
|
|
||||||
|
This file is part of MoTranslator.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace PhpMyAdmin\MoTranslator;
|
||||||
|
|
||||||
|
use PhpMyAdmin\MoTranslator\Cache\CacheInterface;
|
||||||
|
use PhpMyAdmin\MoTranslator\Cache\GetAllInterface;
|
||||||
|
use PhpMyAdmin\MoTranslator\Cache\InMemoryCache;
|
||||||
|
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
use function chr;
|
||||||
|
use function count;
|
||||||
|
use function explode;
|
||||||
|
use function get_class;
|
||||||
|
use function implode;
|
||||||
|
use function intval;
|
||||||
|
use function ltrim;
|
||||||
|
use function preg_replace;
|
||||||
|
use function rtrim;
|
||||||
|
use function sprintf;
|
||||||
|
use function stripos;
|
||||||
|
use function strpos;
|
||||||
|
use function strtolower;
|
||||||
|
use function substr;
|
||||||
|
use function trim;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides a simple gettext replacement that works independently from
|
||||||
|
* the system's gettext abilities.
|
||||||
|
* It can read MO files and use them for translating strings.
|
||||||
|
*
|
||||||
|
* It caches ll strings and translations to speed up the string lookup.
|
||||||
|
*/
|
||||||
|
class Translator
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* None error.
|
||||||
|
*/
|
||||||
|
public const ERROR_NONE = 0;
|
||||||
|
/**
|
||||||
|
* File does not exist.
|
||||||
|
*/
|
||||||
|
public const ERROR_DOES_NOT_EXIST = 1;
|
||||||
|
/**
|
||||||
|
* File has bad magic number.
|
||||||
|
*/
|
||||||
|
public const ERROR_BAD_MAGIC = 2;
|
||||||
|
/**
|
||||||
|
* Error while reading file, probably too short.
|
||||||
|
*/
|
||||||
|
public const ERROR_READING = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Big endian mo file magic bytes.
|
||||||
|
*/
|
||||||
|
public const MAGIC_BE = "\x95\x04\x12\xde";
|
||||||
|
/**
|
||||||
|
* Little endian mo file magic bytes.
|
||||||
|
*/
|
||||||
|
public const MAGIC_LE = "\xde\x12\x04\x95";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse error code (0 if no error).
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $error = self::ERROR_NONE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache header field for plural forms.
|
||||||
|
*
|
||||||
|
* @var string|null
|
||||||
|
*/
|
||||||
|
private $pluralEquation = null;
|
||||||
|
|
||||||
|
/** @var ExpressionLanguage|null Evaluator for plurals */
|
||||||
|
private $pluralExpression = null;
|
||||||
|
|
||||||
|
/** @var int|null number of plurals */
|
||||||
|
private $pluralCount = null;
|
||||||
|
|
||||||
|
/** @var CacheInterface */
|
||||||
|
private $cache;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param CacheInterface|string|null $cache Mo file to load (null for no file) or a CacheInterface implementation
|
||||||
|
*/
|
||||||
|
public function __construct($cache)
|
||||||
|
{
|
||||||
|
if (! $cache instanceof CacheInterface) {
|
||||||
|
$cache = new InMemoryCache(new MoParser($cache));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->cache = $cache;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translates a string.
|
||||||
|
*
|
||||||
|
* @param string $msgid String to be translated
|
||||||
|
*
|
||||||
|
* @return string translated string (or original, if not found)
|
||||||
|
*/
|
||||||
|
public function gettext(string $msgid): string
|
||||||
|
{
|
||||||
|
return $this->cache->get($msgid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a string is translated.
|
||||||
|
*
|
||||||
|
* @param string $msgid String to be checked
|
||||||
|
*/
|
||||||
|
public function exists(string $msgid): bool
|
||||||
|
{
|
||||||
|
return $this->cache->has($msgid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sanitize plural form expression for use in ExpressionLanguage.
|
||||||
|
*
|
||||||
|
* @param string $expr Expression to sanitize
|
||||||
|
*
|
||||||
|
* @return string sanitized plural form expression
|
||||||
|
*/
|
||||||
|
public static function sanitizePluralExpression(string $expr): string
|
||||||
|
{
|
||||||
|
// Parse equation
|
||||||
|
$expr = explode(';', $expr);
|
||||||
|
if (count($expr) >= 2) {
|
||||||
|
$expr = $expr[1];
|
||||||
|
} else {
|
||||||
|
$expr = $expr[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
$expr = trim(strtolower($expr));
|
||||||
|
// Strip plural prefix
|
||||||
|
if (substr($expr, 0, 6) === 'plural') {
|
||||||
|
$expr = ltrim(substr($expr, 6));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Strip equals
|
||||||
|
if (substr($expr, 0, 1) === '=') {
|
||||||
|
$expr = ltrim(substr($expr, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cleanup from unwanted chars
|
||||||
|
$expr = preg_replace('@[^n0-9:\(\)\?=!<>/%&| ]@', '', $expr);
|
||||||
|
|
||||||
|
return (string) $expr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extracts number of plurals from plurals form expression.
|
||||||
|
*
|
||||||
|
* @param string $expr Expression to process
|
||||||
|
*
|
||||||
|
* @return int Total number of plurals
|
||||||
|
*/
|
||||||
|
public static function extractPluralCount(string $expr): int
|
||||||
|
{
|
||||||
|
$parts = explode(';', $expr, 2);
|
||||||
|
$nplurals = explode('=', trim($parts[0]), 2);
|
||||||
|
if (strtolower(rtrim($nplurals[0])) !== 'nplurals') {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($nplurals) === 1) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return intval($nplurals[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse full PO header and extract only plural forms line.
|
||||||
|
*
|
||||||
|
* @param string $header Gettext header
|
||||||
|
*
|
||||||
|
* @return string verbatim plural form header field
|
||||||
|
*/
|
||||||
|
public static function extractPluralsForms(string $header): string
|
||||||
|
{
|
||||||
|
$headers = explode("\n", $header);
|
||||||
|
$expr = 'nplurals=2; plural=n == 1 ? 0 : 1;';
|
||||||
|
foreach ($headers as $header) {
|
||||||
|
if (stripos($header, 'Plural-Forms:') !== 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$expr = substr($header, 13);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $expr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get possible plural forms from MO header.
|
||||||
|
*
|
||||||
|
* @return string plural form header
|
||||||
|
*/
|
||||||
|
private function getPluralForms(): string
|
||||||
|
{
|
||||||
|
// lets assume message number 0 is header
|
||||||
|
// this is true, right?
|
||||||
|
|
||||||
|
// cache header field for plural forms
|
||||||
|
if ($this->pluralEquation === null) {
|
||||||
|
$header = $this->cache->get('');
|
||||||
|
|
||||||
|
$expr = $this->extractPluralsForms($header);
|
||||||
|
$this->pluralEquation = $this->sanitizePluralExpression($expr);
|
||||||
|
$this->pluralCount = $this->extractPluralCount($expr);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->pluralEquation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detects which plural form to take.
|
||||||
|
*
|
||||||
|
* @param int $n count of objects
|
||||||
|
*
|
||||||
|
* @return int array index of the right plural form
|
||||||
|
*/
|
||||||
|
private function selectString(int $n): int
|
||||||
|
{
|
||||||
|
if ($this->pluralExpression === null) {
|
||||||
|
$this->pluralExpression = new ExpressionLanguage();
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$plural = (int) $this->pluralExpression->evaluate(
|
||||||
|
$this->getPluralForms(),
|
||||||
|
['n' => $n]
|
||||||
|
);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
$plural = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($plural >= $this->pluralCount) {
|
||||||
|
$plural = $this->pluralCount - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $plural;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plural version of gettext.
|
||||||
|
*
|
||||||
|
* @param string $msgid Single form
|
||||||
|
* @param string $msgidPlural Plural form
|
||||||
|
* @param int $number Number of objects
|
||||||
|
*
|
||||||
|
* @return string translated plural form
|
||||||
|
*/
|
||||||
|
public function ngettext(string $msgid, string $msgidPlural, int $number): string
|
||||||
|
{
|
||||||
|
// this should contains all strings separated by NULLs
|
||||||
|
$key = implode(chr(0), [$msgid, $msgidPlural]);
|
||||||
|
if (! $this->cache->has($key)) {
|
||||||
|
return $number !== 1 ? $msgidPlural : $msgid;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->cache->get($key);
|
||||||
|
|
||||||
|
// find out the appropriate form
|
||||||
|
$select = $this->selectString($number);
|
||||||
|
|
||||||
|
$list = explode(chr(0), $result);
|
||||||
|
// @codeCoverageIgnoreStart
|
||||||
|
if ($list === false) {
|
||||||
|
// This was added in 3ff2c63bcf85f81b3a205ce7222de11b33e2bf56 for phpstan
|
||||||
|
// But according to the php manual it should never happen
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// @codeCoverageIgnoreEnd
|
||||||
|
|
||||||
|
if (! isset($list[$select])) {
|
||||||
|
return $list[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $list[$select];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translate with context.
|
||||||
|
*
|
||||||
|
* @param string $msgctxt Context
|
||||||
|
* @param string $msgid String to be translated
|
||||||
|
*
|
||||||
|
* @return string translated plural form
|
||||||
|
*/
|
||||||
|
public function pgettext(string $msgctxt, string $msgid): string
|
||||||
|
{
|
||||||
|
$key = implode(chr(4), [$msgctxt, $msgid]);
|
||||||
|
$ret = $this->gettext($key);
|
||||||
|
if (strpos($ret, chr(4)) !== false) {
|
||||||
|
return $msgid;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plural version of pgettext.
|
||||||
|
*
|
||||||
|
* @param string $msgctxt Context
|
||||||
|
* @param string $msgid Single form
|
||||||
|
* @param string $msgidPlural Plural form
|
||||||
|
* @param int $number Number of objects
|
||||||
|
*
|
||||||
|
* @return string translated plural form
|
||||||
|
*/
|
||||||
|
public function npgettext(string $msgctxt, string $msgid, string $msgidPlural, int $number): string
|
||||||
|
{
|
||||||
|
$key = implode(chr(4), [$msgctxt, $msgid]);
|
||||||
|
$ret = $this->ngettext($key, $msgidPlural, $number);
|
||||||
|
if (strpos($ret, chr(4)) !== false) {
|
||||||
|
return $msgid;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set translation in place
|
||||||
|
*
|
||||||
|
* @param string $msgid String to be set
|
||||||
|
* @param string $msgstr Translation
|
||||||
|
*/
|
||||||
|
public function setTranslation(string $msgid, string $msgstr): void
|
||||||
|
{
|
||||||
|
$this->cache->set($msgid, $msgstr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the translations
|
||||||
|
*
|
||||||
|
* @param array<string,string> $translations The translations "key => value" array
|
||||||
|
*/
|
||||||
|
public function setTranslations(array $translations): void
|
||||||
|
{
|
||||||
|
$this->cache->setAll($translations);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the translations
|
||||||
|
*
|
||||||
|
* @return array<string,string> The translations "key => value" array
|
||||||
|
*/
|
||||||
|
public function getTranslations(): array
|
||||||
|
{
|
||||||
|
if ($this->cache instanceof GetAllInterface) {
|
||||||
|
return $this->cache->getAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new CacheException(sprintf(
|
||||||
|
"Cache '%s' does not support getting translations",
|
||||||
|
get_class($this->cache)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
226
vendor/phpmyadmin/motranslator/src/functions.php
vendored
Normal file
226
vendor/phpmyadmin/motranslator/src/functions.php
vendored
Normal file
@@ -0,0 +1,226 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright (c) 2005 Steven Armstrong <sa at c-area dot ch>
|
||||||
|
Copyright (c) 2009 Danilo Segan <danilo@kvota.net>
|
||||||
|
Copyright (c) 2016 Michal Čihař <michal@cihar.com>
|
||||||
|
|
||||||
|
This file is part of MoTranslator.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use PhpMyAdmin\MoTranslator\Loader;
|
||||||
|
|
||||||
|
if (! function_exists('_setlocale')) {
|
||||||
|
/**
|
||||||
|
* Sets a requested locale.
|
||||||
|
*
|
||||||
|
* @param int $category Locale category, ignored
|
||||||
|
* @param string $locale Locale name
|
||||||
|
*
|
||||||
|
* @return string Set or current locale
|
||||||
|
*/
|
||||||
|
function _setlocale(int $category, string $locale): string
|
||||||
|
{
|
||||||
|
return Loader::getInstance()->setlocale($locale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! function_exists('_bindtextdomain')) {
|
||||||
|
/**
|
||||||
|
* Sets the path for a domain.
|
||||||
|
*
|
||||||
|
* @param string $domain Domain name
|
||||||
|
* @param string $path Path where to find locales
|
||||||
|
*/
|
||||||
|
function _bindtextdomain(string $domain, string $path): void
|
||||||
|
{
|
||||||
|
Loader::getInstance()->bindtextdomain($domain, $path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! function_exists('_bind_textdomain_codeset')) {
|
||||||
|
/**
|
||||||
|
* Dummy compatibility function, MoTranslator assumes
|
||||||
|
* everything is using same character set on input and
|
||||||
|
* output.
|
||||||
|
*
|
||||||
|
* Generally it is wise to output in UTF-8 and have
|
||||||
|
* mo files in UTF-8.
|
||||||
|
*
|
||||||
|
* @param string $domain Domain where to set character set
|
||||||
|
* @param string $codeset Character set to set
|
||||||
|
*/
|
||||||
|
function _bind_textdomain_codeset($domain, $codeset): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! function_exists('_textdomain')) {
|
||||||
|
/**
|
||||||
|
* Sets the default domain.
|
||||||
|
*
|
||||||
|
* @param string $domain Domain name
|
||||||
|
*/
|
||||||
|
function _textdomain(string $domain): void
|
||||||
|
{
|
||||||
|
Loader::getInstance()->textdomain($domain);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! function_exists('_gettext')) {
|
||||||
|
/**
|
||||||
|
* Translates a string.
|
||||||
|
*
|
||||||
|
* @param string $msgid String to be translated
|
||||||
|
*
|
||||||
|
* @return string translated string (or original, if not found)
|
||||||
|
*/
|
||||||
|
function _gettext(string $msgid): string
|
||||||
|
{
|
||||||
|
return Loader::getInstance()->getTranslator()->gettext($msgid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! function_exists('__')) {
|
||||||
|
/**
|
||||||
|
* Translates a string, alias for _gettext.
|
||||||
|
*
|
||||||
|
* @param string $msgid String to be translated
|
||||||
|
*
|
||||||
|
* @return string translated string (or original, if not found)
|
||||||
|
*/
|
||||||
|
function __(string $msgid): string
|
||||||
|
{
|
||||||
|
return Loader::getInstance()->getTranslator()->gettext($msgid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! function_exists('_ngettext')) {
|
||||||
|
/**
|
||||||
|
* Plural version of gettext.
|
||||||
|
*
|
||||||
|
* @param string $msgid Single form
|
||||||
|
* @param string $msgidPlural Plural form
|
||||||
|
* @param int $number Number of objects
|
||||||
|
*
|
||||||
|
* @return string translated plural form
|
||||||
|
*/
|
||||||
|
function _ngettext(string $msgid, string $msgidPlural, int $number): string
|
||||||
|
{
|
||||||
|
return Loader::getInstance()->getTranslator()->ngettext($msgid, $msgidPlural, $number);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! function_exists('_pgettext')) {
|
||||||
|
/**
|
||||||
|
* Translate with context.
|
||||||
|
*
|
||||||
|
* @param string $msgctxt Context
|
||||||
|
* @param string $msgid String to be translated
|
||||||
|
*
|
||||||
|
* @return string translated plural form
|
||||||
|
*/
|
||||||
|
function _pgettext(string $msgctxt, string $msgid): string
|
||||||
|
{
|
||||||
|
return Loader::getInstance()->getTranslator()->pgettext($msgctxt, $msgid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! function_exists('_npgettext')) {
|
||||||
|
/**
|
||||||
|
* Plural version of pgettext.
|
||||||
|
*
|
||||||
|
* @param string $msgctxt Context
|
||||||
|
* @param string $msgid Single form
|
||||||
|
* @param string $msgidPlural Plural form
|
||||||
|
* @param int $number Number of objects
|
||||||
|
*
|
||||||
|
* @return string translated plural form
|
||||||
|
*/
|
||||||
|
function _npgettext(string $msgctxt, string $msgid, string $msgidPlural, int $number): string
|
||||||
|
{
|
||||||
|
return Loader::getInstance()->getTranslator()->npgettext($msgctxt, $msgid, $msgidPlural, $number);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! function_exists('_dgettext')) {
|
||||||
|
/**
|
||||||
|
* Translates a string.
|
||||||
|
*
|
||||||
|
* @param string $domain Domain to use
|
||||||
|
* @param string $msgid String to be translated
|
||||||
|
*
|
||||||
|
* @return string translated string (or original, if not found)
|
||||||
|
*/
|
||||||
|
function _dgettext(string $domain, string $msgid): string
|
||||||
|
{
|
||||||
|
return Loader::getInstance()->getTranslator($domain)->gettext($msgid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! function_exists('_dngettext')) {
|
||||||
|
/**
|
||||||
|
* Plural version of gettext.
|
||||||
|
*
|
||||||
|
* @param string $domain Domain to use
|
||||||
|
* @param string $msgid Single form
|
||||||
|
* @param string $msgidPlural Plural form
|
||||||
|
* @param int $number Number of objects
|
||||||
|
*
|
||||||
|
* @return string translated plural form
|
||||||
|
*/
|
||||||
|
function _dngettext(string $domain, string $msgid, string $msgidPlural, int $number): string
|
||||||
|
{
|
||||||
|
return Loader::getInstance()->getTranslator($domain)->ngettext($msgid, $msgidPlural, $number);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! function_exists('_dpgettext')) {
|
||||||
|
/**
|
||||||
|
* Translate with context.
|
||||||
|
*
|
||||||
|
* @param string $domain Domain to use
|
||||||
|
* @param string $msgctxt Context
|
||||||
|
* @param string $msgid String to be translated
|
||||||
|
*
|
||||||
|
* @return string translated plural form
|
||||||
|
*/
|
||||||
|
function _dpgettext(string $domain, string $msgctxt, string $msgid): string
|
||||||
|
{
|
||||||
|
return Loader::getInstance()->getTranslator($domain)->pgettext($msgctxt, $msgid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! function_exists('_dnpgettext')) {
|
||||||
|
/**
|
||||||
|
* Plural version of pgettext.
|
||||||
|
*
|
||||||
|
* @param string $domain Domain to use
|
||||||
|
* @param string $msgctxt Context
|
||||||
|
* @param string $msgid Single form
|
||||||
|
* @param string $msgidPlural Plural form
|
||||||
|
* @param int $number Number of objects
|
||||||
|
*
|
||||||
|
* @return string translated plural form
|
||||||
|
*/
|
||||||
|
function _dnpgettext(string $domain, string $msgctxt, string $msgid, string $msgidPlural, int $number): string
|
||||||
|
{
|
||||||
|
return Loader::getInstance()->getTranslator($domain)->npgettext($msgctxt, $msgid, $msgidPlural, $number);
|
||||||
|
}
|
||||||
|
}
|
||||||
98
vendor/phpmyadmin/motranslator/tests/Cache/ApcuCacheFactoryTest.php
vendored
Normal file
98
vendor/phpmyadmin/motranslator/tests/Cache/ApcuCacheFactoryTest.php
vendored
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace PhpMyAdmin\MoTranslator\Tests\Cache;
|
||||||
|
|
||||||
|
use PhpMyAdmin\MoTranslator\Cache\ApcuCache;
|
||||||
|
use PhpMyAdmin\MoTranslator\Cache\ApcuCacheFactory;
|
||||||
|
use PhpMyAdmin\MoTranslator\MoParser;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
use function apcu_clear_cache;
|
||||||
|
use function apcu_delete;
|
||||||
|
use function apcu_enabled;
|
||||||
|
use function apcu_fetch;
|
||||||
|
use function function_exists;
|
||||||
|
use function sleep;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \PhpMyAdmin\MoTranslator\Cache\ApcuCacheFactory
|
||||||
|
*/
|
||||||
|
class ApcuCacheFactoryTest extends TestCase
|
||||||
|
{
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
if (function_exists('apcu_enabled') && apcu_enabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->markTestSkipped('ACPu extension is not installed and enabled for CLI');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tearDown(): void
|
||||||
|
{
|
||||||
|
parent::tearDown();
|
||||||
|
|
||||||
|
apcu_clear_cache();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetInstanceReturnApcuCache(): void
|
||||||
|
{
|
||||||
|
$factory = new ApcuCacheFactory();
|
||||||
|
$instance = $factory->getInstance(new MoParser(null), 'foo', 'bar');
|
||||||
|
$this->assertInstanceOf(ApcuCache::class, $instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testConstructorSetsTtl(): void
|
||||||
|
{
|
||||||
|
$locale = 'foo';
|
||||||
|
$domain = 'bar';
|
||||||
|
$msgid = 'Column';
|
||||||
|
$ttl = 1;
|
||||||
|
|
||||||
|
$factory = new ApcuCacheFactory($ttl);
|
||||||
|
$parser = new MoParser(__DIR__ . '/../data/little.mo');
|
||||||
|
$factory->getInstance($parser, $locale, $domain);
|
||||||
|
sleep($ttl * 2);
|
||||||
|
|
||||||
|
apcu_fetch('mo_' . $locale . '.' . $domain . '.' . $msgid, $success);
|
||||||
|
$this->assertFalse($success);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testConstructorSetsReloadOnMiss(): void
|
||||||
|
{
|
||||||
|
$expected = 'Column';
|
||||||
|
$locale = 'foo';
|
||||||
|
$domain = 'bar';
|
||||||
|
$msgid = 'Column';
|
||||||
|
|
||||||
|
$factory = new ApcuCacheFactory(0, false);
|
||||||
|
$parser = new MoParser(__DIR__ . '/../data/little.mo');
|
||||||
|
|
||||||
|
$instance = $factory->getInstance($parser, $locale, $domain);
|
||||||
|
|
||||||
|
apcu_delete('mo_' . $locale . '.' . $domain . '.' . $msgid);
|
||||||
|
$actual = $instance->get($msgid);
|
||||||
|
$this->assertSame($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testConstructorSetsPrefix(): void
|
||||||
|
{
|
||||||
|
$expected = 'Pole';
|
||||||
|
$locale = 'foo';
|
||||||
|
$domain = 'bar';
|
||||||
|
$msgid = 'Column';
|
||||||
|
$prefix = 'baz_';
|
||||||
|
|
||||||
|
$factory = new ApcuCacheFactory(0, true, $prefix);
|
||||||
|
$parser = new MoParser(__DIR__ . '/../data/little.mo');
|
||||||
|
|
||||||
|
$factory->getInstance($parser, $locale, $domain);
|
||||||
|
|
||||||
|
$actual = apcu_fetch($prefix . $locale . '.' . $domain . '.' . $msgid);
|
||||||
|
$this->assertSame($expected, $actual);
|
||||||
|
}
|
||||||
|
}
|
||||||
270
vendor/phpmyadmin/motranslator/tests/Cache/ApcuCacheTest.php
vendored
Normal file
270
vendor/phpmyadmin/motranslator/tests/Cache/ApcuCacheTest.php
vendored
Normal file
@@ -0,0 +1,270 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace PhpMyAdmin\MoTranslator\Tests\Cache;
|
||||||
|
|
||||||
|
use PhpMyAdmin\MoTranslator\Cache\ApcuCache;
|
||||||
|
use PhpMyAdmin\MoTranslator\MoParser;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
use ReflectionMethod;
|
||||||
|
|
||||||
|
use function apcu_clear_cache;
|
||||||
|
use function apcu_delete;
|
||||||
|
use function apcu_enabled;
|
||||||
|
use function apcu_entry;
|
||||||
|
use function apcu_fetch;
|
||||||
|
use function chr;
|
||||||
|
use function explode;
|
||||||
|
use function function_exists;
|
||||||
|
use function implode;
|
||||||
|
use function sleep;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \PhpMyAdmin\MoTranslator\Cache\ApcuCache
|
||||||
|
*/
|
||||||
|
class ApcuCacheTest extends TestCase
|
||||||
|
{
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
if (function_exists('apcu_enabled') && apcu_enabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->markTestSkipped('ACPu extension is not installed and enabled for CLI');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tearDown(): void
|
||||||
|
{
|
||||||
|
parent::tearDown();
|
||||||
|
|
||||||
|
apcu_clear_cache();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testConstructorLoadsCache(): void
|
||||||
|
{
|
||||||
|
$expected = 'Pole';
|
||||||
|
$locale = 'foo';
|
||||||
|
$domain = 'bar';
|
||||||
|
$msgid = 'Column';
|
||||||
|
|
||||||
|
new ApcuCache(new MoParser(__DIR__ . '/../data/little.mo'), $locale, $domain);
|
||||||
|
|
||||||
|
$actual = apcu_fetch('mo_' . $locale . '.' . $domain . '.' . $msgid);
|
||||||
|
$this->assertSame($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testConstructorSetsTtl(): void
|
||||||
|
{
|
||||||
|
$locale = 'foo';
|
||||||
|
$domain = 'bar';
|
||||||
|
$msgid = 'Column';
|
||||||
|
$ttl = 1;
|
||||||
|
|
||||||
|
new ApcuCache(new MoParser(__DIR__ . '/../data/little.mo'), $locale, $domain, $ttl);
|
||||||
|
sleep($ttl * 2);
|
||||||
|
|
||||||
|
apcu_fetch('mo_' . $locale . '.' . $domain . '.' . $msgid, $success);
|
||||||
|
$this->assertFalse($success);
|
||||||
|
apcu_fetch('mo_' . $locale . '.' . $domain . '.' . ApcuCache::LOADED_KEY, $success);
|
||||||
|
$this->assertFalse($success);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testConstructorSetsReloadOnMiss(): void
|
||||||
|
{
|
||||||
|
$expected = 'Column';
|
||||||
|
$locale = 'foo';
|
||||||
|
$domain = 'bar';
|
||||||
|
$msgid = 'Column';
|
||||||
|
$prefix = 'baz_';
|
||||||
|
|
||||||
|
$cache = new ApcuCache(
|
||||||
|
new MoParser(__DIR__ . '/../data/little.mo'),
|
||||||
|
$locale,
|
||||||
|
$domain,
|
||||||
|
0,
|
||||||
|
false,
|
||||||
|
$prefix
|
||||||
|
);
|
||||||
|
|
||||||
|
apcu_delete($prefix . $locale . '.' . $domain . '.' . $msgid);
|
||||||
|
$actual = $cache->get($msgid);
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testConstructorSetsPrefix(): void
|
||||||
|
{
|
||||||
|
$expected = 'Pole';
|
||||||
|
$locale = 'foo';
|
||||||
|
$domain = 'bar';
|
||||||
|
$msgid = 'Column';
|
||||||
|
$prefix = 'baz_';
|
||||||
|
|
||||||
|
new ApcuCache(new MoParser(__DIR__ . '/../data/little.mo'), $locale, $domain, 0, true, $prefix);
|
||||||
|
|
||||||
|
$actual = apcu_fetch($prefix . $locale . '.' . $domain . '.' . $msgid);
|
||||||
|
$this->assertSame($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testEnsureTranslationsLoadedSetsLoadedKey(): void
|
||||||
|
{
|
||||||
|
$expected = 1;
|
||||||
|
$locale = 'foo';
|
||||||
|
$domain = 'bar';
|
||||||
|
|
||||||
|
new ApcuCache(new MoParser(__DIR__ . '/../data/little.mo'), $locale, $domain);
|
||||||
|
|
||||||
|
$actual = apcu_fetch('mo_' . $locale . '.' . $domain . '.' . ApcuCache::LOADED_KEY);
|
||||||
|
$this->assertSame($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testEnsureTranslationsLoadedHonorsLock(): void
|
||||||
|
{
|
||||||
|
$locale = 'foo';
|
||||||
|
$domain = 'bar';
|
||||||
|
$msgid = 'Column';
|
||||||
|
|
||||||
|
$lock = 'mo_' . $locale . '.' . $domain . '.' . ApcuCache::LOADED_KEY;
|
||||||
|
apcu_entry($lock, static function () {
|
||||||
|
sleep(1);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
});
|
||||||
|
|
||||||
|
new ApcuCache(new MoParser(__DIR__ . '/../data/little.mo'), $locale, $domain);
|
||||||
|
|
||||||
|
$actual = apcu_fetch($lock);
|
||||||
|
$this->assertSame(1, $actual);
|
||||||
|
apcu_fetch('mo_' . $locale . '.' . $domain . '.' . $msgid, $success);
|
||||||
|
$this->assertFalse($success);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetReturnsMsgstr(): void
|
||||||
|
{
|
||||||
|
$expected = 'Pole';
|
||||||
|
$msgid = 'Column';
|
||||||
|
|
||||||
|
$cache = new ApcuCache(new MoParser(__DIR__ . '/../data/little.mo'), 'foo', 'bar');
|
||||||
|
|
||||||
|
$actual = $cache->get($msgid);
|
||||||
|
$this->assertSame($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetReturnsMsgidForCacheMiss(): void
|
||||||
|
{
|
||||||
|
$expected = 'Column';
|
||||||
|
|
||||||
|
$cache = new ApcuCache(new MoParser(null), 'foo', 'bar');
|
||||||
|
|
||||||
|
$actual = $cache->get($expected);
|
||||||
|
$this->assertSame($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testStoresMsgidOnCacheMiss(): void
|
||||||
|
{
|
||||||
|
$expected = 'Column';
|
||||||
|
$locale = 'foo';
|
||||||
|
$domain = 'bar';
|
||||||
|
|
||||||
|
$cache = new ApcuCache(new MoParser(null), $locale, $domain);
|
||||||
|
$cache->get($expected);
|
||||||
|
|
||||||
|
$actual = apcu_fetch('mo_' . $locale . '.' . $domain . '.' . $expected);
|
||||||
|
$this->assertSame($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetReloadsOnCacheMiss(): void
|
||||||
|
{
|
||||||
|
$expected = 'Pole';
|
||||||
|
$locale = 'foo';
|
||||||
|
$domain = 'bar';
|
||||||
|
$msgid = 'Column';
|
||||||
|
|
||||||
|
$cache = new ApcuCache(new MoParser(__DIR__ . '/../data/little.mo'), $locale, $domain);
|
||||||
|
|
||||||
|
apcu_delete('mo_' . $locale . '.' . $domain . '.' . ApcuCache::LOADED_KEY);
|
||||||
|
$actual = $cache->get($msgid);
|
||||||
|
$this->assertSame($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testReloadOnMissHonorsLock(): void
|
||||||
|
{
|
||||||
|
$expected = 'Pole';
|
||||||
|
$locale = 'foo';
|
||||||
|
$domain = 'bar';
|
||||||
|
$msgid = 'Column';
|
||||||
|
|
||||||
|
$cache = new ApcuCache(new MoParser(null), $locale, $domain);
|
||||||
|
|
||||||
|
$method = new ReflectionMethod($cache, 'reloadOnMiss');
|
||||||
|
$method->setAccessible(true);
|
||||||
|
|
||||||
|
$key = 'mo_' . $locale . '.' . $domain . '.' . $msgid;
|
||||||
|
apcu_entry($key, static function () use ($expected): string {
|
||||||
|
sleep(1);
|
||||||
|
|
||||||
|
return $expected;
|
||||||
|
});
|
||||||
|
$actual = $method->invoke($cache, $msgid);
|
||||||
|
|
||||||
|
$this->assertSame($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSetSetsMsgstr(): void
|
||||||
|
{
|
||||||
|
$expected = 'Pole';
|
||||||
|
$msgid = 'Column';
|
||||||
|
|
||||||
|
$cache = new ApcuCache(new MoParser(null), 'foo', 'bar');
|
||||||
|
$cache->set($msgid, $expected);
|
||||||
|
|
||||||
|
$actual = $cache->get($msgid);
|
||||||
|
$this->assertSame($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testHasReturnsFalse(): void
|
||||||
|
{
|
||||||
|
$cache = new ApcuCache(new MoParser(null), 'foo', 'bar');
|
||||||
|
$actual = $cache->has('Column');
|
||||||
|
$this->assertFalse($actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testHasReturnsTrue(): void
|
||||||
|
{
|
||||||
|
$cache = new ApcuCache(new MoParser(__DIR__ . '/../data/little.mo'), 'foo', 'bar');
|
||||||
|
$actual = $cache->has('Column');
|
||||||
|
$this->assertTrue($actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSetAllSetsTranslations(): void
|
||||||
|
{
|
||||||
|
$translations = [
|
||||||
|
'foo' => 'bar',
|
||||||
|
'and' => 'another',
|
||||||
|
];
|
||||||
|
|
||||||
|
$cache = new ApcuCache(new MoParser(null), 'foo', 'bar');
|
||||||
|
$cache->setAll($translations);
|
||||||
|
|
||||||
|
foreach ($translations as $msgid => $expected) {
|
||||||
|
$actual = $cache->get($msgid);
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testCacheStoresPluralForms(): void
|
||||||
|
{
|
||||||
|
$expected = ['first', 'second'];
|
||||||
|
$plural = ["%d pig went to the market\n", "%d pigs went to the market\n"];
|
||||||
|
$msgid = implode(chr(0), $plural);
|
||||||
|
|
||||||
|
$cache = new ApcuCache(new MoParser(null), 'foo', 'bar');
|
||||||
|
$cache->set($msgid, implode(chr(0), $expected));
|
||||||
|
|
||||||
|
$msgstr = $cache->get($msgid);
|
||||||
|
$actual = explode(chr(0), $msgstr);
|
||||||
|
$this->assertSame($expected, $actual);
|
||||||
|
}
|
||||||
|
}
|
||||||
27
vendor/phpmyadmin/motranslator/tests/Cache/ApcuDisabledTest.php
vendored
Normal file
27
vendor/phpmyadmin/motranslator/tests/Cache/ApcuDisabledTest.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace PhpMyAdmin\MoTranslator\Tests\Cache;
|
||||||
|
|
||||||
|
use PhpMyAdmin\MoTranslator\Cache\ApcuCache;
|
||||||
|
use PhpMyAdmin\MoTranslator\CacheException;
|
||||||
|
use PhpMyAdmin\MoTranslator\MoParser;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
use function apcu_enabled;
|
||||||
|
use function function_exists;
|
||||||
|
|
||||||
|
final class ApcuDisabledTest extends TestCase
|
||||||
|
{
|
||||||
|
public function testConstructorApcuNotEnabledThrowsException(): void
|
||||||
|
{
|
||||||
|
if (function_exists('apcu_enabled') && apcu_enabled()) {
|
||||||
|
$this->markTestSkipped('ext-apcu is enabled');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->expectException(CacheException::class);
|
||||||
|
$this->expectExceptionMessage('ACPu extension must be installed and enabled');
|
||||||
|
new ApcuCache(new MoParser(null), 'foo', 'bar');
|
||||||
|
}
|
||||||
|
}
|
||||||
82
vendor/phpmyadmin/motranslator/tests/Cache/InMemoryCacheTest.php
vendored
Normal file
82
vendor/phpmyadmin/motranslator/tests/Cache/InMemoryCacheTest.php
vendored
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace PhpMyAdmin\MoTranslator\Tests\Cache;
|
||||||
|
|
||||||
|
use PhpMyAdmin\MoTranslator\Cache\InMemoryCache;
|
||||||
|
use PhpMyAdmin\MoTranslator\MoParser;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \PhpMyAdmin\MoTranslator\Cache\InMemoryCache
|
||||||
|
*/
|
||||||
|
class InMemoryCacheTest extends TestCase
|
||||||
|
{
|
||||||
|
public function testConstructorParsesCache(): void
|
||||||
|
{
|
||||||
|
$expected = 'Pole';
|
||||||
|
$parser = new MoParser(__DIR__ . '/../data/little.mo');
|
||||||
|
$cache = new InMemoryCache($parser);
|
||||||
|
$actual = $cache->get('Column');
|
||||||
|
$this->assertSame($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetReturnsMsgidForCacheMiss(): void
|
||||||
|
{
|
||||||
|
$expected = 'Column';
|
||||||
|
$cache = new InMemoryCache(new MoParser(null));
|
||||||
|
$actual = $cache->get($expected);
|
||||||
|
$this->assertSame($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSetSetsMsgstr(): void
|
||||||
|
{
|
||||||
|
$expected = 'Pole';
|
||||||
|
$msgid = 'Column';
|
||||||
|
$cache = new InMemoryCache(new MoParser(null));
|
||||||
|
$cache->set($msgid, $expected);
|
||||||
|
$actual = $cache->get($msgid);
|
||||||
|
$this->assertSame($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testHasReturnsFalse(): void
|
||||||
|
{
|
||||||
|
$cache = new InMemoryCache(new MoParser(null));
|
||||||
|
$actual = $cache->has('Column');
|
||||||
|
$this->assertFalse($actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testHasReturnsTrue(): void
|
||||||
|
{
|
||||||
|
$cache = new InMemoryCache(new MoParser(__DIR__ . '/../data/little.mo'));
|
||||||
|
$actual = $cache->has('Column');
|
||||||
|
$this->assertTrue($actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSetAllSetsTranslations(): void
|
||||||
|
{
|
||||||
|
$translations = [
|
||||||
|
'foo' => 'bar',
|
||||||
|
'and' => 'another',
|
||||||
|
];
|
||||||
|
$cache = new InMemoryCache(new MoParser(null));
|
||||||
|
$cache->setAll($translations);
|
||||||
|
foreach ($translations as $msgid => $expected) {
|
||||||
|
$actual = $cache->get($msgid);
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetAllReturnsTranslations(): void
|
||||||
|
{
|
||||||
|
$expected = [
|
||||||
|
'foo' => 'bar',
|
||||||
|
'and' => 'another',
|
||||||
|
];
|
||||||
|
$cache = new InMemoryCache(new MoParser(null));
|
||||||
|
$cache->setAll($expected);
|
||||||
|
$actual = $cache->getAll();
|
||||||
|
$this->assertSame($expected, $actual);
|
||||||
|
}
|
||||||
|
}
|
||||||
102
vendor/phpmyadmin/motranslator/tests/FunctionsTest.php
vendored
Normal file
102
vendor/phpmyadmin/motranslator/tests/FunctionsTest.php
vendored
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace PhpMyAdmin\MoTranslator\Tests;
|
||||||
|
|
||||||
|
use PhpMyAdmin\MoTranslator\Loader;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test for functions.
|
||||||
|
*/
|
||||||
|
class FunctionsTest extends TestCase
|
||||||
|
{
|
||||||
|
public function setUp(): void
|
||||||
|
{
|
||||||
|
Loader::loadFunctions();
|
||||||
|
|
||||||
|
_setlocale(0, 'cs');
|
||||||
|
_textdomain('phpmyadmin');
|
||||||
|
_bindtextdomain('phpmyadmin', __DIR__ . '/data/locale/');
|
||||||
|
_bind_textdomain_codeset('phpmyadmin', 'UTF-8');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGettext(): void
|
||||||
|
{
|
||||||
|
$this->assertEquals(
|
||||||
|
'Typ',
|
||||||
|
_gettext('Type')
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
'Typ',
|
||||||
|
__('Type')
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
'%d sekundy',
|
||||||
|
_ngettext(
|
||||||
|
'%d second',
|
||||||
|
'%d seconds',
|
||||||
|
2
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
'%d seconds',
|
||||||
|
_npgettext(
|
||||||
|
'context',
|
||||||
|
'%d second',
|
||||||
|
'%d seconds',
|
||||||
|
2
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
'Tabulka',
|
||||||
|
_pgettext(
|
||||||
|
'Display format',
|
||||||
|
'Table'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testDomain(): void
|
||||||
|
{
|
||||||
|
$this->assertEquals(
|
||||||
|
'Typ',
|
||||||
|
_dgettext('phpmyadmin', 'Type')
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
'%d sekundy',
|
||||||
|
_dngettext(
|
||||||
|
'phpmyadmin',
|
||||||
|
'%d second',
|
||||||
|
'%d seconds',
|
||||||
|
2
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
'%d seconds',
|
||||||
|
_dnpgettext(
|
||||||
|
'phpmyadmin',
|
||||||
|
'context',
|
||||||
|
'%d second',
|
||||||
|
'%d seconds',
|
||||||
|
2
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
'Tabulka',
|
||||||
|
_dpgettext(
|
||||||
|
'phpmyadmin',
|
||||||
|
'Display format',
|
||||||
|
'Table'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
325
vendor/phpmyadmin/motranslator/tests/LoaderTest.php
vendored
Normal file
325
vendor/phpmyadmin/motranslator/tests/LoaderTest.php
vendored
Normal file
@@ -0,0 +1,325 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace PhpMyAdmin\MoTranslator\Tests;
|
||||||
|
|
||||||
|
use PhpMyAdmin\MoTranslator\Cache\CacheFactoryInterface;
|
||||||
|
use PhpMyAdmin\MoTranslator\Cache\CacheInterface;
|
||||||
|
use PhpMyAdmin\MoTranslator\Loader;
|
||||||
|
use PhpMyAdmin\MoTranslator\MoParser;
|
||||||
|
use PHPUnit\Framework\MockObject\MockObject;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
use function getenv;
|
||||||
|
use function putenv;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test for mo loading.
|
||||||
|
*/
|
||||||
|
class LoaderTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param array[] $expected
|
||||||
|
*
|
||||||
|
* @dataProvider localeList
|
||||||
|
*/
|
||||||
|
public function testListLocales(string $locale, array $expected): void
|
||||||
|
{
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected,
|
||||||
|
Loader::listLocales($locale)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array[]
|
||||||
|
*/
|
||||||
|
public function localeList(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[
|
||||||
|
'cs_CZ',
|
||||||
|
[
|
||||||
|
'cs_CZ',
|
||||||
|
'cs',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'sr_CS.UTF-8@latin',
|
||||||
|
[
|
||||||
|
'sr_CS.UTF-8@latin',
|
||||||
|
'sr_CS@latin',
|
||||||
|
'sr@latin',
|
||||||
|
'sr_CS.UTF-8',
|
||||||
|
'sr_CS',
|
||||||
|
'sr',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
// For a locale containing country code, we prefer
|
||||||
|
// full locale name, but if that's not found, fall back
|
||||||
|
// to the language only locale name.
|
||||||
|
[
|
||||||
|
'sr_RS',
|
||||||
|
[
|
||||||
|
'sr_RS',
|
||||||
|
'sr',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
// If language code is used, it's the only thing returned.
|
||||||
|
[
|
||||||
|
'sr',
|
||||||
|
['sr'],
|
||||||
|
],
|
||||||
|
// There is support for language and charset only.
|
||||||
|
[
|
||||||
|
'sr.UTF-8',
|
||||||
|
[
|
||||||
|
'sr.UTF-8',
|
||||||
|
'sr',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
// It can also split out character set from the full locale name.
|
||||||
|
[
|
||||||
|
'sr_RS.UTF-8',
|
||||||
|
[
|
||||||
|
'sr_RS.UTF-8',
|
||||||
|
'sr_RS',
|
||||||
|
'sr',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
// There is support for @modifier in locale names as well.
|
||||||
|
[
|
||||||
|
'sr_RS.UTF-8@latin',
|
||||||
|
[
|
||||||
|
'sr_RS.UTF-8@latin',
|
||||||
|
'sr_RS@latin',
|
||||||
|
'sr@latin',
|
||||||
|
'sr_RS.UTF-8',
|
||||||
|
'sr_RS',
|
||||||
|
'sr',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'sr.UTF-8@latin',
|
||||||
|
[
|
||||||
|
'sr.UTF-8@latin',
|
||||||
|
'sr@latin',
|
||||||
|
'sr.UTF-8',
|
||||||
|
'sr',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
// We can pass in only language and modifier.
|
||||||
|
[
|
||||||
|
'sr@latin',
|
||||||
|
[
|
||||||
|
'sr@latin',
|
||||||
|
'sr',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
// If locale name is not following the regular POSIX pattern,
|
||||||
|
// it's used verbatim.
|
||||||
|
[
|
||||||
|
'something',
|
||||||
|
['something'],
|
||||||
|
],
|
||||||
|
|
||||||
|
// Passing in an empty string returns an empty array.
|
||||||
|
[
|
||||||
|
'',
|
||||||
|
[],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getLoader(string $domain, string $locale): Loader
|
||||||
|
{
|
||||||
|
$loader = new Loader();
|
||||||
|
$loader->setlocale($locale);
|
||||||
|
$loader->textdomain($domain);
|
||||||
|
$loader->bindtextdomain($domain, __DIR__ . '/data/locale/');
|
||||||
|
|
||||||
|
return $loader;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testLocaleChange(): void
|
||||||
|
{
|
||||||
|
$loader = new Loader();
|
||||||
|
$loader->setlocale('cs');
|
||||||
|
$loader->textdomain('phpmyadmin');
|
||||||
|
$loader->bindtextdomain('phpmyadmin', __DIR__ . '/data/locale/');
|
||||||
|
$translator = $loader->getTranslator('phpmyadmin');
|
||||||
|
$this->assertEquals('Typ', $translator->gettext('Type'));
|
||||||
|
$loader->setlocale('be_BY');
|
||||||
|
$translator = $loader->getTranslator('phpmyadmin');
|
||||||
|
$this->assertEquals('Тып', $translator->gettext('Type'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider translatorData
|
||||||
|
*/
|
||||||
|
public function testGetTranslator(string $domain, string $locale, string $otherdomain, string $expected): void
|
||||||
|
{
|
||||||
|
$loader = $this->getLoader($domain, $locale);
|
||||||
|
$translator = $loader->getTranslator($otherdomain);
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected,
|
||||||
|
$translator->gettext('Type')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array[]
|
||||||
|
*/
|
||||||
|
public function translatorData(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[
|
||||||
|
'phpmyadmin',
|
||||||
|
'cs',
|
||||||
|
'',
|
||||||
|
'Typ',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'phpmyadmin',
|
||||||
|
'cs_CZ',
|
||||||
|
'',
|
||||||
|
'Typ',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'phpmyadmin',
|
||||||
|
'be_BY',
|
||||||
|
'',
|
||||||
|
'Тып',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'phpmyadmin',
|
||||||
|
'be@latin',
|
||||||
|
'',
|
||||||
|
'Typ',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'phpmyadmin',
|
||||||
|
'cs',
|
||||||
|
'other',
|
||||||
|
'Type',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'other',
|
||||||
|
'cs',
|
||||||
|
'phpmyadmin',
|
||||||
|
'Type',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testInstance(): void
|
||||||
|
{
|
||||||
|
$loader = Loader::getInstance();
|
||||||
|
$loader->setlocale('cs');
|
||||||
|
$loader->textdomain('phpmyadmin');
|
||||||
|
$loader->bindtextdomain('phpmyadmin', __DIR__ . '/data/locale/');
|
||||||
|
|
||||||
|
$translator = $loader->getTranslator();
|
||||||
|
$this->assertEquals(
|
||||||
|
'Typ',
|
||||||
|
$translator->gettext('Type')
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Ensure the object survives */
|
||||||
|
$loader = Loader::getInstance();
|
||||||
|
$translator = $loader->getTranslator();
|
||||||
|
$this->assertEquals(
|
||||||
|
'Typ',
|
||||||
|
$translator->gettext('Type')
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Ensure the object can support different locale files for the same domain */
|
||||||
|
$loader = Loader::getInstance();
|
||||||
|
$loader->setlocale('be_BY');
|
||||||
|
$loader->bindtextdomain('phpmyadmin', __DIR__ . '/data/locale/');
|
||||||
|
$translator = $loader->getTranslator();
|
||||||
|
$this->assertEquals(
|
||||||
|
'Тып',
|
||||||
|
$translator->gettext('Type')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testDetect(): void
|
||||||
|
{
|
||||||
|
$GLOBALS['lang'] = 'foo';
|
||||||
|
$loader = Loader::getInstance();
|
||||||
|
$this->assertEquals(
|
||||||
|
'foo',
|
||||||
|
$loader->detectlocale()
|
||||||
|
);
|
||||||
|
unset($GLOBALS['lang']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testDetectEnv(): void
|
||||||
|
{
|
||||||
|
$loader = Loader::getInstance();
|
||||||
|
foreach (['LC_MESSAGES', 'LC_ALL', 'LANG'] as $var) {
|
||||||
|
putenv($var);
|
||||||
|
if (getenv($var) === false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->markTestSkipped('Unsetting environment does not work');
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($GLOBALS['lang']);
|
||||||
|
putenv('LC_ALL=baz');
|
||||||
|
$this->assertEquals(
|
||||||
|
'baz',
|
||||||
|
$loader->detectlocale()
|
||||||
|
);
|
||||||
|
putenv('LC_ALL');
|
||||||
|
putenv('LC_MESSAGES=bar');
|
||||||
|
$this->assertEquals(
|
||||||
|
'bar',
|
||||||
|
$loader->detectlocale()
|
||||||
|
);
|
||||||
|
putenv('LC_MESSAGES');
|
||||||
|
putenv('LANG=barr');
|
||||||
|
$this->assertEquals(
|
||||||
|
'barr',
|
||||||
|
$loader->detectlocale()
|
||||||
|
);
|
||||||
|
putenv('LANG');
|
||||||
|
$this->assertEquals(
|
||||||
|
'en',
|
||||||
|
$loader->detectlocale()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSetCacheFactory(): void
|
||||||
|
{
|
||||||
|
$expected = 'Foo';
|
||||||
|
$locale = 'be_BY';
|
||||||
|
$domain = 'apcu';
|
||||||
|
|
||||||
|
$cache = $this->createMock(CacheInterface::class);
|
||||||
|
$cache->method('get')
|
||||||
|
->willReturn($expected);
|
||||||
|
/** @var CacheFactoryInterface&MockObject $factory */
|
||||||
|
$factory = $this->createMock(CacheFactoryInterface::class);
|
||||||
|
$factory->expects($this->once())
|
||||||
|
->method('getInstance')
|
||||||
|
->with($this->isInstanceOf(MoParser::class), $locale, $domain)
|
||||||
|
->willReturn($cache);
|
||||||
|
|
||||||
|
Loader::setCacheFactory($factory);
|
||||||
|
$loader = Loader::getInstance();
|
||||||
|
$loader->setlocale($locale);
|
||||||
|
$loader->bindtextdomain($domain, __DIR__ . '/data/locale/');
|
||||||
|
$translator = $loader->getTranslator($domain);
|
||||||
|
|
||||||
|
$actual = $translator->gettext('Type');
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
|
}
|
||||||
|
}
|
||||||
230
vendor/phpmyadmin/motranslator/tests/MoFilesTest.php
vendored
Normal file
230
vendor/phpmyadmin/motranslator/tests/MoFilesTest.php
vendored
Normal file
@@ -0,0 +1,230 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace PhpMyAdmin\MoTranslator\Tests;
|
||||||
|
|
||||||
|
use PhpMyAdmin\MoTranslator\Cache\InMemoryCache;
|
||||||
|
use PhpMyAdmin\MoTranslator\MoParser;
|
||||||
|
use PhpMyAdmin\MoTranslator\Translator;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
use function basename;
|
||||||
|
use function glob;
|
||||||
|
use function strpos;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test for MO files parsing.
|
||||||
|
*/
|
||||||
|
class MoFilesTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @dataProvider provideMoFiles
|
||||||
|
*/
|
||||||
|
public function testMoFileTranslate(string $filename): void
|
||||||
|
{
|
||||||
|
$parser = $this->getTranslator($filename);
|
||||||
|
$this->assertEquals(
|
||||||
|
'Pole',
|
||||||
|
$parser->gettext('Column')
|
||||||
|
);
|
||||||
|
// Non existing string
|
||||||
|
$this->assertEquals(
|
||||||
|
'Column parser',
|
||||||
|
$parser->gettext('Column parser')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider provideMoFiles
|
||||||
|
*/
|
||||||
|
public function testMoFilePlurals(string $filename): void
|
||||||
|
{
|
||||||
|
$parser = $this->getTranslator($filename);
|
||||||
|
$expected2 = '%d sekundy';
|
||||||
|
if (strpos($filename, 'invalid-formula.mo') !== false || strpos($filename, 'lessplurals.mo') !== false) {
|
||||||
|
$expected0 = '%d sekunda';
|
||||||
|
$expected2 = '%d sekunda';
|
||||||
|
} elseif (strpos($filename, 'plurals.mo') !== false || strpos($filename, 'noheader.mo') !== false) {
|
||||||
|
$expected0 = '%d sekundy';
|
||||||
|
} else {
|
||||||
|
$expected0 = '%d sekund';
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected0,
|
||||||
|
$parser->ngettext(
|
||||||
|
'%d second',
|
||||||
|
'%d seconds',
|
||||||
|
0
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$this->assertEquals(
|
||||||
|
'%d sekunda',
|
||||||
|
$parser->ngettext(
|
||||||
|
'%d second',
|
||||||
|
'%d seconds',
|
||||||
|
1
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected2,
|
||||||
|
$parser->ngettext(
|
||||||
|
'%d second',
|
||||||
|
'%d seconds',
|
||||||
|
2
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected0,
|
||||||
|
$parser->ngettext(
|
||||||
|
'%d second',
|
||||||
|
'%d seconds',
|
||||||
|
5
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected0,
|
||||||
|
$parser->ngettext(
|
||||||
|
'%d second',
|
||||||
|
'%d seconds',
|
||||||
|
10
|
||||||
|
)
|
||||||
|
);
|
||||||
|
// Non existing string
|
||||||
|
$this->assertEquals(
|
||||||
|
'"%d" seconds',
|
||||||
|
$parser->ngettext(
|
||||||
|
'"%d" second',
|
||||||
|
'"%d" seconds',
|
||||||
|
10
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider provideMoFiles
|
||||||
|
*/
|
||||||
|
public function testMoFileContext(string $filename): void
|
||||||
|
{
|
||||||
|
$parser = $this->getTranslator($filename);
|
||||||
|
$this->assertEquals(
|
||||||
|
'Tabulka',
|
||||||
|
$parser->pgettext(
|
||||||
|
'Display format',
|
||||||
|
'Table'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider provideNotTranslatedFiles
|
||||||
|
*/
|
||||||
|
public function testMoFileNotTranslated(string $filename): void
|
||||||
|
{
|
||||||
|
$parser = $this->getTranslator($filename);
|
||||||
|
$this->assertEquals(
|
||||||
|
'%d second',
|
||||||
|
$parser->ngettext(
|
||||||
|
'%d second',
|
||||||
|
'%d seconds',
|
||||||
|
1
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array[]
|
||||||
|
*/
|
||||||
|
public function provideMoFiles(): array
|
||||||
|
{
|
||||||
|
return $this->getFiles('./tests/data/*.mo');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array[]
|
||||||
|
*/
|
||||||
|
public function provideErrorMoFiles(): array
|
||||||
|
{
|
||||||
|
return $this->getFiles('./tests/data/error/*.mo');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array[]
|
||||||
|
*/
|
||||||
|
public function provideNotTranslatedFiles(): array
|
||||||
|
{
|
||||||
|
return $this->getFiles('./tests/data/not-translated/*.mo');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider provideErrorMoFiles
|
||||||
|
*/
|
||||||
|
public function testEmptyMoFile(string $file): void
|
||||||
|
{
|
||||||
|
$parser = new MoParser($file);
|
||||||
|
$translator = new Translator(new InMemoryCache($parser));
|
||||||
|
if (basename($file) === 'magic.mo') {
|
||||||
|
$this->assertEquals(Translator::ERROR_BAD_MAGIC, $parser->error);
|
||||||
|
} else {
|
||||||
|
$this->assertEquals(Translator::ERROR_READING, $parser->error);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
'Table',
|
||||||
|
$translator->pgettext(
|
||||||
|
'Display format',
|
||||||
|
'Table'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$this->assertEquals(
|
||||||
|
'"%d" seconds',
|
||||||
|
$translator->ngettext(
|
||||||
|
'"%d" second',
|
||||||
|
'"%d" seconds',
|
||||||
|
10
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider provideMoFiles
|
||||||
|
*/
|
||||||
|
public function testExists(string $file): void
|
||||||
|
{
|
||||||
|
$parser = $this->getTranslator($file);
|
||||||
|
$this->assertEquals(
|
||||||
|
true,
|
||||||
|
$parser->exists('Column')
|
||||||
|
);
|
||||||
|
$this->assertEquals(
|
||||||
|
false,
|
||||||
|
$parser->exists('Column parser')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $pattern path names pattern to match
|
||||||
|
*
|
||||||
|
* @return array[]
|
||||||
|
*/
|
||||||
|
private function getFiles(string $pattern): array
|
||||||
|
{
|
||||||
|
$files = glob($pattern);
|
||||||
|
if ($files === false) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
foreach ($files as $file) {
|
||||||
|
$result[] = [$file];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getTranslator(string $filename): Translator
|
||||||
|
{
|
||||||
|
return new Translator(new InMemoryCache(new MoParser($filename)));
|
||||||
|
}
|
||||||
|
}
|
||||||
152
vendor/phpmyadmin/motranslator/tests/PluralFormulaTest.php
vendored
Normal file
152
vendor/phpmyadmin/motranslator/tests/PluralFormulaTest.php
vendored
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace PhpMyAdmin\MoTranslator\Tests;
|
||||||
|
|
||||||
|
use PhpMyAdmin\MoTranslator\Translator;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test for gettext parsing.
|
||||||
|
*/
|
||||||
|
class PluralFormulaTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Test for extractPluralsForms.
|
||||||
|
*
|
||||||
|
* @dataProvider pluralExtractionData
|
||||||
|
*/
|
||||||
|
public function testExtractPluralsForms(string $header, string $expected): void
|
||||||
|
{
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected,
|
||||||
|
Translator::extractPluralsForms($header)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array[]
|
||||||
|
*/
|
||||||
|
public function pluralExtractionData(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// It defaults to a "Western-style" plural header.
|
||||||
|
[
|
||||||
|
'',
|
||||||
|
'nplurals=2; plural=n == 1 ? 0 : 1;',
|
||||||
|
],
|
||||||
|
// Extracting it from the middle of the header works.
|
||||||
|
[
|
||||||
|
"Content-type: text/html; charset=UTF-8\n"
|
||||||
|
. "Plural-Forms: nplurals=1; plural=0;\n"
|
||||||
|
. "Last-Translator: nobody\n",
|
||||||
|
' nplurals=1; plural=0;',
|
||||||
|
],
|
||||||
|
// It's also case-insensitive.
|
||||||
|
[
|
||||||
|
"PLURAL-forms: nplurals=1; plural=0;\n",
|
||||||
|
' nplurals=1; plural=0;',
|
||||||
|
],
|
||||||
|
// It falls back to default if it's not on a separate line.
|
||||||
|
[
|
||||||
|
'Content-type: text/html; charset=UTF-8' // note the missing \n here
|
||||||
|
. "Plural-Forms: nplurals=1; plural=0;\n"
|
||||||
|
. "Last-Translator: nobody\n",
|
||||||
|
'nplurals=2; plural=n == 1 ? 0 : 1;',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider pluralCounts
|
||||||
|
*/
|
||||||
|
public function testPluralCounts(string $expr, int $expected): void
|
||||||
|
{
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected,
|
||||||
|
Translator::extractPluralCount($expr)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array[]
|
||||||
|
*/
|
||||||
|
public function pluralCounts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[
|
||||||
|
'',
|
||||||
|
1,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'foo=2; expr',
|
||||||
|
1,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'nplurals=2; epxr',
|
||||||
|
2,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
' nplurals = 3 ; epxr',
|
||||||
|
3,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
' nplurals = 4 ; epxr ; ',
|
||||||
|
4,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'nplurals',
|
||||||
|
1,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider pluralExpressions
|
||||||
|
*/
|
||||||
|
public function testPluralExpression(string $expr, string $expected): void
|
||||||
|
{
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected,
|
||||||
|
Translator::sanitizePluralExpression($expr)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array[]
|
||||||
|
*/
|
||||||
|
public function pluralExpressions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'nplurals=2; plural=n == 1 ? 0 : 1;',
|
||||||
|
'n == 1 ? 0 : 1',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
' nplurals=1; plural=0;',
|
||||||
|
'0',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n",
|
||||||
|
'n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
' nplurals=1; plural=baz(n);',
|
||||||
|
'(n)',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
' plural=n',
|
||||||
|
'n',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'nplurals',
|
||||||
|
'n',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
125
vendor/phpmyadmin/motranslator/tests/PluralTest.php
vendored
Normal file
125
vendor/phpmyadmin/motranslator/tests/PluralTest.php
vendored
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace PhpMyAdmin\MoTranslator\Tests;
|
||||||
|
|
||||||
|
use PhpMyAdmin\MoTranslator\Cache\InMemoryCache;
|
||||||
|
use PhpMyAdmin\MoTranslator\MoParser;
|
||||||
|
use PhpMyAdmin\MoTranslator\Translator;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
use function chr;
|
||||||
|
use function implode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test for gettext parsing.
|
||||||
|
*/
|
||||||
|
class PluralTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Test for npgettext.
|
||||||
|
*
|
||||||
|
* @param int $number Number
|
||||||
|
* @param string $expected Expected output
|
||||||
|
*
|
||||||
|
* @dataProvider providerTestNpgettext
|
||||||
|
*/
|
||||||
|
public function testNpgettext(int $number, string $expected): void
|
||||||
|
{
|
||||||
|
$parser = $this->getTranslator('');
|
||||||
|
$result = $parser->npgettext('context', "%d pig went to the market\n", "%d pigs went to the market\n", $number);
|
||||||
|
$this->assertSame($expected, $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data provider for test_npgettext.
|
||||||
|
*
|
||||||
|
* @return array[]
|
||||||
|
*/
|
||||||
|
public static function providerTestNpgettext(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[
|
||||||
|
1,
|
||||||
|
"%d pig went to the market\n",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
2,
|
||||||
|
"%d pigs went to the market\n",
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test for ngettext
|
||||||
|
*/
|
||||||
|
public function testNgettext(): void
|
||||||
|
{
|
||||||
|
$parser = $this->getTranslator('');
|
||||||
|
$translationKey = implode(chr(0), ["%d pig went to the market\n", "%d pigs went to the market\n"]);
|
||||||
|
$parser->setTranslation($translationKey, '');
|
||||||
|
$result = $parser->ngettext("%d pig went to the market\n", "%d pigs went to the market\n", 1);
|
||||||
|
$this->assertSame('', $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array[]
|
||||||
|
*/
|
||||||
|
public function dataProviderPluralForms(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Plural-Forms: nplurals=2; plural=n != 1;'],
|
||||||
|
['Plural-Forms: nplurals=1; plural=0;'],
|
||||||
|
['Plural-Forms: nplurals=2; plural=(n > 1);'],
|
||||||
|
[
|
||||||
|
'Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n'
|
||||||
|
. '%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;',
|
||||||
|
],
|
||||||
|
['Plural-Forms: nplurals=2; plural=n >= 2 && (n < 11 || n > 99);'],
|
||||||
|
['Plural-Forms: nplurals=4; plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3;'],
|
||||||
|
['Plural-Forms: nplurals=3; plural=n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < 20)) ? 1 : 2;'],
|
||||||
|
[
|
||||||
|
'Plural-Forms: nplurals=2; plural=n != 1 && n != 2 && n != 3 &'
|
||||||
|
. '& (n % 10 == 4 || n % 10 == 6 || n % 10 == 9);',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test for ngettext
|
||||||
|
*
|
||||||
|
* @see https://github.com/phpmyadmin/motranslator/issues/37
|
||||||
|
*
|
||||||
|
* @dataProvider dataProviderPluralForms
|
||||||
|
*/
|
||||||
|
public function testNgettextSelectString(string $pluralForms): void
|
||||||
|
{
|
||||||
|
$parser = $this->getTranslator('');
|
||||||
|
$parser->setTranslation(
|
||||||
|
'',
|
||||||
|
"Project-Id-Version: phpMyAdmin 5.1.0-dev\n"
|
||||||
|
. "Report-Msgid-Bugs-To: translators@phpmyadmin.net\n"
|
||||||
|
. "PO-Revision-Date: 2020-09-01 09:12+0000\n"
|
||||||
|
. "Last-Translator: William Desportes <williamdes@wdes.fr>\n"
|
||||||
|
. 'Language-Team: English (United Kingdom) '
|
||||||
|
. "<https:\/\/hosted.weblate.org\/projects\/phpmyadmin\/master\/en_GB\/>\n"
|
||||||
|
. "Language: en_GB\n"
|
||||||
|
. "MIME-Version: 1.0\n"
|
||||||
|
. "Content-Type: text\/plain; charset=UTF-8\n"
|
||||||
|
. "Content-Transfer-Encoding: 8bit\n"
|
||||||
|
. $pluralForms . "\n"
|
||||||
|
. "X-Generator: Weblate 4.2.1-dev\n"
|
||||||
|
. ''
|
||||||
|
);
|
||||||
|
$translationKey = implode(chr(0), ["%d pig went to the market\n", "%d pigs went to the market\n"]);
|
||||||
|
$parser->setTranslation($translationKey, 'ok');
|
||||||
|
$result = $parser->ngettext("%d pig went to the market\n", "%d pigs went to the market\n", 1);
|
||||||
|
$this->assertSame('ok', $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getTranslator(string $filename): Translator
|
||||||
|
{
|
||||||
|
return new Translator(new InMemoryCache(new MoParser($filename)));
|
||||||
|
}
|
||||||
|
}
|
||||||
40
vendor/phpmyadmin/motranslator/tests/StringReaderTest.php
vendored
Normal file
40
vendor/phpmyadmin/motranslator/tests/StringReaderTest.php
vendored
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace PhpMyAdmin\MoTranslator\Tests;
|
||||||
|
|
||||||
|
use PhpMyAdmin\MoTranslator\StringReader;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
use function file_put_contents;
|
||||||
|
use function sys_get_temp_dir;
|
||||||
|
use function tempnam;
|
||||||
|
use function unlink;
|
||||||
|
|
||||||
|
class StringReaderTest extends TestCase
|
||||||
|
{
|
||||||
|
public function testReadFails(): void
|
||||||
|
{
|
||||||
|
$tempFile = (string) tempnam(sys_get_temp_dir(), 'phpMyAdmin_StringReaderTest');
|
||||||
|
$this->assertFileExists($tempFile);
|
||||||
|
$stringReader = new StringReader($tempFile);
|
||||||
|
unlink($tempFile);
|
||||||
|
$actual = $stringReader->read(-1, -1);
|
||||||
|
$this->assertSame('', $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testReadIntArray(): void
|
||||||
|
{
|
||||||
|
$tempFile = (string) tempnam(sys_get_temp_dir(), 'phpMyAdmin_StringReaderTest');
|
||||||
|
file_put_contents($tempFile, "\0\0\0\0\0\0\0\0\0\0\0\0");
|
||||||
|
$this->assertFileExists($tempFile);
|
||||||
|
$stringReader = new StringReader($tempFile);
|
||||||
|
unlink($tempFile);
|
||||||
|
$actual = $stringReader->readintarray('V', 2, 2);
|
||||||
|
$this->assertSame([
|
||||||
|
1 => 0,
|
||||||
|
2 => 0,
|
||||||
|
], $actual);
|
||||||
|
}
|
||||||
|
}
|
||||||
98
vendor/phpmyadmin/motranslator/tests/TranslatorTest.php
vendored
Normal file
98
vendor/phpmyadmin/motranslator/tests/TranslatorTest.php
vendored
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace PhpMyAdmin\MoTranslator\Tests;
|
||||||
|
|
||||||
|
use PhpMyAdmin\MoTranslator\Cache\CacheInterface;
|
||||||
|
use PhpMyAdmin\MoTranslator\Cache\InMemoryCache;
|
||||||
|
use PhpMyAdmin\MoTranslator\CacheException;
|
||||||
|
use PhpMyAdmin\MoTranslator\MoParser;
|
||||||
|
use PhpMyAdmin\MoTranslator\Translator;
|
||||||
|
use PHPUnit\Framework\MockObject\MockObject;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test for translator API
|
||||||
|
*/
|
||||||
|
class TranslatorTest extends TestCase
|
||||||
|
{
|
||||||
|
public function testConstructorWithFilenameParam(): void
|
||||||
|
{
|
||||||
|
$expected = 'Pole';
|
||||||
|
$translator = new Translator(__DIR__ . '/data/little.mo');
|
||||||
|
$actual = $translator->gettext('Column');
|
||||||
|
$this->assertSame($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testConstructorWithNullParam(): void
|
||||||
|
{
|
||||||
|
$expected = 'Column';
|
||||||
|
$translator = new Translator(null);
|
||||||
|
$actual = $translator->gettext($expected);
|
||||||
|
$this->assertSame($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test on empty gettext
|
||||||
|
*/
|
||||||
|
public function testGettext(): void
|
||||||
|
{
|
||||||
|
$translator = $this->getTranslator('');
|
||||||
|
$this->assertEquals('Test', $translator->gettext('Test'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test set a translation
|
||||||
|
*/
|
||||||
|
public function testSetTranslation(): void
|
||||||
|
{
|
||||||
|
$translator = $this->getTranslator('');
|
||||||
|
$translator->setTranslation('Test', 'Translation');
|
||||||
|
$this->assertEquals('Translation', $translator->gettext('Test'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test get and set all translations
|
||||||
|
*/
|
||||||
|
public function testGetSetTranslations(): void
|
||||||
|
{
|
||||||
|
$transTable = ['Test' => 'Translation'];
|
||||||
|
$translator = $this->getTranslator('');
|
||||||
|
$translator->setTranslations($transTable);
|
||||||
|
$this->assertEquals('Translation', $translator->gettext('Test'));
|
||||||
|
$this->assertSame($transTable, $translator->getTranslations());
|
||||||
|
$translator = $this->getTranslator(null);
|
||||||
|
$translator->setTranslations($transTable);
|
||||||
|
$this->assertSame($transTable, $translator->getTranslations());
|
||||||
|
$this->assertEquals('Translation', $translator->gettext('Test'));
|
||||||
|
$transTable = [
|
||||||
|
'Test' => 'Translation',
|
||||||
|
'shouldIWriteTests' => 'as much as possible',
|
||||||
|
'is it hard' => 'it depends',
|
||||||
|
];
|
||||||
|
$translator = $this->getTranslator('');
|
||||||
|
$translator->setTranslations($transTable);
|
||||||
|
$this->assertSame($transTable, $translator->getTranslations());
|
||||||
|
$this->assertEquals('as much as possible', $translator->gettext('shouldIWriteTests'));
|
||||||
|
$translator = $this->getTranslator(null);
|
||||||
|
$translator->setTranslations($transTable);
|
||||||
|
$this->assertSame($transTable, $translator->getTranslations());
|
||||||
|
$this->assertEquals('it depends', $translator->gettext('is it hard'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetTranslationsThrowsException(): void
|
||||||
|
{
|
||||||
|
/** @var CacheInterface&MockObject $cache */
|
||||||
|
$cache = $this->createMock(CacheInterface::class);
|
||||||
|
$translator = new Translator($cache);
|
||||||
|
|
||||||
|
$this->expectException(CacheException::class);
|
||||||
|
$translator->getTranslations();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getTranslator(?string $filename): Translator
|
||||||
|
{
|
||||||
|
return new Translator(new InMemoryCache(new MoParser($filename)));
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
vendor/phpmyadmin/motranslator/tests/data/big.mo
vendored
Normal file
BIN
vendor/phpmyadmin/motranslator/tests/data/big.mo
vendored
Normal file
Binary file not shown.
1
vendor/phpmyadmin/motranslator/tests/data/error/big.mo
vendored
Normal file
1
vendor/phpmyadmin/motranslator/tests/data/error/big.mo
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<EFBFBD><12>1111<31><31><EFBFBD><EFBFBD>
|
||||||
1
vendor/phpmyadmin/motranslator/tests/data/error/dos.mo
vendored
Normal file
1
vendor/phpmyadmin/motranslator/tests/data/error/dos.mo
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<EFBFBD><12>1111<31><7F><EFBFBD>
|
||||||
0
vendor/phpmyadmin/motranslator/tests/data/error/empty.mo
vendored
Normal file
0
vendor/phpmyadmin/motranslator/tests/data/error/empty.mo
vendored
Normal file
BIN
vendor/phpmyadmin/motranslator/tests/data/error/fpd.mo
vendored
Normal file
BIN
vendor/phpmyadmin/motranslator/tests/data/error/fpd.mo
vendored
Normal file
Binary file not shown.
1
vendor/phpmyadmin/motranslator/tests/data/error/fpdle.mo
vendored
Normal file
1
vendor/phpmyadmin/motranslator/tests/data/error/fpdle.mo
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<EFBFBD><04><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
1
vendor/phpmyadmin/motranslator/tests/data/error/magic.mo
vendored
Normal file
1
vendor/phpmyadmin/motranslator/tests/data/error/magic.mo
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
1234
|
||||||
BIN
vendor/phpmyadmin/motranslator/tests/data/invalid-formula.mo
vendored
Normal file
BIN
vendor/phpmyadmin/motranslator/tests/data/invalid-formula.mo
vendored
Normal file
Binary file not shown.
BIN
vendor/phpmyadmin/motranslator/tests/data/lessplurals.mo
vendored
Normal file
BIN
vendor/phpmyadmin/motranslator/tests/data/lessplurals.mo
vendored
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user