Page 1 of 1

BBcode in database dump?

PostPosted: Tue Jun 12, 2007 9:46 am
Author: shedt_v
Code: Select all
[b]Bolded text[/b]  Sincerely,  Edward [/font][/size]


I'm trying to mass- find and replace a phrase that is in my database like 350 times. The problem is that some of the text is bolded, so when i click find, it does not find it properly.

What do these numbers and letters represent? I'm kinda hacking my way around it and would like to know mostly for learning purposes.

Re: BBcode in database dump?

PostPosted: Wed Jun 13, 2007 10:17 pm
Author: Teelk
That's a good question, I'm not too sure why it generates those random numbers. Mike might know the reason, or Evolver since he did quite a bit of work with bbcodes. I do know that 1.4.1 bbcode/database relationship is not up to snuff and I was working on an update before my hiatus and did eventually fix it. I'll have to dig into my files and find it. It does require an edit/submit to resubmit the post to the database however... but still, it generates those numbers in the database. I'll have to take a closer look and see what they mean.

PostPosted: Thu Jun 14, 2007 6:16 am
Author: shedt_v
Thank you, this is all really cool for me. I've been getting IntegraMod up and running on a local network at work via XAMPP, and I have been learning quite abit about PHP, Apache, mysql etc. I'm no wizard but I'm slowly learning. It's really awesome to have a problem and to take the time to learn to fix it.

For this I just edited around the numbers. It worked, but it would be cool if the numbers are not there. If you have any information or even fixes please do share them.

Thank you!

PostPosted: Mon Jul 30, 2007 7:11 am
Author: shedt_v
Bump, any ideas? I'm going to see what removing them does.

PostPosted: Thu Aug 09, 2007 6:23 am
Author: shedt_v
Could anyone suggest where I could learn more about this?

Re: BBcode in database dump?

PostPosted: Thu Aug 09, 2007 7:28 am
Author: Whisky
Those numbers are the bbcode_uid

It's used to control that your bbcode has been parsed.

if you open the file include/bbcode.php and look a bit closer at it, you'll see that when the text and the bbcode tags are parsed, a var called $uid is added systematicaly to the bbcode tag , like this]     // and for bolding text.     $text = preg_replace("#(.*?)#si", "\1", $text);[/php]

This is the function that generate this number randomly:
Code: Select all
function make_bbcode_uid(){     // Unique ID for this message..       $uid = dss_rand();     $uid = substr($uid, 0, BBCODE_UID_LEN);       return $uid;}  function dss_rand(){      $rand = mt_rand (1,9999999999);    $rand = md5($rand);      return substr($rand, 16);}



If you want to learn more, you'll find usefull information there:
http://www.phpbb.com/community/viewtopi ... &sk=t&sd=a

PostPosted: Thu Aug 09, 2007 8:35 am
Author: shedt_v
thank you so much, I really appreciate it.

p.s. Would it be hard to remove the numbers or to set them as such they are not random? Security is not an issue here for me.

Re: BBcode in database dump?

PostPosted: Thu Aug 09, 2007 8:51 am
Author: Whisky
You mean to remove/change them in the future, or what you already have in your DB?

PostPosted: Thu Aug 09, 2007 9:47 am
Author: shedt_v
Both I guess, if I have too, I will go through and manually edit by hand. But it would be nice to change the code so that those numbers are not showing. Basically when editing my DB dump, I want to be able to find and replace the same thing over and over again, but with the numbers it's not the same each time.

Thank you again I will read into it more.

PostPosted: Thu Aug 09, 2007 9:53 am
Author: shedt_v
OK So I changed a tag from bbcode to html and the html tag is fine. So far it's mostly for bold text, url and such. I will try to edit them all by hand. ouch 400 or so.



EDIT

Would there be away to dump my DB without those numbers? I'm working with about 400 KB articles, trying to find away to replace all the BBcode with html tags.


EDIT

http://domain-name/kb.php?mode=edit&k=13

I wish I could open or dump every article somehow, do a mass find and replace. Any ideas? I'm just opening each one and cut and paste into wordpad, and doing a find replace on the bbcode. so far so good.

Re: BBcode in database dump?

PostPosted: Fri Aug 10, 2007 2:01 am
Author: Whisky
Since each bbcode_uid is different and randomized I don't see anyway to do it with SQL.

Bu what do you want to do exactly? Why get rid of this?

PostPosted: Fri Aug 10, 2007 6:59 am
Author: shedt_v
I have different articles that share similar text, but sometimes I need to change and or add etc. So if the text is bolded, and I need to do a mass find and replace, the uid in the database dump changes. If I want to change:

Thank You Very Much

into

Thank You very Much and have a nice day.

If it is bolded, each time I search I cannot do a mass find and replace.


I can do it into pieces I guess and only search and replace stuff inside the bbcode. But if I want to change two sentences that are both bolded I will have to do them separately.

Not a big deal though. Thank you for your help!