Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-08-23 00:57:22

maverick
Member
From: Southeastern Michigan, USA
Registered: 2005-01-14
Posts: 976
Website

mem_templates & css encoding

The version of mem_templates I have is base64 encoding the css on import.

Since txp no longer encodes css . . . .

Being a php dummy, I tried deleting the base64 code, but that only broke the plugin.

Any suggestions on how to bring it up to speed?

Thanks

Mike

Offline

#2 2010-08-23 05:21:31

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: mem_templates & css encoding

Should just need to change line 295

$data = base64_decode($row['css']);

to

$data = $row['css'];

and line 394

$data = base64_encode(implode('', $data));

to

$data = doSlash(implode('', $data));

Last edited by ruud (2010-08-23 20:40:58)


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#3 2010-08-23 16:45:44

maverick
Member
From: Southeastern Michigan, USA
Registered: 2005-01-14
Posts: 976
Website

Re: mem_templates & css encoding

Matt, Ruud – thank you.

My first attempts were too agrressive – I removed too much code.

Your surgical advice was just right.

Matt caught a dumb mistake on my part (below). I’ve removed it so no one accidently reads it and does what I did! :)

Thanks again guys!

Mike

Last edited by maverick (2010-08-23 20:27:19)

Offline

#4 2010-08-23 19:47:33

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: mem_templates & css encoding

Line 298 is for plugins which I believe should still be bas64 encoded. Line 396 is for plugins as well.

Last edited by MattD (2010-08-23 19:49:07)


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#5 2010-08-23 20:06:39

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,306

Re: mem_templates & css encoding

Seems to work. Thanks, Matt!

Is there a way to prevent the altered code from removing backslash box model hacks from CSS?


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#6 2010-08-23 20:28:20

maverick
Member
From: Southeastern Michigan, USA
Registered: 2005-01-14
Posts: 976
Website

Re: mem_templates & css encoding

Doh!

Thanks for stopping me Matt!

I was hurrying, the base64 caught my eye, and I missed that it was for the plugins (though how I did – totally obvious).

Thanks again for helping with the fix, and the patience.

Mike

Offline

#7 2010-08-23 20:44:01

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: mem_templates & css encoding

uli wrote:

Is there a way to prevent the altered code from removing backslash box model hacks from CSS?

I’ve edited Matt’s post to fix the backslash issue. Even people who are not using backslash hacks should apply this fix, because it’s important to do proper escaping on MySQL queries (which is what was lacking).

Offline

#8 2010-08-23 21:34:38

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,306

Re: mem_templates & css encoding

BBEdit said:

No differences.
These files are identical.

Thanks!


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#9 2010-08-23 21:36:24

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: mem_templates & css encoding

Thanks ruud


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#10 2010-08-23 22:32:47

maverick
Member
From: Southeastern Michigan, USA
Registered: 2005-01-14
Posts: 976
Website

Re: mem_templates & css encoding

MattD wrote:

Thanks ruud

Ditto

Offline

Board footer

Powered by FluxBB