Skip to content
WJunction - Webmaster Forum

anonym links in mybb

Status
Not open for further replies.
here you go:
PHP:
<?php
$plugins->add_hook("parse_message", "anonymurl_run");
function anonymurl_info()
{
    return array(
        "name"        => "AnonymURL",
        "description"    => "Anonym Links in all Topics",
        "website"        => "http://redirectincognito.com",
        "author"        => "",
        "authorsite"    => "",
        "version"        => "1.0",
    );
}
function anonymurl_activate()
{
}
function anonymurl_deactivate()
{
}
function anonymurl_run($message)
{
    if (preg_match_all("/(\<a href=\")(.[^\"]*)/i", $message, $matches))
    {
        $preg_search = array();
        $preg_replace = array();

        //If you leave this setting blank, the value for myBB Settings Cookie Domain will be used.
        //Use all the values separated by space
        //example
        //$ignore_these = "domain.com www.domain.com";
        $ignore_these = "";
        $should_force = 1;
        $ignore_links = ($ignore_these ? explode(" ", $ignore_these) : ($mybb->settings['cookiedomain'] ? array($mybb->settings['cookiedomain']) : array($_SERVER['SERVER_NAME'])));
        foreach ($matches[2] AS $key=>$rawurl)
        {
            //Testing Begin
            // If we have any from $ignore_url, leave that as it is
            if (($parsed_url = @parse_url($rawurl)) !== false)
            {
                $link = $parsed_url['host'];
                //Ignore the link if it has local address or ignored link
                foreach ($ignore_links AS $ignore_link)
                {
                    //echo "$ignore_link<br />";
                    if (substr($ignore_link, 0, 1) == ".")
                    {
                        if (preg_match("/$ignore_link$/i", $link))
                        {
                            continue 2;
                        }
                    }
                    else
                    {
                        if (strtolower($ignore_link) == strtolower($link))
                        {
                            continue 2;
                        }
                    }
                }
            }
            else
            {
                if ($should_force != 1)
                {
                    continue;
                }
            }
            //Testing end
            $anonymurl = "http://redirectincognito.com/?" . $rawurl;
            $preg_search["$rawurl"] = "<a href=\"$rawurl";
            $preg_replace["$rawurl"] = "<a href=\"" . $anonymurl;
        }
        if ($preg_search)
        {
            return str_replace($preg_search, $preg_replace, $message);
        }
    }
}
?>

Save code as anonymurl.php

and upload to inc/plugins

Note: This is just modified by me to work with redirectincognito.com :)
If people want I will modify more..if there are requests
 
Status
Not open for further replies.

About the author

R
Active Member · Joined
1,628
Messages
63
Reactions
48
Points

Advertise on WJunction

Reach 1000's of webmasters, hosts & affiliates. Banner & sponsored-thread slots available.

Contact us
Back
Top Bottom