Skip to content

Commit

Permalink
Fixed Block filtering in 1.3.5/6
Browse files Browse the repository at this point in the history
| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| Refs tickets  | #516, #938
| License       | MIT
| Doc PR        |
  • Loading branch information
rallek committed Feb 12, 2014
1 parent 3d081c9 commit 6715748
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/lib/util/BlockUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ public static function displayPosition($side, $echo = true, $implode = true)
}

if (!isset($modname)) {
$modname = FormUtil::getPassedValue('module', '_homepage_', 'GETPOST', FILTER_SANITIZE_STRING);
if (PageUtil::isHomepage()) {
$modname = '_homepage_';
} else {
$modname = ModUtil::getName();
}
}

// get all block placements
Expand Down Expand Up @@ -119,9 +123,9 @@ public static function displayPosition($side, $echo = true, $implode = true)
continue;
}

$rule1 = $filter['module'] == $modname;
$rule2 = empty($filter['ftype']) ? true : ($filter['ftype'] == $type);
$rule3 = empty($filter['fname']) ? true : ($filter['fname'] == $func);
$rule1 = strtolower($filter['module']) == strtolower($modname);
$rule2 = empty($filter['ftype']) ? true : (strtolower($filter['ftype']) == strtolower($type));
$rule3 = empty($filter['fname']) ? true : (strtolower($filter['fname']) == strtolower($func));

if (empty($filter['fargs'])) {
$rule4 = true;
Expand Down
14 changes: 14 additions & 0 deletions src/lib/util/PageUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,5 +346,19 @@ public static function addVar($varname, $value)

return true;
}
/**
* Check if the current page is the homepage.
*
* @return boolean true If it is the homepage, false if it is not the homepage.
*/
public static function isHomepage()
{
$moduleGetName = FormUtil::getPassedValue('module', null, 'GETPOST', FILTER_SANITIZE_STRING);
if (empty($moduleGetName)) {
return true;
} else {
return false;
}
}

}

0 comments on commit 6715748

Please sign in to comment.