Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solved: 5 Years, 8 Months, 2 Weeks ago [How To?] change img tag to link in quote post
#2
Solved: 5 Years, 8 Months, 2 Weeks ago
i found solution

$message = preg_replace("#\[img\]([^<>\"']+?)\[/img\]#ise", "'Link imagem: \\1'", $message);

check for me if this plugin has or no security problem.

<?php

if(!defined("IN_MYBB"))
{
    die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

/**
 * Plugin info
 *
 */
function no_image_quote_info()
{
    return array(
                "name" => "no image quote",
                "description" => "",
                "website" => "",
                "author" => "",
                "authorsite" => "",
                "version" => "0.1",
                "guid" => "",
                "compatibility" => "16*"
            );
}

$plugins->add_hook('newreply_end', 'mystuff');
function mystuff()
{
    global $mybb, $message;

    if(isset($mybb->input['pid']))
{
        $message = preg_replace("#\[img\]([^<>\"']+?)\[/img\]#ise", "'[spoiler]=Imagem][img]\\1[/img][/spoiler]'", $message);
        $message = preg_replace("#\[youtube\]([^<>\"']+?)\[/youtube\]#ise", "'Link youtube: http://youtu.be/\\1'", $message);
        $message = preg_replace("#\[dailymotion\]([^<>\"']+?)\[/dailymotion\]#ise", "'Link dailymotion: http://www.dailymotion.com/video/\\1'", $message);
        $message = preg_replace("#\[vimeo\]([^<>\"']+?)\[/vimeo\]#ise", "'Link vimeo: http://vimeo.com/\\1'", $message);
}}

$plugins->add_hook('xmlhttp', 'no_image_quote_do');

function no_image_quote_do()
{
    global $mybb;
    if($mybb->input['action'] != 'get_multiquoted') return;
    ob_start();
    
    function no_image_quote_do_shutdown()
    {
        global $message;
        if(!$message)
        {
            ob_end_flush();
            return;
        }
        
        ob_end_clean();
        $message = preg_replace("#\[img\]([^<>\"']+?)\[/img\]#ise", "'[spoiler]=Imagem][img]\\1[/img][/spoiler]'", $message);
        $message = preg_replace("#\[youtube\]([^<>\"']+?)\[/youtube\]#ise", "'Link youtube: http://youtu.be/\\1'", $message);
        $message = preg_replace("#\[dailymotion\]([^<>\"']+?)\[/dailymotion\]#ise", "'Link dailymotion: http://www.dailymotion.com/video/\\1'", $message);
        $message = preg_replace("#\[vimeo\]([^<>\"']+?)\[/vimeo\]#ise", "'Link vimeo: http://vimeo.com/\\1'", $message);
        echo $message;
    }
    register_shutdown_function('no_image_quote_do_shutdown');
} 
?>


Messages In This Thread
change img tag to link in quote post - by martec - 2012-02-11, 05:16 PM
RE: change img tag to link in quote post - by martec - 2012-02-14, 11:29 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)