2014-11-16, 04:38 AM
Pages: 1 2
2014-11-17, 05:36 AM
(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;
}
}
2016-02-25, 08:18 AM
(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 ?
2016-02-28, 12:48 PM
nevermind i quit for this
Pages: 1 2