From b7114a142eabacb3674642f2dbcc49675eaebacc Mon Sep 17 00:00:00 2001 From: William Crandell Date: Mon, 26 Oct 2015 09:20:09 -0400 Subject: [PATCH] Hotfix for better block id character filtering --- core/block.class.php | 5 ++--- ext/blotter/theme.php | 11 +++++------ themes/material/layout.class.php | 3 +-- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/core/block.class.php b/core/block.class.php index afdb23db..1fbe0e3f 100644 --- a/core/block.class.php +++ b/core/block.class.php @@ -20,7 +20,7 @@ class Block { */ public $body; - /** + /** * Where the block should be placed. The default theme supports * "main" and "left", other themes can add their own areas. * @@ -58,7 +58,7 @@ class Block { $this->body = $body; $this->section = $section; $this->position = $position; - $this->id = str_replace(' ', '_', is_null($id) ? (is_null($header) ? md5($body) : $header) . $section : $id); + $this->id = preg_replace('/[^\w]/', '',str_replace(' ', '_', is_null($id) ? (is_null($header) ? md5($body) : $header) . $section : $id)); } /** @@ -94,4 +94,3 @@ class NavBlock extends Block { parent::__construct("Navigation", "Index", "left", 0); } } - diff --git a/ext/blotter/theme.php b/ext/blotter/theme.php index 27987687..ba274cf8 100644 --- a/ext/blotter/theme.php +++ b/ext/blotter/theme.php @@ -62,7 +62,7 @@ class BlotterTheme extends Themelet { if($entries[$i]['important'] == 'Y') { $important = 'Y'; } else { $important = 'N'; } // Add the new table row(s) - $table_rows .= + $table_rows .= " $entry_date $entry_text @@ -114,7 +114,7 @@ class BlotterTheme extends Themelet { $i_open = ""; $i_close=""; } - $html .= "{$i_open}{$clean_date} - {$entry_text}{$i_close}

"; + $html .= "{$i_open}{$clean_date} - {$entry_text}{$i_close}

"; } $html .= ""; return $html; @@ -139,9 +139,9 @@ class BlotterTheme extends Themelet { $entry_text = $entries[$i]['entry_text']; if($entries[$i]['important'] == 'Y') { $i_open = ""; - $i_close=""; + $i_close=""; } - $entries_list .= "
  • {$i_open}{$clean_date} - {$entry_text}{$i_close}
  • "; + $entries_list .= "
  • {$i_open}{$clean_date} - {$entry_text}{$i_close}
  • "; } $pos_break = ""; @@ -149,7 +149,7 @@ class BlotterTheme extends Themelet { if($position === "left") { $pos_break = "
    "; - $pos_align = ""; + $pos_align = ""; } if(count($entries) === 0) { @@ -176,4 +176,3 @@ class BlotterTheme extends Themelet { return $html; } } - diff --git a/themes/material/layout.class.php b/themes/material/layout.class.php index defac581..5d88d965 100644 --- a/themes/material/layout.class.php +++ b/themes/material/layout.class.php @@ -233,8 +233,7 @@ EOD; public function get_html(Block $block, $section="main", $hidable=false, $extra_class="") { $h = $block->header; $b = $block->body; - $i = $block->id; - $i = preg_replace('/[^\w-]/', '', $i);//blotter extention id has `!` + $i = $block->id;//blotter extention id has `!` if($section == "toolbar"){ $html = "
    \n