• Welcome to Simple Machines Community Forum. Please login or sign up.
November 27, 2021, 10:55:29 PM

News:

Wondering if this will always be free?  See why free is better.


shared url fix

Started by demlak, January 11, 2013, 05:57:22 PM

Previous topic - Next topic

demlak

Link to Mod

(this mod is totaly based on nend´s Tip´n´Trick about facebook and shared urls - Link: http://www.simplemachines.org/community/index.php?topic=460796 )

This replaces wrong linked URLs by some webmailers (like gmail, web.de, gmx, etc..), facebook and others.

The main reason why webmailers, facebook and others collide is because SMF uses ";" to separate items in the query string and most of them do not support semicolons in urls

Any url with a semicolon separator will get everything after that semicolon put in the first variable in the query string. Plus everything after that like ; and = will get converted.

The trick here is to convert them back before SMF loads.

thx to nend

licensed:
http://creativecommons.org/licenses/by-sa/3.0/

Hristo

June 16, 2013, 10:05:10 AM #1 Last Edit: June 19, 2013, 12:07:31 PM by Hristo
Very odd! This mod is not new and still no one reported the issues I had?!

Installed it on a 3 test boards and every time I got:
QuoteParse error: syntax error, unexpected '{' in /home/xxxx/public_html/test-1/index.php on line 1

The reason for that was missing space:
<?phpif(strstr($_SERVER["REQUEST_URI"], '%3B')) {

BTW, maybe a dumb question :), but how can I understand if it's working or not?  I played with some links and they all look exactly the same as on a board without the mod!
http://bg-gradina.org/test-1/index.php?topic=1.0

Maybe my "fix" is not good? (excerpt from index.php)
<?php
if(strstr($_SERVER["REQUEST_URI"], '%3B')) {
$fix_uri explode('?' $_SERVER["REQUEST_URI"]);
$_SERVER["REQUEST_URI"] = $fix_uri[0].'?'//Might as well rebuild the URI, who knows something might need it.
$fix_uri str_replace(';''%3B'$fix_uri[1]);
$fix_uri explode('%3B'$fix_urisubstr_count($fix_uri'%3B')+1);
foreach($fix_uri as $value) {
if(strstr($value'=')) {
$key explode('='$value);
$_REQUEST[$key[0]] = $_GET[$key[0]] = $_POST[$key[0]] = $key[1];
$_SERVER["REQUEST_URI"].= $key[0].'='.$key[1].';';
} else if(strstr($value'%3D')) {
$key explode('%3D'$value);
$_REQUEST[$key[0]] = $_GET[$key[0]] = $_POST[$key[0]] = $key[1];
$_SERVER["REQUEST_URI"].= $key[0].'='.$key[1].';';
} else {
$_REQUEST[$value] = $_GET[$value] = $_POST[$value] = true;
               
$_SERVER["REQUEST_URI"].= $value.';';
}
}
}



/**
 * Simple Machines Forum (SMF)


Thanks!



demlak

i don´t get it.. where is your "fix"?
your code is exactly the same like in the mod.

this mod works when entering your forum by a url that is modified like some webmailers do.

for example: when someone gets an activation email for his new account on your forum.. he has to click the activation link.. and some webmailers like web.de, gmx and others, parse such links in a wrong way.. they reformat the semicolon.. and sometimes, when the links are reformated, some browser have problems to open smf sites..

smf uses semicolon as a divider.. this mod reformats the semicolon in the right way..
you can find more info in the thread that this mod is based on.. follow the link in the first posting here..


Hristo

As I wrote the index.php code after every install begins with "<?phpif..." and this causes the parse error, so my "fix" is to open the index.php and to press Enter after "<?php" :), from your words seems this is enough.

Thank you for your in detail explanation. Now I'm sure some of my users will benefit of it.


demlak

ahhh now i see what you mean..
i´ll upgrade the mod..
thx for your help

now i wonder myself why noone else reported that error.. as you said.. the mod was killing the SMF install..
but v1.1 is fixed..

Advertisement: