Intereaction with Drupal filters
itman - February 25, 2008 - 03:23
| Project: | UIE Forum |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | zoro |
| Status: | active |
Jump to:
Description
Hi,
this is actually a couple of bugs concerned with filtering
1) uieforum_apply_filters invokes all filters specified in the admin interface. Yet, corresponding functions are called with $format == -1:
$fname = "{$module}_filter";
$text = $fname('prepare', $delta, -1, $text);
$text = $fname('process', $delta, -1, $text);Due to peculiarities of Drupal filter system different filters have different configurations DEPENDING ON THE NAME OF INPUT FORMAT. For example, you can create two formats and apply HTML filter to both of them. However, these formats witll have DIFFERENT sets of allowed tags. Thus, when you invoke, a filter with $format == -1, you ARE MISSING this configuration to the point where some filters (example Drutex) stop working completely.
It is safer (but not ideally) to substitute -1 with variable_get('filter_default_format', 1). I suppose that it might be even better just to specify the exact name of the INPUT FORMAT that should be used in UIE Forum along with BB codes. Then the user decide if she turns additional filtering on or off. The change affects both the code and UIE admin interface.
2) In this two lines of
$post_content[0]['data'] .= uieforum_apply_filters( uieforum_filter('process', null, null, $PostText, <b>true</b> );
...
$post_content[1]['data'] .= "<div class='uieforum_postcontent'>".uieforum_apply_filters( uieforum_filter('process', null, null, $PostText, <b>true</b>) )."</div>"; uieforum_apply_filters is invoked with the last parameter set to FALSE. In fact, that prevents other non-BB-filter from working properly. For example, HTML tags are simply escaped even allowed once.

#1
Sorry - what? :)
#2
ya somethings wrong the drupal default filters do not work under uieframework
likek my url filter doesnt work sme in and out of uie
i am not abe to clip long links in uie using the url filter modified to like max length allowed =20, its working outside uieforum on a normal page with full html formating :(
#3
Itman - I've just re-read your post, and it makes sense to me now.
What I'd like to know is how you would suggest that I auto populate that filter format variable, instead of just defaulting to false/-1?
#4
I am sorry, I've been out of Drupal project for a couple of month, so I cannot suggest anything good. One needs to check core code. Yet, it would be great if you fix the code yourself, because my fix cancels all BB codes including quote. I have to fix my fix to process [quote] :-(