vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Problems with title encoding. (https://vborg.vbsupport.ru/showthread.php?t=219111)

Essencee 07-21-2009 03:48 PM

Problems with title encoding.
 
Hello guys.

I have written a small modification to my vBulletin system, which allows to bold threads titles. In the newthread templete, I added a radio / input type which allows the user to choose if he wants to bold the thread title or not.

The problem is as such: I added this code to the newthread.php file:
PHP Code:

...

    
$newpost['title'] =& $vbulletin->GPC['subject'];
    
$newpost['iconid'] =& $vbulletin->GPC['iconid'];
    
    if (
$_POST["boldtitle"])
    {
        if (
$_POST["boldtitle"] == "yes")
        {
            
$boldtitle "<b>{$newpost['title']}</b>";
            
$newpost['title'] = $boldtitle;
        }
    }
            
    require_once(
DIR '/includes/functions_prefix.php');

... 

The problem is that the title is inserting to the database like this:
Code:

&lt;b&gt;test&lt;/b&gt;
Actually, it needs to be like this:
Code:

<b>test</b>
The encoding of the title field in the database is latin1_swedish_ci.
The encoding of the database connection is utf8_unicode_ci.

Please, help me.
Thanks :)

Dismounted 07-22-2009 06:00 AM

The ThreadPost data manager automatically cleans the fields of HTML, so your tags will be converted into HTML entities.

Essencee 07-22-2009 09:24 AM

So what can I do, please?

Dismounted 07-22-2009 10:43 AM

What I would do is create a new field where you store if the title is to be "bolded". Then check this field in showthread. This solution means that the original title is not modified, and the modification can be removed easily.


All times are GMT. The time now is 05:26 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01829 seconds
  • Memory Usage 1,718KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete