MyBB Community Forums

Full Version: AnonymURL, Your Anonym Links
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
(2008-07-27, 03:32 AM)littleg Wrote: [ -> ]I would like to request a small change if you can?
Such as, clicking on an image would not use this redirect.

If there is a way to make it not count links that have a [img] [/img] Then this would be prefect for my board.

I hope you can help maximum92,
you have a fantastic mod here that just needs this small tweak for board owners like me Smile

Thanks again
Hi littleg, if you use ever the same image hosting, you can add this link to the exceptions's list. Ok? Smile
I hope that this solution will work correctly. Wink
Sure, that could work.

Can you please show me where i need to add the links?
Still looking for help with this.

Here is the code
<?php
$plugins->add_hook("parse_message", "anonymurl_run");

function anonymurl_info()
{
	return array(
		"name"		=> "AnonymURL",
		"description"	=> "Anonym Links in all Topics",
		"website"		=> "http://anonym.ilbello.com",
		"author"		=> "Maximum92",
		"authorsite"	=> "http://anonym.ilbello.com",
		"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://anonym.ilbello.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);
		}
	}

}

?>

Where would i add the exceptions links?
$ignore_these = "your exception links";
Thanks, but its still not working

Here is what i have with the links added
        //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 = "http://imagevenue.com";
        $ignore_these = "http://www.imagevenue.com";
        $ignore_these = "http://fapomatic.com";
        $ignore_these = "http://www.fapomatic.com";
        $ignore_these = "http://et-buzz.net";
        $ignore_these = "http://www.et-buzz.net";

Any ideas? Where is maximum92? ..hehe
add them all in one line seperated by spaces ...

$ignore_these = "http://imagevenue.com http.www.imagevenue.com ...";
Thanks LeX

It seams that just adding the links is not going to work.
The free image hosts add an image number before the domain address in all there pics.

so,
imagevenue.com with a pic link would be something like img163imagevenue.com

I uploaded a few pics to show you what i mean look at the address on each pic.
[Image: th_63391_comoxsunrise_1440x900_122_514lo.jpg][Image: th_63393_towermountain_1440x900_122_20lo.jpg]
[Image: th_63395_colorfulplacevcolor_1440x900_122_1080lo.jpg][Image: th_63402_sunsetbeach_1440x900_122_203lo.jpg]
[Image: th_63404_driftwood_1440x900_122_501lo.jpg][Image: th_63407_durdledoorlulworthdorset_1440x9..._745lo.jpg]

As you can see, its always a random number.

What i need changed in the mod is what i asked for in the first place.
Any links on the board with the [/URL] tags to not be included in the anom.

That should be very easy to do.. can you help me with it?

Thanks so much, you are always there for me Smile
Sorry littleg, i was on holiday.

I understand your problem, in fact many image hosting create links putting different prefixes, for example: img210, img179, etc., so you can't add all these urls in your exception links.

Maybe you could use my AnonymURL MyCode that anonymizes only links that have [anonym][/anonym] tag.
(You can download it from the attachment)
[attachment=10081]
Thanks maximum92, i hope you had a good holiday Smile

The [anonym][/anonym] tag's is a good alternative, but in my case it would not be.
You see, i have a lot of "stupid" posts on my board that would never use it.
It must be all auto anom links on my board or i would be editing 100's of posts a day.. hehe

I understand if you can not modify your code for me to anom links leaving out links with the [img] [/img] tag's.

Thanks for everyones help with this.
Oh, i didn't know it. My best solution was the [anonym][/anonym] tag, sorry but i can't change the entire code for only one person. However i think that anonymize also the images is a good thing. Wink
Pages: 1 2 3