Welcome to Geeklog, Anonymous Thursday, April 25 2024 @ 03:33 pm EDT

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
 Quote

Status: offline

RickW

Forum User
Full Member
Registered: 01/28/04
Posts: 240
Location:United States
Help. Sad It's really creating a headache for my members that post hijackthis logs when the backslashes get stripped out of the file paths.
www.antisource.com
 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?
 Quote

Status: offline

RickW

Forum User
Full Member
Registered: 01/28/04
Posts: 240
Location:United States
I'm running 1.3.11.
www.antisource.com
 Quote

Nobody

Anonymous
Have them use the PRE tag
 Quote

Status: offline

RickW

Forum User
Full Member
Registered: 01/28/04
Posts: 240
Location:United States
Quote by Nobody: Have them use the PRE tag


It get stripped out of the pre tag as well.
www.antisource.com
 Quote

Status: offline

RickW

Forum User
Full Member
Registered: 01/28/04
Posts: 240
Location:United States
I still need a resolution to this.

Here is an example of what's happening:

http://www.antisource.com/forum/viewtopic.php?showtopic=231
www.antisource.com
 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


What happens if you use the code tag in stories?
 Quote

Status: offline

RickW

Forum User
Full Member
Registered: 01/28/04
Posts: 240
Location:United States
Quote by Benta:
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


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
 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
 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)
 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:

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
 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?


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.
 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
 Quote

Status: offline

RickW

Forum User
Full Member
Registered: 01/28/04
Posts: 240
Location:United States
This still needs resolved, it's a pretty serious problem I'm having on my site. Sad
www.antisource.com
 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( '\\\\', '&amp;#92;', $str ); // HACK -- THIS IS THE ADDED LINE
$str = stripslashes($str);
 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?
 Quote

All times are EDT. The time is now 03:33 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