Welcome to Geeklog Sunday, May 19 2013 @ 12:03 PM EDT
|
||||||||
![]() |
Forum Index > Support > General Geeklog Support |
New Topic
|
Post Reply
|
How do I put an apostrophe in a Block Title? |
|||
| Anonymous: Anonymous |
|
||||||
|
|
I've noticed that this site has a number of blocks with apostrophes in their title e.g. What's New.
If I attempt to do this, geeklog inserts a backslash before the apostrophe (and it gets displayed in the block title). What's the secret for achieving what you've done? |
||||||
|
|||||||
| Dirk |
|
||||||
![]() ![]() ![]() ![]() ![]() Admin ![]() Status: offline ![]() Registered: 01/12/02 Posts: 13027 |
Yeah, this is a bug in admin/block.php (actually, that one's fixed in 1.3.5sr2). You need to add
$title = addslashes ($title); before line 347 in block.php so that it reads // Convert array values to numeric permission values list($perm_owner,$perm_group,$perm_members,$perm_anon) = SEC_getPermissionValues($perm_owner,$perm_group,$perm_members,$perm_anon); $title = addslashes ($title); DB_save(... bye, Dirk |
||||||
|
|||||||
| Anonymous: Anonymous |
|
||||||
|
|
I am using 1.3.5sr2.
If addslashes is used prior to putting $title into the database then it looks like stripslashes isn't being called after removing it from the database prior to display. |
||||||
|
|||||||
| Anonymous: Anonymous |
|
||||||
|
|
I believe the following patch, for 1.3.5sr2, is what's required but I'd appreciate your comments.
--- public_html/admin/block.php.orig Wed Jul 10 10:09:54 2002 +++ public_html/admin/block.php Wed Jul 10 13:28:29 2002 @@ -77,7 +77,7 @@ $block_templates->set_var('layout_url', $_CONF['layout_url']); $block_templates->set_var('block_id', $A['bid']); $block_templates->set_var('lang_blocktitle', $LANG21[5]); - $block_templates->set_var('block_title', $A['title']); + $block_templates->set_var('block_title', stripslashes($A['title'])); $block_templates->set_var('lang_enabled', $LANG21[53]); if ($A['is_enabled'] == 1) { $block_templates->set_var('is_enabled', 'checked="CHECKED"'); @@ -177,7 +177,7 @@ $block_templates->set_var('block_bid', $A['bid']); $block_templates->set_var('lang_blocktitle', $LANG21[5]); - $block_templates->set_var('block_title', $A['title']); + $block_templates->set_var('block_title', stripslashes($A['title'])); $block_templates->set_var('lang_enabled', $LANG21[53]); if ($A['is_enabled'] == 1) { $block_templates->set_var('is_enabled', 'checked="CHECKED"'); @@ -409,7 +409,7 @@ $A = DB_fetchArray($result); $block_templates->set_var('block_id', $A['bid']); - $block_templates->set_var('block_title', $A['title']); + $block_templates->set_var('block_title', stripslashes($A['title'])); $access = SEC_hasAccess($A['owner_id'],$A['group_id'],$A['perm_owner'],$A['perm_group'],$A['perm_members'],$A['perm_anon']); if ($access > 0) { --- public_html/lib-common.php.orig Wed Jul 10 10:16:38 2002 +++ public_html/lib-common.php Wed Jul 10 13:13:23 2002 @@ -496,7 +496,7 @@ $block->set_file('block', $template); $block->set_var('site_url',$_CONF['site_url']); // not used but some custom theme may want it $block->set_var('layout_url', $_CONF['layout_url']); - $block->set_var('block_title',$title); + $block->set_var('block_title', stripslashes($title)); if (!empty($helpfile)) { if (!stristr($helpfile,'http://')) { $help = '<a class="blocktitle" href="' . $_CONF['site_url'] . '/help/' . $helpfile |
||||||
|
|||||||
| Dirk |
|
||||||
![]() ![]() ![]() ![]() ![]() Admin ![]() Status: offline ![]() Registered: 01/12/02 Posts: 13027 |
Ah, okay. It is quite possible that the addslashes() in block.php coincides with a stripslashes() somewhere else that did not make it into 1.3.5sr2 :-/
It works in 1.3.6 (i.e. the version from CVS), though ... Hmm, try if removing the addslashes() line I mentioned above will help. bye, Dirk |
||||||
|
|||||||
| Anonymous: Anonymous |
|
||||||
|
|
I posted a patch to the SourceForge Patch Tracker on this. You might want to see if what I did ties in with the 1.3.6 code.
Regards, Neil Darlow M.Sc. |
||||||
|
|||||||
| Creator |
|
||||||
![]() ![]() ![]() ![]() ![]() Full Member ![]() Status: offline ![]() Registered: 07/11/02 Posts: 181 |
I've tried this, and also the suggestion posted by Dirk. Nothing works. Using GL 1.3.5sr2.
This problem doesn't occur in just the block titles, it occurs EVERYWHERE I use an apostrophe. L. Whitworth |
||||||
|
|||||||
| ScottN |
|
||||||
![]() ![]() ![]() ![]() ![]() Newbie Status: offline ![]() Registered: 07/17/02 Posts: 2 |
I was able to solve the problem without hacking the source code by using the html escape code for an apostrophe in the block title. Instead of "What's New" (which the bug turned into "What\\'s New"
What's New Works like a charm, as far as I can tell, but you have to re-enter the escape code every time you edit a block with an apostrophe in the title. I'm curious if my workaround would work for non-IE browsers and in all countries. The escape code ("'" <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> So I'm assuming it works in my browser because ISO 8859-1 is the default character set? |
||||||
|
|||||||
| Dirk |
|
||||||
![]() ![]() ![]() ![]() ![]() Admin ![]() Status: offline ![]() Registered: 01/12/02 Posts: 13027 |
Please try this out with Geeklog 1.3.6rc1 - it should work there. Btw, Geeklog now also supports setting a character set (although I don't think it ever had anything to do with this problem ...).
bye, Dirk |
||||||
|
|||||||
| Content generated in: 1.68 seconds |
|
|
|