division by zero in remote resizes, restore non-overridable addCode - there is already removeCode for that
This commit is contained in:
		
							parent
							
								
									18ff5adc7d
								
							
						
					
					
						commit
						1f5c7a6bb5
					
				@ -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
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user