Welcome to Geeklog, Anonymous Monday, January 06 2025 @ 04:09 pm EST
Geeklog Forums
Allow backslashes '\' in articles&threads
Status: offline
RickW
Forum User
Full Member
Registered: 01/28/04
Posts: 240
Location:United States
I and any member of my gl site needs to be able to use the backslash character in articles (stories) and forum posts. But it's getting stripped out.
I don't remember having an issue with with this on my previous version but maybe I just didn't notice. In a recent article, I also couldn't use the less than and greater than signs. What I've had to do is enter in their html equiv, i.e. &nnn; which works but only if you don't try to edit the aritcle/post afterwards.
www.antisource.com
I don't remember having an issue with with this on my previous version but maybe I just didn't notice. In a recent article, I also couldn't use the less than and greater than signs. What I've had to do is enter in their html equiv, i.e. &nnn; which works but only if you don't try to edit the aritcle/post afterwards.
www.antisource.com
16
9
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/04
Posts: 1512
what version do you run now? back slashes aren't being stripped in 1.3.10, well, in rc1 anyway.
have you tried escaping them?
have you tried escaping them?
7
11
Quote
Nobody
Anonymous
Have them use the PRE tag
8
12
Quote
Benta
Anonymous
Quote by RickW: I still need a resolution to this.
Here is an example of what's happening:
http://www.antisource.com/forum/viewtopic.php?showtopic=231
Here is an example of what's happening:
http://www.antisource.com/forum/viewtopic.php?showtopic=231
What happens if you use the code tag in stories?
18
13
Quote
Status: offline
RickW
Forum User
Full Member
Registered: 01/28/04
Posts: 240
Location:United States
Quote by Benta:
What happens if you use the code tag in stories?
Quote by RickW: I still need a resolution to this.
Here is an example of what's happening:
http://www.antisource.com/forum/viewtopic.php?showtopic=231
Here is an example of what's happening:
http://www.antisource.com/forum/viewtopic.php?showtopic=231
What happens if you use the code tag in stories?
Same thing as pre. This isn't a formatting issue, geeklog is removing the backslashes before saving it to the database. It also removes the less than and greater than signs. Ideally, it would convert them to their numerical codes before doing this.
Let's test this out here:
c:windowssystem32driversetchosts
See what happens?
www.antisource.com
17
8
Quote
Status: offline
THEMike
Forum User
Moderator
Registered: 07/25/03
Posts: 141
Location:Sheffield, UK
Add an extra backslash to escape the backslash.
Here is a\
c:\dos\run
There is an outstanding defect with preview/edit of stories with backslashes:
Defect 25
I had produced a patch for geeklog 1.3.11, it should work on that version, unfortunately subsequent changes to the source (i.e. the CVS version that will become 1.3.12 in due time) mean the patch doesn't work in CVS geeklog. You could try it, get it here
Here is a\
c:\dos\run
There is an outstanding defect with preview/edit of stories with backslashes:
Defect 25
I had produced a patch for geeklog 1.3.11, it should work on that version, unfortunately subsequent changes to the source (i.e. the CVS version that will become 1.3.12 in due time) mean the patch doesn't work in CVS geeklog. You could try it, get it here
12
13
Quote
Status: offline
THEMike
Forum User
Moderator
Registered: 07/25/03
Posts: 141
Location:Sheffield, UK
hmm ok so double-backslashing doesn't work on the forums. But I'm sure it works in the articles. (Geeklog CVS Test Article)
10
15
Quote
Status: offline
RickW
Forum User
Full Member
Registered: 01/28/04
Posts: 240
Location:United States
When I was creating the RSS for Authors script, I had to pay attention to what characters I sent to the feed - I needed to strip out the html markup in the description and convert some special characters. So I used this routine:
$introtext = stripslashes($C['introtext']);
$introtext = trim($introtext);
$introtext = preg_replace('/(\015)/', '', $introtext);
$breaks = array('<br>', '<br/>', '', '</p>');
$introtext = str_replace($breaks, ' ', $introtext);
$introtext = strip_tags($introtext);
$introtext = htmlspecialchars($introtext, ENT_QUOTES);
So if the templating system uses htmlspecialchars(), or even htmlentities(), the problem should be solved. If that still doesn't work, then run a str_replace() to convert the backslash character to it's numerical code. But I don't know where to make this change.
www.antisource.com
Text Formatted Code
$introtext = stripslashes($C['introtext']);
$introtext = trim($introtext);
$introtext = preg_replace('/(\015)/', '', $introtext);
$breaks = array('<br>', '<br/>', '', '</p>');
$introtext = str_replace($breaks, ' ', $introtext);
$introtext = strip_tags($introtext);
$introtext = htmlspecialchars($introtext, ENT_QUOTES);
So if the templating system uses htmlspecialchars(), or even htmlentities(), the problem should be solved. If that still doesn't work, then run a str_replace() to convert the backslash character to it's numerical code. But I don't know where to make this change.
www.antisource.com
12
7
Quote
Benta
Anonymous
Quote by RickW:
Same thing as pre. This isn't a formatting issue, geeklog is removing the backslashes before saving it to the database. It also removes the less than and greater than signs. Ideally, it would convert them to their numerical codes before doing this.
Let's test this out here:
c:windowssystem32driversetchosts
See what happens?
Same thing as pre. This isn't a formatting issue, geeklog is removing the backslashes before saving it to the database. It also removes the less than and greater than signs. Ideally, it would convert them to their numerical codes before doing this.
Let's test this out here:
c:windowssystem32driversetchosts
See what happens?
Weird, on my 1.3.11, it works fine if I submit it with the code-tags (the ones with [-brackets) before and after and submit as HTML.
13
8
Quote
Status: offline
RickW
Forum User
Full Member
Registered: 01/28/04
Posts: 240
Location:United States
Okay - try it with a forum post if you have the plugin installed, and post a test Comment. I find it doesn't work with comments either. I think I remember it did work with code tags for me, but considering the nature of my site, I can't use those tags for every file path I write.
www.antisource.com
www.antisource.com
15
7
Quote
Status: offline
LWC
Forum User
Full Member
Registered: 02/19/04
Posts: 818
Status: offline
racooper
Forum User
Junior
Registered: 03/13/04
Posts: 24
I've been fighting this same issue for a week, and found this thread. Looking at the bugtracker, this fixes the problem:
at the top of the function COM_checkHTML() in lib-common.php, add one line as so (swiped from Defect 25, noted above):
function COM_checkHTML( $str, $permissions = 'story.edit' )
{
global $_CONF;
$str = str_replace( '\\\\', '&#92;', $str ); // HACK -- THIS IS THE ADDED LINE
$str = stripslashes($str);
at the top of the function COM_checkHTML() in lib-common.php, add one line as so (swiped from Defect 25, noted above):
function COM_checkHTML( $str, $permissions = 'story.edit' )
{
global $_CONF;
$str = str_replace( '\\\\', '&#92;', $str ); // HACK -- THIS IS THE ADDED LINE
$str = stripslashes($str);
13
11
Quote
Status: offline
zefflyn
Forum User
Newbie
Registered: 10/31/06
Posts: 1
This problem is driving me nuts. I'm running 1.4.0sr5-1, and have a series of stories containing a whole lot of directory names, including backslashes.
If I write the story with backslashes, they are removed upon save. ARG!
If I write the story with & #92 ; , it saves and displays properly ( had to write that with spaces in "& #92 ;" to prevent parsing). But when I edit the story, the editor converts them to backslashes (Why in the world does it do this?), and then deletes them upon save. ARG!
Somewhere in there is one too many stripslashes().
How can I change it to leave the & #92 ; in the story when editing, or simply leave backslashes in the story?
If I write the story with backslashes, they are removed upon save. ARG!
If I write the story with & #92 ; , it saves and displays properly ( had to write that with spaces in "& #92 ;" to prevent parsing). But when I edit the story, the editor converts them to backslashes (Why in the world does it do this?), and then deletes them upon save. ARG!
Somewhere in there is one too many stripslashes().
How can I change it to leave the & #92 ; in the story when editing, or simply leave backslashes in the story?
13
9
Quote
All times are EST. The time is now 04:09 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content