From 1f5c7a6bb5646cb3b711eb079ce0e77794c0e57d Mon Sep 17 00:00:00 2001 From: real_nowhereman Date: Fri, 6 Feb 2009 20:08:25 +0000 Subject: [PATCH] division by zero in remote resizes, restore non-overridable addCode - there is already removeCode for that --- fp-plugins/bbcode/inc/stringparser_bbcode.class.php | 3 --- fp-plugins/bbcode/plugin.bbcode.php | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/fp-plugins/bbcode/inc/stringparser_bbcode.class.php b/fp-plugins/bbcode/inc/stringparser_bbcode.class.php index f1b4db8..549ab61 100755 --- a/fp-plugins/bbcode/inc/stringparser_bbcode.class.php +++ b/fp-plugins/bbcode/inc/stringparser_bbcode.class.php @@ -156,12 +156,9 @@ class StringParser_BBCode extends StringParser { * @return bool */ function addCode ($name, $callback_type, $callback_func, $callback_params, $content_type, $allowed_within, $not_allowed_within) { - // allow override - /* if (isset ($this->_codes[$name])) { return false; // already exists } - */ if (!preg_match ('/^[a-zA-Z0-9*_!+-]+$/', $name, $code)) { return false; // invalid } diff --git a/fp-plugins/bbcode/plugin.bbcode.php b/fp-plugins/bbcode/plugin.bbcode.php index 7eafacd..4cbfab1 100644 --- a/fp-plugins/bbcode/plugin.bbcode.php +++ b/fp-plugins/bbcode/plugin.bbcode.php @@ -210,12 +210,12 @@ function do_bbcode_img ($action, $attributes, $content, $params, $node_object) { $height = (int)$attributes['height']; // if width or height are set we calc proportions }elseif (isset($attributes['width'])) { - $scalefact = ($attributes['width'] / $orig_w); + $scalefact = $orig_w? ($attributes['width'] / $orig_w) : 0; $width = (int) $attributes['width']; $height = (int) ($scalefact*$orig_h); }elseif (isset($attributes['height'])) { - $scalefact = ($attributes['height'] / $orig_h); + $scalefact = $orig_w? ($attributes['height'] / $orig_h) : 0; $height = (int) $attributes['height']; $width = (int) ($scalefact*$orig_w); }