From: Sem Date: Thu, 15 Nov 2012 00:16:42 +0000 (+0100) Subject: Refs #4904. Checking if page has segments before using them. X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=4f01b88b9fc1fe476189d53df7a34303502ba17e;p=lorea%2Felgg.git Refs #4904. Checking if page has segments before using them. --- diff --git a/mod/blog/lib/blog.php b/mod/blog/lib/blog.php index 1ccfe4dc4..4dcc7d56e 100644 --- a/mod/blog/lib/blog.php +++ b/mod/blog/lib/blog.php @@ -411,8 +411,8 @@ function blog_url_forwarder($page) { global $CONFIG; // group usernames - if (substr_count("$page[0]/$page[1]", 'group:')) { - preg_match('/group\:([0-9]+)/i', "$page[0]/$page[1]", $matches); + if (substr_count(implode('/', $page), 'group:')) { + preg_match('/group\:([0-9]+)/i', implode('/', $page), $matches); $guid = $matches[1]; $entity = get_entity($guid); if ($entity) { @@ -426,6 +426,10 @@ function blog_url_forwarder($page) { } } + if (!isset($page[0])) { + return; + } + // user usernames $user = get_user_by_username($page[0]); if (!$user) {