diff options
author | RaindropsSys <contact@minteck.org> | 2023-05-27 17:44:38 +0200 |
---|---|---|
committer | RaindropsSys <contact@minteck.org> | 2023-05-27 17:44:38 +0200 |
commit | f90bff2e7e6ecae78c786f22dd63a895e2c3d6ee (patch) | |
tree | 80302ace9a43d718af0ae07c36344de9563aa84c /home | |
parent | 752e3f98142b191b77ec58ac85c7a9aacf64eb11 (diff) | |
download | delta-f90bff2e7e6ecae78c786f22dd63a895e2c3d6ee.tar.gz delta-f90bff2e7e6ecae78c786f22dd63a895e2c3d6ee.tar.bz2 delta-f90bff2e7e6ecae78c786f22dd63a895e2c3d6ee.zip |
Updated 7 files (automated)
Diffstat (limited to 'home')
-rw-r--r-- | home/family.php | 2 | ||||
-rw-r--r-- | home/history.php | 25 |
2 files changed, 23 insertions, 4 deletions
diff --git a/home/family.php b/home/family.php index cce4fcb..d431218 100644 --- a/home/family.php +++ b/home/family.php @@ -7,7 +7,7 @@ global $_PROFILE; global $_USER; ?> -<?php $results = array_values(array_filter(search($_PROFILE["first_name"] . " " . $_PROFILE["last_name"], true, true), function ($i) use ($_PROFILE) { return str_ends_with($i["value"]["name"], " " . $_PROFILE["last_name"]); })); if (count($results)): ?> +<?php $results = array_values(array_filter(findRelated($_USER), function ($i) use ($_PROFILE) { return str_ends_with($i["value"]["name"], " " . $_PROFILE["last_name"]); })); if (count($results)): ?> <h3 style="margin-bottom: 15px; margin-top: 30px;"><?= l("lang_home_family") ?></h3> <div class="list-group"> <?php $index = 0; foreach ($results as $entry): if ($index <= 4): ?> diff --git a/home/history.php b/home/history.php index 0f96858..534e4db 100644 --- a/home/history.php +++ b/home/history.php @@ -9,7 +9,26 @@ global $_PROFILE; global $_USER; <?php if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/history/" . $_USER . ".json")): - $history = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/history/" . $_USER . ".json")), true); + $history = array_filter(json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/history/" . $_USER . ".json")), true), function ($i) { + global $_PROFILE; + global $_USER; + + if (getFileFromId($i) === null) { + return false; + } + + $personData = json_decode(file_get_contents(getFileFromId($i)), true); + + if ($personData["first_name"] === $_PROFILE["first_name"] && $personData["last_name"] === $_PROFILE["last_name"]) { + return false; + } + + if ($i === $_USER) { + return false; + } + + return true; + }, ARRAY_FILTER_USE_KEY); if (count(array_keys($history)) > 0): @@ -17,12 +36,12 @@ global $_PROFILE; global $_USER; $top = array_keys($history)[rand(0, count($history) >= 3 ? 2 : count($history) - 1)]; $topName = getNameFromId($top); - if (count(search($topName, true)) > 0): + if (count(findRelated($top)) > 0): ?> <h3 style="margin-bottom: 15px; margin-top: 30px;"><?= str_replace("%1", $topName, l("lang_home_because")) ?></h3> <div class="list-group"> - <?php $index = 0; foreach (search($topName, true) as $entry): if ($index <= 4): ?> + <?php $index = 0; foreach (findRelated($top) as $entry): if ($index <= 4): ?> <a href="<?= $entry["value"]["url"] ?>" class="list-group-item-action list-group-item"> <p style="margin-bottom:.5rem;"> <img class="icon" src="/icons/<?= $entry["value"]["type"] ?>.svg" style="margin-right:5px;"><b style="vertical-align: middle;"><?= $entry["value"]["name"] ?></b> |