[Xerte] Re: latex/stripslashes/magic quotes etc
Ron Mitchell
ronm at mitchellmedia.co.uk
Mon Jan 21 20:07:59 GMT 2013
Thanks Paul but I was checking the settings on each server via phpinfo. I
also checked the other magic_quotes settings and they are off on all 3
servers. So yes it is strange but I did note from previous discussion that
setting magic_quotes_gpc to on hadn't resolved the issue for them either so
I'm wondering if there's something else at play here. I guess use of latex
in XOT isn't that common and if the issue only arises on some configurations
in perhaps explains why this hasn't cropped up more often.
From: xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Paul Swanson
Sent: 21 January 2013 19:31
To: Xerte discussion list
Subject: [Xerte] Re: latex/stripslashes/magic quotes etc
That's strange! Are you checking the php.ini in the php directory? It's not
always the ini file being used. The best way to determine what ini file is
being used is to run phpinfo() and see what is in the Loaded Configuration
File setting. Sometimes you will find that it is being loaded from a
different location. The output will also tell you what magic_quotes_gpc is
set to. I'm not sure what impact magic_quotes_runtime would have, but if
that is off on server 3 but on on server 2, it might need to be factored in
as well.
Paul Swanson
Internal Business Systems Analyst
Internal Business Intelligence
Harland Financial Solutions
(800) 274-7280 Ext. 2462
Paul.Swanson at harlandfs.com
From: xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Ron Mitchell
Sent: Monday, January 21, 2013 11:11 AM
To: 'Xerte discussion list'
Subject: [Xerte] Re: latex/stripslashes/magic quotes etc
Ok have compared 3 different linux servers all the same XOT code and results
as follows:
server 1
php 5.3.2
magic_quotes_gpc = off
no problem with stripping slashes in latex code e.g. latex works fine even
when editing and publishing etc
server 2
php 5.3.8
magic_quotes_gpc=on
has problem with stripping slashes
server 3
php 5.3.17
magic_quotes_gpc=on
no problem with stripping slashes in latex code e.g. latex works fine even
when editing and publishing etc
so it seems like the magic_quotes_gpc setting isn't the culprit? What else
could it be? Or am I missing the point?
From: xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Ron Mitchell
Sent: 21 January 2013 18:27
To: 'Xerte discussion list'
Subject: [Xerte] Re: latex/stripslashes/magic quotes etc
Thanks for the suggestion Paul.
But in terms of XOT I'm looked through most of the previous discussion about
this in different threads and it's not clear why this stripping of slahes
happens on some servers and not on others. As I mentioned as a test I turned
magic_quotes_gpc on server wide but that didn't prevent the slashes from
being stripped. Also in a previous thread the use of ini_set(
'magic_quotes_gpc', true ); in save.php didn't resolve the issue either.
stripslashes is used in at least a few different places in save.php so I'm
not sure it's a good idea to go messing with that before identifying what
the difference is between servers where this is an issue and those where
it's not. I'm going to compare phpinfo results first to try to spot the
difference.
Cheers
Ron
From: xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Paul Swanson
Sent: 21 January 2013 17:48
To: Xerte discussion list
Subject: [Xerte] Re: latex/stripslashes/magic quotes etc
On my php applications, I use the following function before saving any data
to the database:
// function for escaping and trimming form data
function escape_data ($data) {
global $dbc;
if (ini_get ('magic_quotes_gpc')) {
$data = stripslashes ($data);
}
return mysql_real_escape_string (trim ($data), $dbc);
} // end of escape_data() function
It checks to see if magic_quotes_gpc is on, and if so, employs the
stripslashes function, since magic_quotes adds slashes. If magic_quotes
isn't on, it skips the stripslashes function. This function ensures that
either configuration is handled.
$dbc in the function is the database connection resource variable.
Paul Swanson
Internal Business Systems Analyst
Internal Business Intelligence
Harland Financial Solutions
(800) 274-7280 Ext. 2462
Paul.Swanson at harlandfs.com
From: xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Ron Mitchell
Sent: Monday, January 21, 2013 9:04 AM
To: 'Xerte discussion list'
Subject: [Xerte] latex/stripslashes/magic quotes etc
Hi all
this has been discussed previously but in different threads and I decided it
would be worth summarising and checking this in a new thread...
In previous discussions it's clear that depending on php configuration
previewing and/or publishing was/is stripping slashes to the point that
latex code had all slashes removed and therefore didn't work. There was a
suggestion of using ini_set( 'magic_quotes_gpc', true ); in save.php but
it's not clear if that resolved the issue.
I have an installation (linux) where this is happening so as a test I turned
on magic_quotes_gpc server wide but that hasn't resolved the issue. Also I
read that magic quotes has been DEPRECATED as of PHP 5.3.0 and REMOVED as of
PHP 5.4.0.
So what's the solution to this? Why is it working ok on the Nottingham
install but not for me and others? Or is it?
Cheers
Ron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20130121/aece866d/attachment.html>
More information about the Xerte
mailing list