Cleaning up

This commit is contained in:
Dan 2025-01-27 07:58:10 +07:00
commit 5804cbcdd7
7 changed files with 28 additions and 28 deletions

View file

@ -1325,16 +1325,16 @@ function get_keyword($keyword, $page, $perpage)
foreach ($posts as $index => $v) {
$filepath = $v['dirname'] . '/' . $v['basename'];
$filepath = $v['dirname'] . '/' . $v['basename'];
$findRxWhole = '\b' . preg_quote($keyword, '~') . '\b'; // Add word boundaries (find whole-words only)
$findRxWhole = '\b' . preg_quote($keyword, '~') . '\b'; // Add word boundaries (find whole-words only)
$findRx = "~{$findRxWhole}~iu"; // Case-insensitive and UTF-8 mode
$findRx = "~{$findRxWhole}~iu"; // Case-insensitive and UTF-8 mode
$lines = file($filepath);
$lines = file($filepath);
foreach ($lines as $line) {
if (preg_match ($findRx, $line)) {
if (preg_match ($findRx, $line)) {
if (!in_array($v, $tmp)) {
$tmp[] = $v;
}
@ -1519,21 +1519,21 @@ function keyword_count($keyword)
foreach ($posts as $index => $v) {
$filepath = $v['dirname'] . '/' . $v['basename'];
$filepath = $v['dirname'] . '/' . $v['basename'];
$findRxWhole = '\b' . preg_quote($keyword, '~') . '\b'; // Add word boundaries (find whole-words only)
$findRxWhole = '\b' . preg_quote($keyword, '~') . '\b'; // Add word boundaries (find whole-words only)
$findRx = "~{$findRxWhole}~iu"; // Case-insensitive and UTF-8 mode
$findRx = "~{$findRxWhole}~iu"; // Case-insensitive and UTF-8 mode
$lines = file($filepath);
$lines = file($filepath);
foreach ($lines as $line) {
if (preg_match ($findRx, $line)) {
if (!in_array($v, $tmp)) {
$tmp[] = $v;
}
}
}
foreach ($lines as $line) {
if (preg_match ($findRx, $line)) {
if (!in_array($v, $tmp)) {
$tmp[] = $v;
}
}
}
}
$tmp = array_unique($tmp, SORT_REGULAR);

View file

@ -18,7 +18,7 @@ function login()
}
}
if (rtrim($_SERVER['REQUEST_URI'], '/') != rtrim(site_path() . '/login-mfa', '/')) {
if (rtrim($_SERVER['REQUEST_URI'], '/') != site_path() . '/login-mfa') {
if (isset($_SESSION['mfa_pwd']) && isset($_SESSION['mfa_uid'])) {
unset($_SESSION['mfa_pwd']);
unset($_SESSION['mfa_uid']);