Index: timthumb.php =================================================================== --- timthumb.php (revision 468863) +++ timthumb.php (working copy) @@ -20,7 +20,9 @@ a new version of timthumb. */ -define ('VERSION', '2.8'); // Version of this script +define ('VERSION', '2.8'); +define( 'ALLOW_ALL_EXTERNAL_SITES', true ); +// Version of this script //Load a config file if it exists. Otherwise, use the values below. if( file_exists('timthumb-config.php')) require_once('timthumb-config.php'); if(! defined( 'DEBUG_ON' ) ) define ('DEBUG_ON', false); // Enable debug logging to web server error log (STDERR) @@ -215,15 +217,23 @@ return false; exit(0); } + // Don't do this + /*( if(preg_match('/https?:\/\/(?:www\.)?' . $this->myHost . '(?:$|\/)/i', $this->src)){ $this->src = preg_replace('/https?:\/\/(?:www\.)?' . $this->myHost . '/i', '', $this->src); } + */ + if(preg_match('/^https?:\/\/[^\/]+/i', $this->src)){ $this->debug(2, "Is a request for an external URL: " . $this->src); $this->isURL = true; } else { $this->debug(2, "Is a request for an internal file: " . $this->src); } + + // Manually set isURL to true + $this->isURL = true; + if($this->isURL && (! ALLOW_EXTERNAL)){ $this->error("You are not allowed to fetch images from an external website."); return false; Index: cac-featured-content.php =================================================================== --- cac-featured-content.php (revision 468863) +++ cac-featured-content.php (working copy) @@ -441,6 +441,8 @@ $resource_title = $instance['resource_title']; $resource_image_source = $instance['resource_image_source']; + $this->instance = $instance; + /******************** *****Form Data****** *********************/ @@ -507,7 +509,10 @@ getBlogDomainField($blog_domain, true); ?> +
+ +

pluginDomain ) ?>

+ + instance; + + $media_upload_iframe_src = "media-upload.php?type=image&widget_id=".$this->id; //NOTE #1: the widget id is added here to allow uploader to only return array if this is used with image widget so that all other uploads are not harmed. + $image_upload_iframe_src = apply_filters('image_upload_iframe_src', "$media_upload_iframe_src"); + $image_title = __(($instance['image'] ? 'Change Image' : 'Add Image'), $this->pluginDomain); + + $image_markup = !empty( $instance['imageurl'] ) ? '' : ''; + + $out = '

'; + $out .= '
'; + $out .= '' . $image_title . '' . $image_title . ''; + + $out .= '

'; + $out .= $image_markup; + $out .= '
Remove image'; + $out .= '
'; + + $out .= '

'; + + $out .= $this->getResourceImageSourceField($instance['resource_image_source'], true); + $out .= $this->getImageCropRuleField($instance['image_crop_rule'], true); + + return $out; + } + function getCropLengthField($value, $pWrap = false) { $labelText = "Crop length: Please enter the length (in characters) that you want to crop text by:
"; $label = ''; @@ -827,8 +829,18 @@ if ( !$width = (int)$this->image_width ) $width = '100'; + + $imageurl = false; + if ( $this->imageurl ) { + $imageurl = $this->imageurl; + } elseif( $this->resource_image_source ) { + $imageurl = $this->resource_image_source; + } - $avatar = bp_core_fetch_avatar( array( 'item_id' => $author_id, 'type' => 'full', 'height' => $height , 'width' => $width, 'no_grav' => false ) ); + // Trimming escaped spaces + $imageurl = trim( $imageurl, ' ' ); + + $avatar = $imageurl ? $this->get_image_markup_from_url( $imageurl ) : bp_core_fetch_avatar( array( 'item_id' => $author_id, 'type' => 'full', 'height' => $height , 'width' => $width, 'no_grav' => false ) ); /************************* ******Switch Context****** @@ -853,7 +865,7 @@ ?>

- + @@ -899,13 +911,15 @@ if ( !empty( $src ) ) { $src = substr( substr( str_replace( 'src=', '', $src[1] ), 0, -1 ), 1 ); - $height = substr( substr( str_replace( 'height=', '', $height[1] ), 0, -1 ), 1 ); - $width = substr( substr( str_replace( 'width=', '', $width[1] ), 0, -1 ), 1 ); if ( empty( $width ) || empty( $height ) ) { $width = 100; $height = 100; + } else { + $height = substr( substr( str_replace( 'height=', '', $height[1] ), 0, -1 ), 1 ); + $width = substr( substr( str_replace( 'width=', '', $width[1] ), 0, -1 ), 1 ); } + // This was modified from the original so that the width gets set to whatever the user has selected in the plugin. if ( (int) $this->image_width ) { $ratio = (int)$height / (int)$width; @@ -955,10 +969,20 @@ $height = $this->image_height; } else { $height = '100'; - } + } - $avatar = apply_filters( 'cac_featured_content_blog_avatar', bp_core_fetch_avatar( array( 'item_id' => $blog_admin_id, 'type' => 'full', 'height' => $height, 'width' => $width, 'no_grav' => false ) ), $blog_id ); + $imageurl = false; + if ( $this->imageurl ) { + $imageurl = $this->imageurl; + } elseif( $this->resource_image_source ) { + $imageurl = $this->resource_image_source; + } + // Trimming escaped spaces + $imageurl = trim( $imageurl, ' ' ); + + $avatar = $imageurl ? $this->get_image_markup_from_url( $imageurl ) : apply_filters( 'cac_featured_content_blog_avatar', bp_core_fetch_avatar( array( 'item_id' => $blog_admin_id, 'type' => 'full', 'height' => $height, 'width' => $width, 'no_grav' => false ) ), $blog_id, $imageurl ); + switch_to_blog($blog_id); $posts = get_posts(); @@ -1124,5 +1148,21 @@
image_width ) { + $width = $this->image_width; + } else { + $width = '100'; + } + + if ( (int) $this->image_height ) { + $height = $this->image_height; + } else { + $height = '100'; + } + $out = ''; + return $out; + } } ?>