Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons

Reply
 
Thread Tools
IMG Cacher - SSL Keeper - Mixed Content Block Solution Details »»
IMG Cacher - SSL Keeper - Mixed Content Block Solution
Version: 2.2, by MegaManSec MegaManSec is offline
Developer Last Online: Dec 2016 Show Printable Version Email this Page

Category: Mini Mods - Version: 4.1.x Rating:
Released: 09-19-2012 Last Update: 10-29-2013 Installs: 96
Uses Plugins Template Edits
Re-useable Code Additional Files Translations  
No support by the author.

Pretty much you use this when you want to keep the SSL certificete working on pages that people may use [IMG] tag's without https://.

When you use SSL on your forum, and somebody embeds an image from a non-ssl host, lots of browsers will give you a warning and say the website is unsafe ---this is a solution to that problem.

Specifically, Mozilla has a 'Mixed Content Blocker', which makes it so if you are on an https:// website, it won't load any content on the same domain, using http://.



NOTE: MAKE SURE THE .HTACCESS FILE IN cache-img/ IS WORKING!



Upload the files into your root directory, and that's it.

Then you need to create a plugin (admincp -> plugins & products -> add new plugin)
Hook location: bbcode_img_match
Title: SSL IMG Cacher
Execution order: 5
Plugin PHP Code:
Code:
$link_parsed = parse_url($link);
if ($link_parsed['host'] != '[LINK_TO_YOUR_WEBSITE]')
{
 $link = $this->registry->options['bburl'] . '/cache.php?img=' . urlencode($link);
 $retval = ($fullsize ? '<div class="size_fullsize">' : '')  . '<img src="' .  $link . '" border="0" alt="" />' . ($fullsize ? '</div>' : '');
}
Plugin is active: Yes


edit "[LINK_TO_YOUR_WEBSITE]" - Without http, example: www.dragonbyte-tech.com or www.internot.info etc. etc.

Then you are done.

It should be secure as the actual directory for the images is not available.(deny from all in htaccess)


I would also suggest adding this to robots.txt
Code:
User-agent: *
Disallow: /cache.php
Also I suggest you add something like this to .htaccess:
Code:
<FilesMatch "cache\.php$">
Header set Cache-Control "max-age=86400, public"
</FilesMatch>
======
I only give support to people who have pressed 'installed' this.
======


Source&stuff can be found here: https://github.com/MegaManSec/IMG

For vB3.8 solution, go here: https://vborg.vbsupport.ru/showthrea...75#post2411575 (Thanks to Kh99)

Download Now

File Type: zip IMG.zip (8.6 KB, 536 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
4 благодарности(ей) от:
Andreasmax, Duke49th, seb5594, VBFguy

Comments
  #32  
Old 12-01-2016, 06:47 PM
RichieBoy67's Avatar
RichieBoy67 RichieBoy67 is offline
 
Join Date: Apr 2004
Location: CT - Down in a hole..
Posts: 3,057
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Kane@airrifle View Post
Sorted out the url problem. (SQL search and replace).

But, found a new issue. Whenever a poster edits a post in WYSIWYG mode all the image urls are saved with the cacher paths rather than the original image urls.

?
Is this addressed?
Reply With Quote
  #33  
Old 12-01-2016, 08:04 PM
Kane@airrifle's Avatar
Kane@airrifle Kane@airrifle is offline
 
Join Date: Jun 2011
Location: ZA
Posts: 181
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by RichieBoy67 View Post
Is this addressed?
Did not work out for me so I went with this instead: https://vborg.vbsupport.ru/showthread.php?t=253309
Reply With Quote
  #34  
Old 01-02-2017, 02:44 PM
tuRiver's Avatar
tuRiver tuRiver is offline
 
Join Date: Mar 2009
Location: BA
Posts: 57
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi, any ideas?
Facebook images are not working

https://www.turiver.com/foros/cache....Boe%3D58E2D4A8
Reply With Quote
  #35  
Old 01-02-2017, 02:53 PM
tuRiver's Avatar
tuRiver tuRiver is offline
 
Join Date: Mar 2009
Location: BA
Posts: 57
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've made a little change, to avoid caching SSLs images.
----
$link_parsed = parse_url($link);
if ($link_parsed['scheme'] != 'https')
{
$link = $this->registry->options['bburl'] . '/cache.php?img=' . urlencode($link);
$retval = ($fullsize ? '<div class="size_fullsize">' : '') . '<img src="' . $link . '" border="0" alt="" />' . ($fullsize ? '</div>' : '');
}
----
Reply With Quote
  #36  
Old 01-06-2017, 05:49 PM
kylek kylek is offline
 
Join Date: Oct 2003
Location: British Columbia, Canada
Posts: 798
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by hakkuo23 View Post
Here is a version that just displays the image, and doesn't save it, to save server space

PHP Code:
<?phpfunction curlHeaderCallback($query, $header){    global $mime;    if(stripos($header, "content-type")!==false){        header(trim($header));    }    return strlen($header); }$image = $_GET['img'];$query = curl_init($image);curl_setopt($query, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9");curl_setopt($query, CURLOPT_CONNECTTIMEOUT ,0);curl_setopt($query, CURLOPT_TIMEOUT, 10);curl_setopt($query, CURLOPT_HEADERFUNCTION, 'curlHeaderCallback'); curl_setopt($query, CURLOPT_RETURNTRANSFER, 1);$ret = curl_exec($query);echo $ret;
Really need this, can you tell us what to do with this?
Reply With Quote
  #37  
Old 01-13-2017, 09:44 AM
Stratis's Avatar
Stratis Stratis is offline
 
Join Date: Jan 2010
Posts: 738
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Uninstalled, it has effect in domain upload center... [IMG] images with the forum domain. It would be nice if it had an option of whitelist.

Any way thanks
Reply With Quote
  #38  
Old 01-17-2017, 12:34 PM
DSemen DSemen is offline
 
Join Date: Sep 2010
Posts: 44
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by hakkuo23 View Post
Here is a version that just displays the image, and doesn't save it, to save server space

PHP Code:
<?php

function curlHeaderCallback($query$header){
    global 
$mime;
    if(
stripos($header"content-type")!==false){
        
header(trim($header));
    }
    return 
strlen($header); 
}

$image $_GET['img'];

$query curl_init($image);
curl_setopt($queryCURLOPT_USERAGENT"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9");
curl_setopt($queryCURLOPT_CONNECTTIMEOUT ,0);
curl_setopt($queryCURLOPT_TIMEOUT10);
curl_setopt($queryCURLOPT_HEADERFUNCTION'curlHeaderCallback'); 
curl_setopt($queryCURLOPT_RETURNTRANSFER1);
$ret curl_exec($query);
echo 
$ret;
Please tell me how to install it correctly.
Reply With Quote
  #39  
Old 01-22-2017, 03:58 PM
adnedarn adnedarn is offline
 
Join Date: Jan 2007
Location: Tucson, Arizona
Posts: 192
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

For the "[LINK_TO_YOUR_WEBSITE]" part, does it matter if I put www.terraforums.com or www.terraforums.com/forums ? I didn't do the suggested edits to .htaccess or .robots yet since my testing is showing that images are being removed (which shows the page secured) but not replaced by images saved to my server.
Thanks,
Andrew
Reply With Quote
  #40  
Old 01-22-2017, 04:51 PM
Dave Dave is offline
 
Join Date: May 2010
Posts: 2,583
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by adnedarn View Post
For the "[LINK_TO_YOUR_WEBSITE]" part, does it matter if I put www.terraforums.com or www.terraforums.com/forums ? I didn't do the suggested edits to .htaccess or .robots yet since my testing is showing that images are being removed (which shows the page secured) but not replaced by images saved to my server.
Thanks,
Andrew
It would be www.terraforums.com.
Reply With Quote
  #41  
Old 01-24-2017, 01:33 AM
adnedarn adnedarn is offline
 
Join Date: Jan 2007
Location: Tucson, Arizona
Posts: 192
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Dave! Any idea why I'm just getting all the images removed? The page is secure after, but no images so that doesn't help much.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:07 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.08938 seconds
  • Memory Usage 2,354KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_code
  • (2)bbcode_php
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (4)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete