TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

March 29, 2024, 04:42:09 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,105
  • Total Topics: 21,213
  • Online today: 231
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 233
  • Total: 233

TP 1.0 on SMF 2.0.7

Started by DJ Doena, January 25, 2014, 06:36:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DJ Doena

Hi,

I just set up a new SMF 2.0.7

When I try to install TP 1.0 I get a test error in

/sources/querystring.php Test Failed

Why? Because it's looking for this:

// Let's do something special for session ids!
if (defined('SID') && SID != '')
$buffer = preg_replace('/"' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&))((?:board|topic)=[^#"]+?)(#[^"]*?)?"/e', "'\"' . \$scripturl . '/' . strtr('\$1', '&;=', '//,') . '.html?' . SID . '\$2\"'", $buffer);
else
$buffer = preg_replace('/"' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?"/e', "'\"' . \$scripturl . '/' . strtr('\$1', '&;=', '//,') . '.html\$2\"'", $buffer);


to be replaced with this

// Let's do something special for session ids!
if (defined('SID') && SID != '')
$buffer = preg_replace('/"' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&))((?:board|topic|page|cat)=[^#"]+?)(#[^"]*?)?"/e', "'\"' . \$scripturl . '/' . strtr('\$1', '&;=', '//,') . '.html?' . SID . '\$2\"'", $buffer);
else
$buffer = preg_replace('/"' . preg_quote($scripturl, '/') . '\?((?:board|topic|page|cat)=[^#"]+?)(#[^"]*?)?"/e', "'\"' . \$scripturl . '/' . strtr('\$1', '&;=', '//,') . '.html\$2\"'", $buffer);


The difference here seems to be the

|page|cat

in both lines

Problem is, in 2.0.7 the code in question looks like this

// Let's do something special for session ids!
if (defined('SID') && SID != '')
$buffer = preg_replace('/"' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&))((?:board|topic)=[^#"]+?)(#[^"]*?)?"/e', "'\"' . \$scripturl . '/' . strtr('\$1', '&;=', '//,') . '.html?' . SID . '\$2\"'", $buffer);
else
$buffer = preg_replace('/"' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?"/e', "'\"' . \$scripturl . '/' . strtr('\$1', '&;=', '//,') . '.html\$2\"'", $buffer);


I manually replaced it with this

// Let's do something special for session ids!
if (defined('SID') && SID != '')
$buffer = preg_replace_callback('~"' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&))((?:board|topic|page|cat)=[^#"]+?)(#[^"]*?)?"~', create_function('$m', 'global $scripturl; return \'"\' . $scripturl . "/" . strtr("$m[1]", \'&;=\', \'//,\') . ".html?" . SID . (isset($m[2]) ? $m[2] : "") . \'"\';'), $buffer);
else
$buffer = preg_replace_callback('~"' . preg_quote($scripturl, '/') . '\?((?:board|topic|page|cat)=[^#"]+?)(#[^"]*?)?"~', create_function('$m', 'global $scripturl; return \'"\' . $scripturl . "/" . strtr("$m[1]", \'&;=\', \'//,\') . ".html" . (isset($m[2]) ? $m[2] : "") . \'"\';'), $buffer);


This should be correct, shouldn't it?

IchBin

I was wondering if this patch was going to make problems with the TP install. I'll have to take a look at the changes SMF has made to see what is happening.

From a quick look at your code, you are missing the page|cat parts that TP adds.

DJ Doena

Quote from: IchBin™ on January 25, 2014, 07:53:26 PM
From a quick look at your code, you are missing the page|cat parts that TP adds.

Err, yeah. I have them in the actual code. I just forgot them in the posting above. I've modified it now.

lurkalot

@ DJ Doena

Just curious.  Was this a completely new install of SMF 2.0.7 ?  Or SMF upgraded using the 2.0.6 - 2.0.7 patch?

DJ Doena

Quote from: lurkalot on January 25, 2014, 09:22:16 PM
@ DJ Doena

Just curious.  Was this a completely new install of SMF 2.0.7 ?  Or SMF upgraded using the 2.0.6 - 2.0.7 patch?

OK, "completely new" may have been an exaggeration. I upgraded from 1.1.19 to 2.0.7, removed all old themes and add-ons and then added TP 1.0 as the first add-on.

IchBin

You can replace the section in the install.xml file with this to finish the install if you'd like. With the changes they added in 2.0.7 it makes it so TP can't install in a new install. Looks like we need to push out a new version faster than planned.

<file name="$sourcedir/QueryString.php">
<operation>
<search position="replace"><![CDATA['\?(?:' . SID . '(?:;|&|&amp;))((?:board|topic)=[^#"]+?)(#[^"]*?)?"~']]></search>
<add><![CDATA['\?(?:' . SID . '(?:;|&|&amp;))((?:board|topic|page|cat)=[^#"]+?)(#[^"]*?)?"~']]></add>
</operation>
<operation>
<search position="replace"><![CDATA['\?((?:board|topic)=[^#"]+?)(#[^"]*?)?"~']]></search>
<add><![CDATA['\?((?:board|topic|page|cat)=[^#"]+?)(#[^"]*?)?"~']]></add>
</operation>
</file>

lurkalot

Thanks for the reply.  I was just testing this on a new install a couple minutes ago.

Brad.  Annoyingly, they fixed the 2.0.7 patch so it will install when Tinyportal is already installed. (Which it does nicely) 

But after applying the 2.0.7 patch you can't uninstall Tinyportal without getting a test failed. The patch has to then be uninstalled before you can uninstall Tinyportal

IchBin

Ouch, I didn't even think about that. And the next TP version is going to require people to uninstall too. Since I added all the new hooks into the TP install, it now doesn't require a lot of the file edits. Which means people have to uninstall TP 1.0 to remove the code before they can install TP 1.1.....

Well, I guess this means we'll just have to try to tell people in advance and hopefully they won't have a big problem with it.

lurkalot

I know they tried to make the patch play nicely with Tinyportal, and SP, I'm guessing they will have the same problem uninstalling SP.

ZarPrime

Yeah, ouch.  I hope we don't run into something similar when they release 2.1 to beta. :tickedoff:

ZarPrime