Handling of missing array indices added

This commit is contained in:
azett 2021-02-24 18:41:13 +01:00
parent 25eacf6ccc
commit fe1d222742

View File

@ -184,18 +184,24 @@ class Plugin_PrettyURLs {
}
function handle_entry($matches) {
if (PRETTYURLS_TITLES) {
// isset($this->index[
if ($this->cache_get($this->fp_params ['y'], $this->fp_params ['m'], $this->fp_params ['d'], md5($matches [1]))) {
$this->fp_params ['entry'] = $this->index [$this->fp_params ['y']] [$this->fp_params ['m']] [$this->fp_params ['d']] [md5($matches [1])];
} else {
// a bit hackish: we make up a fake url when there is no match,
// so that at the higher level the system will 404...
$this->fp_params ['entry'] = 'a';
}
} else {
if (!PRETTYURLS_TITLES) {
$this->fp_params ['entry'] = $matches [1];
return;
}
// data is not as expected
if (!array_karray_key_exists('y', $this->fp_params) || !array_karray_key_exists('m', $this->fp_params) || !array_karray_key_exists('d', $this->fp_params)) {
// a bit hackish: we make up a fake url when there is no match,
// so that at the higher level the system will 404...
$this->fp_params ['entry'] = 'a';
}
if ($this->cache_get($this->fp_params ['y'], $this->fp_params ['m'], $this->fp_params ['d'], md5($matches [1]))) {
$this->fp_params ['entry'] = $this->index [$this->fp_params ['y']] [$this->fp_params ['m']] [$this->fp_params ['d']] [md5($matches [1])];
} else {
// a bit hackish: we make up a fake url when there is no match,
// so that at the higher level the system will 404...
$this->fp_params ['entry'] = 'a';
}
}