case-sensitivity in find_xchan_in_array()

This commit is contained in:
Mike Macgirvin 2024-08-24 08:50:48 +10:00
parent afe23fbbc7
commit 0e6e12305e
3 changed files with 3 additions and 30 deletions

View file

@ -4790,7 +4790,7 @@ function list_attached_local_files($body) {
function fix_attached_permissions($uid,$body,$str_contact_allow,$str_group_allow,$str_contact_deny,$str_group_deny,$token = EMPTY_STR) {
$channel = Channel::from_id($uid);
$files = list_attached_local_files($body);
if (! $files) {
return;

View file

@ -2739,35 +2739,11 @@ function xchan_query(&$items, $abook = true, $effective_uid = 0)
}
}
function xchan_mail_query(&$item)
{
$arr = [];
$chans = null;
if ($item) {
if ($item['from_xchan'] && (! in_array("'" . dbesc($item['from_xchan']) . "'", $arr))) {
$arr[] = "'" . dbesc($item['from_xchan']) . "'";
}
if ($item['to_xchan'] && (! in_array("'" . dbesc($item['to_xchan']) . "'", $arr))) {
$arr[] = "'" . dbesc($item['to_xchan']) . "'";
}
}
if (count($arr)) {
$chans = q("select xchan.*,hubloc.* from xchan left join hubloc on hubloc_hash = xchan_hash
where xchan_hash in (" . protect_sprintf(implode(',', $arr)) . ") and hubloc_primary = 1 and hubloc_deleted = 0");
}
if ($chans) {
$item['from'] = find_xchan_in_array($item['from_xchan'], $chans);
$item['to'] = find_xchan_in_array($item['to_xchan'], $chans);
}
}
function find_xchan_in_array($xchan, $arr)
{
if (count($arr)) {
foreach ($arr as $x) {
if ($x['xchan_hash'] === $xchan) {
if (strtolower($x['xchan_hash']) === strtolower($xchan)) {
return $x;
}
}

View file

@ -26,10 +26,7 @@ class Poller implements DaemonInterface
}
}
$interval = intval(get_config('system', 'poll_interval'));
if (! $interval) {
$interval = ((get_config('system', 'delivery_interval') === false) ? 3 : intval(get_config('system', 'delivery_interval')));
}
$interval = intval(get_config('system', 'poll_interval', 3));
// Check for a lockfile. If it exists, but is over an hour old, it's stale. Ignore it.
$lockfile = 'cache/poller';