BBCodeBox3

prosilver | subsilver2

Willkommen und Guten Morgen, Guest  Beim nächsten Piep ist es zwischen 7:00 und 8:00 Uhr

It is currently Sun 23. Feb 2025, 08:37

All times are UTC + 1 hour [ DST ]




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 10 posts ] 
Author Message
PostPosted: Thu 22. Apr 2010, 01:21 
Administrator
User avatar

Posts: 427

Last 3 Topics:
Tabmenu Test
[Snippet] Avatar Ev...
[DEV] Zero and X-P...

Joined:
Sun 13. Jan 2008, 23:44

Formatted Censor Text

Request By: Flor1s
Request Post: http://www.phpbb.com/community/viewtopi ... &t=2071995

Description: With this Snippet u can format your censored words in an easy way.

Works for:
- Search (Topic-Title and Subject) ex. http://4seven.bplaced.net/phpbb3/search.php ... elix+catus
- Posting (Preview and Review and Subjects in Preview. Also auto-extracting tags from Subjects and Post-Text by Quoting from Post and Review)
- Viewforum (Topic-Title) ex. http://4seven.bplaced.net/phpbb3/viewforum.php?f=11 (Felix catus)
- Viewtopic (Topic-Title, Subjects and Post-Text)
- PM-Overview (Title)
- PM-View (Title and Message)
- PM Composing (Preview-Title and Preview-Message)
- Quick Reply (Re: Subject)




ACP Censors
http://www.loaditup.de/files/487144.png

Result
http://4seven.bplaced.net/phpbb3/viewtopic. ... 1192#p1192



Instruction

Edit following files:
- posting.php
- search.php
- viewforum.php
- viewtopic.php
- includes/functions_posting.php
- includes/ucp/ucp_pm_compose.php
- includes/ucp/ucp_pm_viewfolder.php
- includes/ucp/ucp_pm_viewmessage.php


Top
 Profile  
 
PostPosted: Fri 23. Apr 2010, 14:12 
Administrator
User avatar

Posts: 427

Last 3 Topics:
Tabmenu Test
[Snippet] Avatar Ev...
[DEV] Zero and X-P...

Joined:
Sun 13. Jan 2008, 23:44

open

posting.php

find

Code:
        $template->assign_vars(array(
            'PREVIEW_SUBJECT'        => $preview_subject,     


before add

Code:
    // Formatted Censor Text / 4seven / 2010    
    $preview_subject = preg_replace(
        
        array
(
        '#\[b\](.*?)\[\/b\]#is',
        '#\[i\](.*?)\[\/i\]#is',
        '#\[u\](.*?)\[\/u\]#is'
        ),     
        
        array
(
        '<span style="font-weight: bold;">$1</span>',
        '<span style="font-style: italic;">$1</span>',
        '<span style="text-decoration: underline;">$1</span>'
        ),     
        
        $preview_subject
        
        
); 
    
// Formatted Censor Text / 4seven / 2010    


    // Formatted Censor Text / 4seven / 2010    
    $preview_message = preg_replace(
        
        array
(
        '#\[b\](.*?)\[\/b\]#is',
        '#\[i\](.*?)\[\/i\]#is',
        '#\[u\](.*?)\[\/u\]#is'
        ),     
        
        array
(
        '<span style="font-weight: bold;">$1</span>',
        '<span style="font-style: italic;">$1</span>',
        '<span style="text-decoration: underline;">$1</span>'
        ),     
        
        $preview_message
        
        
); 
    
// Formatted Censor Text / 4seven / 2010          


find

Code:
$post_data['post_text'] = $message_parser->message;     


after add

Code:
    // Formatted Censor Text / 4seven / 2010
    // Note: Don't change the replacement '$1'
        $post_data['post_text'] = preg_replace(
        
        array
(
        '#\[b\](.*?)\[\/b\]#is',
        '#\[i\](.*?)\[\/i\]#is',
        '#\[u\](.*?)\[\/u\]#is'
        ),     
        
        array
(
        '$1',
        '$1',
        '$1'
        ),     
        
        $post_data
['post_text']
        
        
);
    // Note: Don't change the replacement '$1'    
    // Formatted Censor Text / 4seven / 2010        


find

Code:
// Start assigning vars for main posting page ...
$template->assign_vars(array( 


before add

Code:
   // Formatted Censor Text / 4seven / 2010
   // Note: Don't change the replacement '$1'
   $post_data['post_subject'] = preg_replace(
    
    array
(
    '#\[b\](.*?)\[\/b\]#is',
    '#\[i\](.*?)\[\/i\]#is',
    '#\[u\](.*?)\[\/u\]#is'
    ),     
    
    array
(
    '$1',
    '$1',
    '$1'
    ),     
    
    $post_data
['post_subject']
    
    
);
   // Note: Don't change the replacement '$1'
   // Formatted Censor Text / 4seven / 2010

   // Formatted Censor Text / 4seven / 2010    
   $post_data_topic_title = preg_replace(
    
    array
(
    '#\[b\](.*?)\[\/b\]#is',
    '#\[i\](.*?)\[\/i\]#is',
    '#\[u\](.*?)\[\/u\]#is'
    ),     
    
    array
(
    '<span style="font-weight: bold;">$1</span>',
    '<span style="font-style: italic;">$1</span>',
    '<span style="text-decoration: underline;">$1</span>'
    ),     
    
    censor_text
($post_data['topic_title'])
    
    
);    
   
// Formatted Censor Text / 4seven / 2010      


find

Code:
    'TOPIC_TITLE'            => censor_text($post_data['topic_title']) 


replace with

Code:
    // 'TOPIC_TITLE'            => censor_text($post_data['topic_title'])
    // Formatted Censor Text / 4seven / 2010
    'TOPIC_TITLE'            => $post_data_topic_title,
    // Formatted Censor Text / 4seven / 2010          


back to list..


Top
 Profile  
 
PostPosted: Fri 23. Apr 2010, 14:14 
Administrator
User avatar

Posts: 427

Last 3 Topics:
Tabmenu Test
[Snippet] Avatar Ev...
[DEV] Zero and X-P...

Joined:
Sun 13. Jan 2008, 23:44

open

search.php

find

Code:
     $row['post_text'] = censor_text($row['post_text']);      


after add

Code:
// Formatted Censor Text / 4seven / 2010
        $row['post_text'] = preg_replace(
        
        array
(
        '#\[b\](.*?)\[\/b\]#is',
        '#\[i\](.*?)\[\/i\]#is',
        '#\[u\](.*?)\[\/u\]#is'
        ),     
        
        array
(
        '<span style="font-weight: bold;">$1</span>',
        '<span style="font-style: italic;">$1</span>',
        '<span style="text-decoration: underline;">$1</span>'
        ),     
        
        $row
['post_text']
        
        
); 
// Formatted Censor Text / 4seven / 2010                    


find

Code:
            $topic_title = censor_text($row['topic_title']); 


after add

Code:
        // Formatted Censor Text / 4seven / 2010                
        $topic_title = preg_replace(
        
        array
(
        '#\[b\](.*?)\[\/b\]#is',
        '#\[i\](.*?)\[\/i\]#is',
        '#\[u\](.*?)\[\/u\]#is'
        ),     
        
        array
(
        '<span style="font-weight: bold;">$1</span>',
        '<span style="font-style: italic;">$1</span>',
        '<span style="text-decoration: underline;">$1</span>'
        ),     
        
        $topic_title
        
        
); 
        
// Formatted Censor Text / 4seven / 2010       


find

Code:
                $row['post_subject'] = censor_text($row['post_subject']); 


after add

Code:
        // Formatted Censor Text / 4seven / 2010                
        $row['post_subject'] = preg_replace(
        
        array
(
        '#\[b\](.*?)\[\/b\]#is',
        '#\[i\](.*?)\[\/i\]#is',
        '#\[u\](.*?)\[\/u\]#is'
        ),     
        
        array
(
        '<span style="font-weight: bold;">$1</span>',
        '<span style="font-style: italic;">$1</span>',
        '<span style="text-decoration: underline;">$1</span>'
        ),     
        
        $row
['post_subject']
        
        
); 
        
// Formatted Censor Text / 4seven / 2010   


back to list..


Top
 Profile  
 
PostPosted: Fri 23. Apr 2010, 14:20 
Administrator
User avatar

Posts: 427

Last 3 Topics:
Tabmenu Test
[Snippet] Avatar Ev...
[DEV] Zero and X-P...

Joined:
Sun 13. Jan 2008, 23:44

open

viewforum.php

find

Code:
        // Send vars to template
        $template->assign_block_vars('topicrow', array( 


before add

Code:
    // Formatted Censor Text / 4seven / 2010
    $row_topic_last_post_subject = preg_replace(
    
    array
(
    '#\[b\](.*?)\[\/b\]#is',
    '#\[i\](.*?)\[\/i\]#is',
    '#\[u\](.*?)\[\/u\]#is'
    ),     
    
    array
(
    '<span style="font-weight: bold;">$1</span>',
    '<span style="font-style: italic;">$1</span>',
    '<span style="text-decoration: underline;">$1</span>'
    ),     
    
    censor_text
($row['topic_last_post_subject'])
    
    
);
    
    $row_topic_title 
= preg_replace(
    
    array
(
    '#\[b\](.*?)\[\/b\]#is',
    '#\[i\](.*?)\[\/i\]#is',
    '#\[u\](.*?)\[\/u\]#is'
    ),     
    
    array
(
    '<span style="font-weight: bold;">$1</span>',
    '<span style="font-style: italic;">$1</span>',
    '<span style="text-decoration: underline;">$1</span>'
    ),     
    
    censor_text
($row['topic_title'])
    
    
);
    // Formatted Censor Text / 4seven / 2010   


find

Code:
            'LAST_POST_SUBJECT'            => censor_text($row['topic_last_post_subject']),         


replace with

Code:
            // 'LAST_POST_SUBJECT'            => censor_text($row['topic_last_post_subject']),            
            // Formatted Censor Text / 4seven / 2010
            'LAST_POST_SUBJECT'            => $row_topic_last_post_subject,
            // Formatted Censor Text / 4seven / 2010   


find

Code:
            'TOPIC_TITLE'        => censor_text($row['topic_title']), 


replace with

Code:
            // 'TOPIC_TITLE'        => censor_text($row['topic_title']),            
            // Formatted Censor Text / 4seven / 2010
             'TOPIC_TITLE'        => $row_topic_title,
            // Formatted Censor Text / 4seven / 2010   


back to list..


Top
 Profile  
 
PostPosted: Fri 23. Apr 2010, 14:20 
Administrator
User avatar

Posts: 427

Last 3 Topics:
Tabmenu Test
[Snippet] Avatar Ev...
[DEV] Zero and X-P...

Joined:
Sun 13. Jan 2008, 23:44

open

viewtopic.php

find

Code:
$topic_data['topic_title'] = censor_text($topic_data['topic_title']); 


after add

Code:
    // Formatted Censor Text / 4seven / 2010
    // Note: Don't change the replacement '$1'
    $topic_data['topic_title'] = preg_replace(
    
    array
(
    '#\[b\](.*?)\[\/b\]#is',
    '#\[i\](.*?)\[\/i\]#is',
    '#\[u\](.*?)\[\/u\]#is'
    ),     
    
    array
(
    '$1',
    '$1',
    '$1'
    ), 

    $topic_data
['topic_title']
    
    
);
    
// Note: Don't change the replacement '$1'
    // Formatted Censor Text / 4seven / 2010       


find

Code:
    $message = censor_text($row['post_text']); 


after add

Code:
    // Formatted Censor Text / 4seven / 2010    
    $message = preg_replace(
    
    array
(
    '#\[b\](.*?)\[\/b\]#is',
    '#\[i\](.*?)\[\/i\]#is',
    '#\[u\](.*?)\[\/u\]#is'
    ),     
    
    array
(
    '<span style="font-weight: bold;">$1</span>',
    '<span style="font-style: italic;">$1</span>',
    '<span style="text-decoration: underline;">$1</span>'
    ),     
    
    $message
    
    
);
    // Formatted Censor Text / 4seven / 2010       


find

Code:
    $row['post_subject'] = censor_text($row['post_subject']); 


after add

Code:
    // Formatted Censor Text / 4seven / 2010
    $row['post_subject'] = preg_replace(
    
    array
(
    '#\[b\](.*?)\[\/b\]#is',
    '#\[i\](.*?)\[\/i\]#is',
    '#\[u\](.*?)\[\/u\]#is'
    ),     
    
    array
(
    '<span style="font-weight: bold;">$1</span>',
    '<span style="font-style: italic;">$1</span>',
    '<span style="text-decoration: underline;">$1</span>'
    ),     
    
    $row
['post_subject']
    
    
);
    // Formatted Censor Text / 4seven / 2010       


find

Code:
        $template->assign_vars(array(
            'S_QUICK_REPLY'            => true,  


before add

Code:
    // Formatted Censor Text / 4seven / 2010
    // Note: Don't change the replacement '$1'
    $quick_topic_data_topic_title = preg_replace(
    
    array
(
    '#\[b\](.*?)\[\/b\]#is',
    '#\[i\](.*?)\[\/i\]#is',
    '#\[u\](.*?)\[\/u\]#is'
    ),     
    
    array
(
    '$1',
    '$1',
    '$1'
    ),     
    
    censor_text
($topic_data['topic_title'])
    
    
);
    
// Note: Don't change the replacement '$1'
    // Formatted Censor Text / 4seven / 2010   


find

Code:
            'SUBJECT'                => 'Re: ' . censor_text($topic_data['topic_title'])  


replace with

Code:
            // 'SUBJECT'                => 'Re: ' . censor_text($topic_data['topic_title'])
            // Formatted Censor Text / 4seven / 2010
            'SUBJECT'                => 'Re: ' . $quick_topic_data_topic_title
            
// Formatted Censor Text / 4seven / 2010   


back to list..


Top
 Profile  
 
PostPosted: Fri 23. Apr 2010, 14:20 
Administrator
User avatar

Posts: 427

Last 3 Topics:
Tabmenu Test
[Snippet] Avatar Ev...
[DEV] Zero and X-P...

Joined:
Sun 13. Jan 2008, 23:44

open

includes/functions_posting.php

find

Code:
    $decoded_message = bbcode_nl2br($decoded_message);   


after add

Code:
    // Formatted Censor Text / 4seven / 2010
   // Note: Don't change the replacement '$1'
    $decoded_message = preg_replace(
    
    array
(
    '#\[b\](.*?)\[\/b\]#is',
    '#\[i\](.*?)\[\/i\]#is',
    '#\[u\](.*?)\[\/u\]#is'
    ),     
    
    array
(
    '$1',
    '$1',
    '$1'
    ),     
    
    $decoded_message
    
    
);
    // Note: Don't change the replacement '$1'
    // Formatted Censor Text / 4seven / 2010            


find

Code:
        $post_subject = censor_text($post_subject); 


after add

Code:
    // Formatted Censor Text / 4seven / 2010
    $post_subject = preg_replace(
    
    array
(
    '#\[b\](.*?)\[\/b\]#is',
    '#\[i\](.*?)\[\/i\]#is',
    '#\[u\](.*?)\[\/u\]#is'
    ),     
    
    array
(
    '<span style="font-weight: bold;">$1</span>',
    '<span style="font-style: italic;">$1</span>',
    '<span style="text-decoration: underline;">$1</span>'
    ),     
    
    $post_subject
    
    
);
    // Formatted Censor Text / 4seven / 2010        


find

Code:
        $template->assign_block_vars($mode . '_row', array(   


before add

Code:
    // Formatted Censor Text / 4seven / 2010
    $message = preg_replace(
    
    array
(
    '#\[b\](.*?)\[\/b\]#is',
    '#\[i\](.*?)\[\/i\]#is',
    '#\[u\](.*?)\[\/u\]#is'
    ),     
    
    array
(
    '<span style="font-weight: bold;">$1</span>',
    '<span style="font-style: italic;">$1</span>',
    '<span style="text-decoration: underline;">$1</span>'
    ),     
    
    $message
    
    
);
    // Formatted Censor Text / 4seven / 2010        


back to list..


Top
 Profile  
 
PostPosted: Fri 23. Apr 2010, 14:21 
Administrator
User avatar

Posts: 427

Last 3 Topics:
Tabmenu Test
[Snippet] Avatar Ev...
[DEV] Zero and X-P...

Joined:
Sun 13. Jan 2008, 23:44

open

includes/ucp/ucp_pm_compose.php

find

Code:
            $template->assign_vars(array(
                
'PREVIEW_SUBJECT'        => $preview_subject,  


before add

Code:
    // Formatted Censor Text / 4seven / 2010    
    
$preview_subject preg_replace(
        
        array(
        
'#\[b\](.*?)\[\/b\]#is',
        
'#\[i\](.*?)\[\/i\]#is',
        
'#\[u\](.*?)\[\/u\]#is'
        
),     
        
        array(
        
'<span style="font-weight: bold;">$1</span>',
        
'<span style="font-style: italic;">$1</span>',
        
'<span style="text-decoration: underline;">$1</span>'
        
),     
        
        
$preview_subject
        
        
); 
   
    
$preview_message preg_replace(
        
        array(
        
'#\[b\](.*?)\[\/b\]#is',
        
'#\[i\](.*?)\[\/i\]#is',
        
'#\[u\](.*?)\[\/u\]#is'
        
),     
        
        array(
        
'<span style="font-weight: bold;">$1</span>',
        
'<span style="font-style: italic;">$1</span>',
        
'<span style="text-decoration: underline;">$1</span>'
        
),     
        
        
$preview_message
        
        
); 
    
// Formatted Censor Text / 4seven / 2010    


find

Code:
    // Start assigning vars for main posting page ...
    
$template->assign_vars(array(  


before add

Code:
    // Formatted Censor Text / 4seven / 2010    
    
$message_subject preg_replace(
        
        array(
        
'#\[b\](.*?)\[\/b\]#is',
        
'#\[i\](.*?)\[\/i\]#is',
        
'#\[u\](.*?)\[\/u\]#is'
        
),     
        
        array(
        
'$1',
        
'$1',
        
'$1'
        
),     
        
        
$message_subject
        
        
); 
  
    
$message_text preg_replace(
        
        array(
        
'#\[b\](.*?)\[\/b\]#is',
        
'#\[i\](.*?)\[\/i\]#is',
        
'#\[u\](.*?)\[\/u\]#is'
        
),     
        
        array(
        
'$1',
        
'$1',
        
'$1'
        
),     
        
        
$message_text
        
        
); 
    
// Formatted Censor Text / 4seven / 2010    


back to list..


Top
 Profile  
 
PostPosted: Sun 25. Apr 2010, 15:43 
Administrator
User avatar

Posts: 427

Last 3 Topics:
Tabmenu Test
[Snippet] Avatar Ev...
[DEV] Zero and X-P...

Joined:
Sun 13. Jan 2008, 23:44

open

includes/ucp/ucp_pm_viewfolder.php

find

Code:
                // Send vars to template
                
$template->assign_block_vars('messagerow', array(   


before add

Code:
    // Formatted Censor Text / 4seven / 2010        
    
$row_message_subject preg_replace(
    
    array(
    
'#\[b\](.*?)\[\/b\]#is',
    
'#\[i\](.*?)\[\/i\]#is',
    
'#\[u\](.*?)\[\/u\]#is'
    
),     
    
    array(
    
'<span style="font-weight: bold;">$1</span>',
    
'<span style="font-style: italic;">$1</span>',
    
'<span style="text-decoration: underline;">$1</span>'
    
),     
    
    
censor_text($row['message_subject'])
    
    );
    
// Formatted Censor Text / 4seven / 2010       


find

Code:
                     'SUBJECT'            => censor_text($row['message_subject']),   


replace with

Code:
                    // 'SUBJECT'            => censor_text($row['message_subject']),
                    // Formatted Censor Text / 4seven / 2010
                     
'SUBJECT'            => $row_message_subject,
                    
// Formatted Censor Text / 4seven / 2010       


back to list..


Top
 Profile  
 
PostPosted: Sun 25. Apr 2010, 15:43 
Administrator
User avatar

Posts: 427

Last 3 Topics:
Tabmenu Test
[Snippet] Avatar Ev...
[DEV] Zero and X-P...

Joined:
Sun 13. Jan 2008, 23:44

open

includes/ucp/ucp_pm_viewmessage.php

find

Code:
    $template->assign_vars(array(  


before add

Code:
    // Formatted Censor Text / 4seven / 2010        
    
$message_row['message_subject'] = preg_replace(
    
    array(
    
'#\[b\](.*?)\[\/b\]#is',
    
'#\[i\](.*?)\[\/i\]#is',
    
'#\[u\](.*?)\[\/u\]#is'
    
),     
    
    array(
    
'<span style="font-weight: bold;">$1</span>',
    
'<span style="font-style: italic;">$1</span>',
    
'<span style="text-decoration: underline;">$1</span>'
    
),     
    
    
$message_row['message_subject']
    
    );
    
    
$message preg_replace(
    
    array(
    
'#\[b\](.*?)\[\/b\]#is',
    
'#\[i\](.*?)\[\/i\]#is',
    
'#\[u\](.*?)\[\/u\]#is'
    
),     
    
    array(
    
'<span style="font-weight: bold;">$1</span>',
    
'<span style="font-style: italic;">$1</span>',
    
'<span style="text-decoration: underline;">$1</span>'
    
),     
    
    
$message
    
    
);
    
// Formatted Censor Text / 4seven / 2010     


back to list..


Top
 Profile  
 
PostPosted: Sun 25. Apr 2010, 16:18 
Administrator
User avatar

Posts: 427

Last 3 Topics:
Tabmenu Test
[Snippet] Avatar Ev...
[DEV] Zero and X-P...

Joined:
Sun 13. Jan 2008, 23:44

Hints

I format the code, so u can better check out, how it works.

Expand/reduce the preg_replace finds/replacements in all files as u want (but parallel ;-) )
and enter the Censor Replacements in this way http://www.loaditup.de/files/487144.png


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 10 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
POWERED_BY
[ Time : 0.023s | 28 Queries | GZIP : Off | Board-Version: 3.0.7 PL1 ]