TinyPortal

Development => Support => Topic started by: welshdog on May 16, 2014, 04:08:20 AM

Title: Parse error on code upgrade.
Post by: welshdog on May 16, 2014, 04:08:20 AM
Link to my forum: Australian Opinion (http://australianopinion.com.au)
SMF version: SMF ver. 2.0.7
TP version: TP ver. 1.?
Default Forum Language: English
Theme name and version: SMF-Default
Browser Name and Version: Chrime Build ??
Mods installed: Various (mostly security/spam protection)

Related Error messages:  Parse error: syntax error, unexpected T_ELSE in /home/aoau/public_html/forum/Sources/QueryString.php on line 481

Before you say anything *yes* I'm stupid. :(

I tried to follow the instructions for updating the code in http://www.tinyportal.net/index.php?topic=35326.msg282229#msg282229 (Sticky panels' that won't stay open/closed) but made a fundamental error in that even tho I copied the code I cut out... I totally forgot to backup the original file itself. No idea what I was thinking but now the forum is screwed.

The code as existing in /home/aoau/public_html/forum/Sources/QueryString.php is as follows (I included several lines before and after "just in case'):

Quote// This should work even in 4.2.x, just not CGI without cgi.fix_pathinfo.
   if (!empty($modSettings['queryless_urls']) && (!$context['server']['is_cgi'] || @ini_get('cgi.fix_pathinfo') == 1 || @get_cfg_var('cgi.fix_pathinfo') == 1) && ($context['server']['is_apache'] || $context['server']['is_lighttpd']))
   {

// 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);

      else
         $buffer = preg_replace('/"' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?"/e', "'\"' . \$scripturl . '/' . strtr('\$1', '&;=', '//,') . '.html\$2\"'", $buffer);

I have no idea what I could have done wrong as I replaced the code I cut out and this still happened. What dod I do to fix it before my members start playing hell with me (again). :(
Title: Re: Parse error on code upgrade.
Post by: welshdog on May 16, 2014, 04:32:57 AM
Quote from: welshdog on May 16, 2014, 04:08:20 AM
I have no idea what I could have done wrong as I replaced the code I cut out and this still happened. What dod I do to fix it before my members start playing hell with me (again). :(

I found the backup file so the site *is* working again... so my panic has subsided a little, however the problem remains about what I did wrong.

As far as I'm aware I copied the code exactly... but next time I'll make sure to keep a separate backup!! :D
Title: Re: Parse error on code upgrade.
Post by: IchBin on May 16, 2014, 06:19:33 PM
Who knows what you did. :) lol The only change TP is making to those lines IIRC, is that it adds this.

It takes this section:
(?:board|topic)

Turns it into this:
(?:board|topic|page|cat)