Handling of missing array indices added
This commit is contained in:
parent
25eacf6ccc
commit
fe1d222742
@ -184,18 +184,24 @@ class Plugin_PrettyURLs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handle_entry($matches) {
|
function handle_entry($matches) {
|
||||||
if (PRETTYURLS_TITLES) {
|
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 {
|
|
||||||
$this->fp_params ['entry'] = $matches [1];
|
$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';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user