MyBB Community Forums

Full Version: change img tag to link in quote post
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi...

i want change img tag to link in quote post its possible? Too change video tag to link in quote post?

if possible in the direct modification of system files.

thanks


i found solution

using this

http://community.mybb.com/thread-87961-p...#pid643415

and using this to ajax quot

http://community.mybb.com/thread-35320-p...#pid237049

But...

this work

 $message = preg_replace("#\[img\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#ise", "", $message);

and this not work

$message = preg_replace("#\[img\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#ise", "\(Image: $2)\n", $message);

for me se put \(Image: $2)\n stop to work

help me fix this
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');
} 
?>
Hi martec
will this code work in 1.8?

i decided to upload it to my site and see that if it works and sadly it don't change the image in quote into link or even remove it.