aboutsummaryrefslogtreecommitdiff
path: root/app/genealogy/search/state/data.json/index.php
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-04-12 13:47:55 +0200
committerMinteck <contact@minteck.org>2022-04-12 13:47:55 +0200
commit6c877fecb5374905d3f49663c68c20416a847e0e (patch)
tree7dbe6e17282136a958890756926d53640a5739dd /app/genealogy/search/state/data.json/index.php
parent9ce80dea90a6159496f1fe2448f8ecf0e1633e7c (diff)
downloadcore-6c877fecb5374905d3f49663c68c20416a847e0e.tar.gz
core-6c877fecb5374905d3f49663c68c20416a847e0e.tar.bz2
core-6c877fecb5374905d3f49663c68c20416a847e0e.zip
Commit
Diffstat (limited to 'app/genealogy/search/state/data.json/index.php')
-rw-r--r--app/genealogy/search/state/data.json/index.php39
1 files changed, 0 insertions, 39 deletions
diff --git a/app/genealogy/search/state/data.json/index.php b/app/genealogy/search/state/data.json/index.php
deleted file mode 100644
index e0bad67..0000000
--- a/app/genealogy/search/state/data.json/index.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/../session.php";
-
-/** @var string $_FULLNAME
- * @var string $_USER
- * @var array $_PROFILE
- * @var array $_CONFIG
- */
-
-$data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/private/data/people.json"), true);
-
-header("Content-Type: application/json");
-
-$arr = [];
-$names = [];
-$counts = [];
-
-foreach ($data as $id => $person) {
- if (isset($person["birth"]["place"]) && isset($person["birth"]["place"]["state"])) {
- if (isset($counts[$person["birth"]["place"]["state"]])) {
- $counts[$person["birth"]["place"]["state"]]++;
- } else {
- $counts[$person["birth"]["place"]["state"]] = 1;
- }
- if (!in_array($person["birth"]["place"]["state"], $names)) {
- $names[] = $person["birth"]["place"]["state"];
- }
- }
-}
-
-foreach ($names as $name) {
- $arr[] = [
- 'name' => $name,
- 'occurrences' => $counts[$name] . " personne" . ($counts[$name] > 1 ? "s" : "")
- ];
-}
-
-echo(json_encode($arr)); \ No newline at end of file