Welcome to Geeklog, Anonymous Thursday, November 28 2024 @ 11:56 am EST
Geeklog Forums
php + autotags in staticpages
Status: offline
LWC
Forum User
Full Member
Registered: 02/19/04
Posts: 818
Hmm, could it be due to public_html/staticpages/index.php - function render_content:
if ($_SP_CONF['allow_php'] == 1) {
// Check for type (ie html or php)
if ($sp_php == 1) {
...
} else if ($sp_php == 2) {
} else {
$retval .= PLG_replacetags ($sp_content);
}
} else {
if ($sp_php != 0) {
COM_errorLog...
} else {
$retval .= $sp_content;
}
}
And likewise in plugins/staticpages/functions.inc - function plugin_centerblock_staticpages:
if ($_SP_CONF['allow_php'] == 1) {
// Check for type (ie html or php)
if ($spresult['sp_php'] == 1) {
...
} else if ($spresult['sp_php'] == 2) {
...
} else {
$retval .= PLG_replacetags (stripslashes ($spresult['sp_content']));
}
} else {
if ($spresult['sp_php'] != 0) {
COM_errorLog...
} else {
$retval .= stripslashes ($spresult['sp_content']);
}
}
Get it? PLG_replacetags is only used if you to enable PHP (luckily that's the default) and use HTML! Is there a logical reason for this?!
Obviously requiring enabling general PHP support for this is a big nasty bug, but what about requiring HTML mode for the staticpage? Is it due to technical reasons (like something may go wrong with PHP when using autotags) or just a bug too?
Text Formatted Code
if ($_SP_CONF['allow_php'] == 1) {
// Check for type (ie html or php)
if ($sp_php == 1) {
...
} else if ($sp_php == 2) {
} else {
$retval .= PLG_replacetags ($sp_content);
}
} else {
if ($sp_php != 0) {
COM_errorLog...
} else {
$retval .= $sp_content;
}
}
And likewise in plugins/staticpages/functions.inc - function plugin_centerblock_staticpages:
Text Formatted Code
if ($_SP_CONF['allow_php'] == 1) {
// Check for type (ie html or php)
if ($spresult['sp_php'] == 1) {
...
} else if ($spresult['sp_php'] == 2) {
...
} else {
$retval .= PLG_replacetags (stripslashes ($spresult['sp_content']));
}
} else {
if ($spresult['sp_php'] != 0) {
COM_errorLog...
} else {
$retval .= stripslashes ($spresult['sp_content']);
}
}
Get it? PLG_replacetags is only used if you to enable PHP (luckily that's the default) and use HTML! Is there a logical reason for this?!
Obviously requiring enabling general PHP support for this is a big nasty bug, but what about requiring HTML mode for the staticpage? Is it due to technical reasons (like something may go wrong with PHP when using autotags) or just a bug too?
13
9
Quote
Not sure what all the noise is about ...
So autotags are not replaced in static pages when $_SP_CONF['allow_php'] = 0. Congrats, you're the first one to notice that since autotags were introduced back in 1.3.10 (almost 2 years ago).
As for PHP code: You don't want PLG_replaceTags (or anything else for that matter) to mess with your PHP code. That could easily turn into a debugging nightmare. And since you're writing PHP code anyway, you can easily call it yourself when (and where) you need it.
bye, Dirk
So autotags are not replaced in static pages when $_SP_CONF['allow_php'] = 0. Congrats, you're the first one to notice that since autotags were introduced back in 1.3.10 (almost 2 years ago).
As for PHP code: You don't want PLG_replaceTags (or anything else for that matter) to mess with your PHP code. That could easily turn into a debugging nightmare. And since you're writing PHP code anyway, you can easily call it yourself when (and where) you need it.
bye, Dirk
10
10
Quote
Status: offline
LWC
Forum User
Full Member
Registered: 02/19/04
Posts: 818
Well, it's better late than never...it's still ironic that it may mess up the PHP yet it won't work with $_SP_CONF['allow_php'] = 0
I guess I didn't think about running PLG_replaceTags directly for each tag.
So what do you think - should I just do stuff like PLG_replaceTags("[bla:whatever]") or just put everything in $output and do an echo PLG_replaceTags($output) in the end (would this cause a nightmare too?)?
I guess I didn't think about running PLG_replaceTags directly for each tag.
So what do you think - should I just do stuff like PLG_replaceTags("[bla:whatever]") or just put everything in $output and do an echo PLG_replaceTags($output) in the end (would this cause a nightmare too?)?
9
10
Quote
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
My point above was that you should never run any sort of filter on actual PHP code. If it replaced something in your code, you could end up with a syntax error that's not there in the original code and therefore hard to track down.
bye, Dirk
bye, Dirk
12
9
Quote
Status: offline
LWC
Forum User
Full Member
Registered: 02/19/04
Posts: 818
Judging from every word Dirk has said in this topic...no.
But I do think there should be a disclaimer in edit mode that says "all HTML is allowed...autotags will only work in PHP mode if you manually run PLG_replacetags on your strings. Better yet, put them all in one string and use echo PLG_replacetags($string) in the end.
Plus, if only just for the principle, autotags should be supported even with $_SP_CONF['allow_php'] = 0.
So the only thing left without autotags is the blocks (in normal mode).
But I do think there should be a disclaimer in edit mode that says "all HTML is allowed...autotags will only work in PHP mode if you manually run PLG_replacetags on your strings. Better yet, put them all in one string and use echo PLG_replacetags($string) in the end.
Plus, if only just for the principle, autotags should be supported even with $_SP_CONF['allow_php'] = 0.
So the only thing left without autotags is the blocks (in normal mode).
9
12
Quote
All times are EST. The time is now 11:56 am.
- 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