The new [php] code

We know you have an opinion on how things should be run around here. These are suggestions for the forums, and the website.This forum is not a place to ask for suggestions to your own coding (or otherwise) problems.

Moderator: General Moderators

Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

The new [php] code

Post by Grim... »

The new code for posting PHP strips out escaping slashes.
These two bits of code are the same, but, obviously, only one of them looks like it will work:

Code: Select all

<?php 
print "\"Hello\", said Grim...";
?>

Code: Select all

<?php
print "\"Hello\", said Grim..."; //d11 == fixed it?
?>
This is a bad thing, as demonstrated here: viewtopic.php?p=254331
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: The new [php] code

Post by Chris Corbyn »

Grim... wrote:The new code for posting PHP strips out escaping slashes.
These two bits of code are the same, but, obviously, only one of them looks like it will work:

Code: Select all

<?php 
print ""Hello", said Grim...";
?>

Code: Select all

<?php
print ""Hello", said Grim...";
?>
This is a bad thing, as demonstrated here: viewtopic.php?p=254331
Thanks... I'm starting to think Geshi was a bad idea :(
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

http://geshi.org

Testing against latest 1.2 version of Geshi, the problem does not exist. Which version does the phpBB mod use anyway?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Maugrim_The_Reaper wrote:http://geshi.org

Testing against latest 1.2 version of Geshi, the problem does not exist. Which version does the phpBB mod use anyway?
Hmm, it uses v1.2. Maybe I shouldn't be blaming Geshi but rather, the author of the mod :?

It'll just be something silly like he/she designed the mod with magic quotes on or something... not had a chance to look yet... really busy. Certain smilies also get parsed :? Not seen any other issues thus far.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

I can't reproduce the problem either... (I do seem to remember that the phpbb mod isn't supported anymore because of some differences of opinion...)

@version $Id: geshi.php,v 1.30 2006/02/25 00:46:33 oracleshinoda Exp $
define('GESHI_VERSION', '1.0.7.7');
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

timvw wrote:I can't reproduce the problem either... (I do seem to remember that the phpbb mod isn't supported anymore because of some differences of opinion...)

@version $Id: geshi.php,v 1.30 2006/02/25 00:46:33 oracleshinoda Exp $
define('GESHI_VERSION', '1.0.7.7');

Code: Select all

* @package   core
 * @author    Nigel McNie <nigel@geshi.org>
 * @copyright Copyright &copy; 2004, 2005, Nigel McNie
 * @license   http://gnu.org/copyleft/gpl.html GNU GPL
 * @version   $Id: geshi.php,v 1.2 2005/08/12 13:15:08 oracleshinoda Exp $
FYI the MOD we're using isn't the Geshi authors mod from the phpBB site. It's on sourceforge and is simply called "syntax" :?
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Don't know.. I wrote my own simple plugin for wordpress that uses geshi.. And i wasn't able to reproduce the problem... That's why i blame it on the mod :)
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

While we are talking about it, I just wanted to put in my 2 cents. The font being used isn't hinted (at least on Windows XP) which makes it difficult to read, especially with light colors. I recommend changing the font to something else.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

could easily be phpbb (or related) doing a second stripslashes() when not needed, as phpbb does one already.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Line 84 of functions_syntax.php

Code: Select all

$source = str_replace("\\\"", "\"", $source);
Just commented it out ;) There's other issues with this mod though. I'm starting to wonder if we should collectively write our own Geshi mod :idea:
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

If it is as bad as your saying, I'm all for it :!:
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

Just change the font and I'll be happy :)
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

just borrow from the current

Code: Select all

tags and replace the 'body' with geshi->parse_code?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

agtlewis wrote:Just change the font and I'll be happy :)
This is the font right now:

Code: Select all

.syntax-code {
	font-family: Courier, 'Courier New', sans-serif;
	font-size: 12px;
	color: #111111;
	background-color: #FAFAFA;
	border: #D1D7DC;
	border-style: solid;
	border-left-width: 1px;
	border-width: 1px;
}
12px... ack! I'm guessing you're looking for a courier/monospace font (with em rather than px) ?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

timvw wrote:just borrow from the current

Code: Select all

tags and replace the 'body' with geshi->parse_code?[/quote]

At the moment we simply redirect parsing in [php ] tags to geshi_highlight() which is part of the mod.  We could do what you're saying just for [php ] tags but the issue still affects all [syntax ] tags.
Post Reply