diff --git a/fp-plugins/prettyurls/plugin.prettyurls.php b/fp-plugins/prettyurls/plugin.prettyurls.php index 2b5b8a3..f363ae6 100644 --- a/fp-plugins/prettyurls/plugin.prettyurls.php +++ b/fp-plugins/prettyurls/plugin.prettyurls.php @@ -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'; } }