MyBB Community Forums

Full Version: force image url to use https
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Oh i didn't figured out that it can be deloyed with heroku, i was unawared about that term
(2014-11-15, 12:38 PM)Cameron:D Wrote: [ -> ]That won't work for everything though, not all sites will support https which is why you need to run a proxy.

for me ok because i limited allowed image host that users can use. And for me better limit, so users can't make hotlink or use bad image host (delete image soon)

$plugins->add_hook('datahandler_post_validate_thread', 'imagemdomain');
$plugins->add_hook('datahandler_post_validate_post', 'imagemdomain');
function imagemdomain()
{
    global $post, $message, $mybb;
 
 $mes_test = $mybb->get_input('message');

 if (isset($message)) {
 $mes_test = $message;
 }

 $acepserver = 'i.imgur.com|.media.tumblr.com|i.minus.com|tapatalk.imageshack.com';

 preg_match_all("/\[img(.*?)\](.*?)\[\/img\]/i", $mes_test, $matches, PREG_SET_ORDER);

 $ext = 0;

 foreach ($matches as $ex)
 {
        if (!preg_match("/(".$acepserver.")/i", $ex[2])) {
 $ext += 1;
 }
 }

 if ($ext > 0) {
 error("A mensagem contém imagem de domínio não autorizado.");
 return false;
 }
}
(2014-11-17, 05:36 AM)martec Wrote: [ -> ]
(2014-11-15, 12:38 PM)Cameron:D Wrote: [ -> ]That won't work for everything though, not all sites will support https which is why you need to run a proxy.

for me ok because i limited allowed image host that users can use. And for me better limit, so users can't make hotlink or use bad image host (delete image soon)

$plugins->add_hook('datahandler_post_validate_thread', 'imagemdomain');
$plugins->add_hook('datahandler_post_validate_post', 'imagemdomain');
function imagemdomain()
{
    global $post, $message, $mybb;
 
 $mes_test = $mybb->get_input('message');

 if (isset($message)) {
 $mes_test = $message;
 }

 $acepserver = 'i.imgur.com|.media.tumblr.com|i.minus.com|tapatalk.imageshack.com';

 preg_match_all("/\[img(.*?)\](.*?)\[\/img\]/i", $mes_test, $matches, PREG_SET_ORDER);

 $ext = 0;

 foreach ($matches as $ex)
 {
        if (!preg_match("/(".$acepserver.")/i", $ex[2])) {
 $ext += 1;
 }
 }

 if ($ext > 0) {
 error("A mensagem contém imagem de domínio não autorizado.");
 return false;
 }
}

for mybb 1.8 how you use this as a plugin ?
nevermind i quit for this
Pages: 1 2