Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 01-12-2004, 10:26 PM
ConqSoft's Avatar
ConqSoft ConqSoft is offline
 
Join Date: Jul 2003
Location: Raleigh, NC
Posts: 686
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Looks like it worked for the most part. Some non-breakable spaces are remaining, but much better then before.

Thanks.

Example: http://www.fireblades.org/forums/showthread.php?t=33
Reply With Quote
  #12  
Old 01-12-2004, 11:02 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
<?php
error_reporting
(E_ALL & ~E_NOTICE);

require_once(
'./global.php');

echo 
"Stripping HTML from all posts, please stand by ...<br>";
$DB_site->query("LOCK TABLES post WRITE");
$posts$DB_site->query("SELECT * FROM " TABLE_PREFIX "post");
$i 0;
while (
$post $DB_site->fetch_array($posts)) {
  
// Remove the HTML
  
$post['pagetext'] = strip_tags(unhtmlspecialchars($post['pagetext'])); 
  
// Remove non-breaking spaces
  
$post['pagetext'] = preg_replace("'&(nbsp|#160);'si"""$post['pagetext']);
  
// Write the post back
  
$DB_site->query("UPDATE " TABLE_PREFIX "post SET pagetext='" addslashes($post['pagetext']) . "' WHERE postid=" $post['postid']);
  if (
$i 100 == 0) {
    echo 
".";
    
flush();
  }
  
$i++;
}
$DB_site->query("UNLOCK TABLES");
echo 
"<br>Finished!"
?>
No warranties. Please note that this script wil take kinda long to finish (depending on the size of you board). No warranties.
Reply With Quote
  #13  
Old 01-12-2004, 11:08 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Firstly that script WILL timeout if you run it from the browser. I'd also recomend only selecting the pagetext and postid from the post table and getting it to do only X posts per page.

If you have SSH access then I'd recomend you close the board and run it via the command prompt.
Reply With Quote
  #14  
Old 01-12-2004, 11:15 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@Conq: hehe, i would have wondered already
good it's working now.

Also i have to agree with Lee that script will timeout, and it's also not well coded (sorry to say)
regarding you have 97k posts, this script will run 97k queries....

it should be strongly optimized before thinking of running it...
Reply With Quote
  #15  
Old 07-29-2004, 11:50 PM
TosaInu's Avatar
TosaInu TosaInu is offline
 
Join Date: Jul 2004
Posts: 256
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It doesn't remove &nbsp; but it does delete the <bits>.

A batch script to strip HTML would be of great help (Ikonboard and 100,000's posts).
Reply With Quote
  #16  
Old 07-29-2004, 11:52 PM
ConqSoft's Avatar
ConqSoft ConqSoft is offline
 
Join Date: Jul 2003
Location: Raleigh, NC
Posts: 686
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The new Import system for vb3 has an extra little utility included that can be used to strip whatever code/text you want. I used it to clean up my database. Worked great.
Reply With Quote
  #17  
Old 07-30-2004, 06:10 AM
TosaInu's Avatar
TosaInu TosaInu is offline
 
Join Date: Jul 2004
Posts: 256
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello ConqSoft,

tools\cleaner.php?
Reply With Quote
  #18  
Old 07-30-2004, 11:10 AM
ConqSoft's Avatar
ConqSoft ConqSoft is offline
 
Join Date: Jul 2003
Location: Raleigh, NC
Posts: 686
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by TosaInu
Hello ConqSoft,

tools\cleaner.php?
Yes. I modifed it a bit, to call the strip_tags() function before it did the replacements. I used the replacements to replace the &nbsp; with blank, the &quot; with ", etc.
Reply With Quote
  #19  
Old 08-04-2004, 02:41 PM
TosaInu's Avatar
TosaInu TosaInu is offline
 
Join Date: Jul 2004
Posts: 256
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello ConqSoft,

I've been .. not too smart, by replacing &quot with a blank and also stripped all exclamation marks. Also forgot the &amp;

What does strip_tags() do? Is that the way to get rid of <html code align =""> that mess?
We still have a lot of that

Can you tell me how to modify the code please? I'm tempted to run it again and strip more.

The script timed out when max-exec was set to 600 seconds. It went ok at 1200.

How do you replace " ? It expects data between "", this would give """ ? Isn't that confusing the script? How do you replace say "center" by "left"? ""left""

Talking about parser. It's no longer possible to add say 3 spaces between words. This is a real pain for certain authors for good reasons. Is it possible to turn that off?
Reply With Quote
  #20  
Old 08-06-2004, 09:50 PM
TosaInu's Avatar
TosaInu TosaInu is offline
 
Join Date: Jul 2004
Posts: 256
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello,

How should the strip_tags() function be include with cleaner.PHP?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:03 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.04015 seconds
  • Memory Usage 2,265KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete