SimplePortal
Development => Bugs => Fixed or Bogus Bugs => Topic started by: steiger on April 03, 2009, 05:19:59 AM
-
Hi,
I have a board with SMF 1.1.8 and just upgraded to SP 2.2
Some of my PHP blocks have the following code:
global $boarddir;
require_once ($boarddir . '/run/personal_info.php');
dispPersonalBest();
Everything works fine!
If I edit this code under SP 2.2 the every quote gets a backslash as in
global $boarddir;
require_once ($boarddir . \'/run/personal_info.php\');
dispPersonalBest();
And this does not work!
Any ideas how to solve this or what was changed in SP 2.2?
-
Each time you edit a PHP block, backslashes are added to single quotes?
-
Each time you edit a PHP block, backslashes are added to single quotes?
Yes.
Regardless if new or edit, every single or double quote gets a backslash.
But I just found out that this only happens in Preview. If I enter the code and click "Edit Block" everything is fine.
Another example while adding a new block:
Code I entered:
echo "<iframe src='run/results_main.php' />";
Code after "Preview":
echo \"<iframe src=\'run/results_main.php\' />\";
Seems to be a bug in Preview
-
Thanks for detailed testing, that helps a lot. Here is a quick fix:
SPortalAdmin1-1.php
Find:
$context['SPortal']['block'] = array(
'id' => $_POST['block_id'],
Replace:
if (!empty($_POST['parameters']))
foreach ($_POST['parameters'] as $variable => $value)
$_POST['parameters'][$variable] = stripslashes($value);
$context['SPortal']['block'] = array(
'id' => $_POST['block_id'],
This most probably does not affect SMF 2.0 version, but I'll have a look at that too. Thanks again.
Edit:
Yeah, it does not affect SMF 2.0 version. Moved to the Bugs (http://simpleportal.net/index.php?board=3.0) board.
-
Thanks for the quick fix.
Just for clarification:
I should add: if (!empty($_POST['parameters']))
foreach ($_POST['parameters'] as $variable => $value)
$_POST['parameters'][$variable] = stripslashes($value);
before
$context['SPortal']['block'] = array(
'id' => $_POST['block_id'],
Because in your code the line
'id' => $_POST['block_id'],
would be removed
-
Oops, thanks for correction. ;) Let us know if that works for you.
-
Fix solves the problem.
Thanks again for your fast work.
-
Wouldn't be this fast if you haven't said that it is just when you use the "Preview" button. Thanks again!
-
Wouldn't be this fast if you haven't said that it is just when you use the "Preview" button. Thanks again!
As a long time SW developer I can imagine what you need to know ;D
-
Reported:
http://simpleportal.net/index.php?issue=174.0