AUBBC

 view release on metacpan or  search on metacpan

AUBBC.pm  view on Meta::CPAN

Advanced Universal Bulletin Board Code a Perl BBcode API

shakaflex [at] gmail.com

http://search.cpan.org/~sflex/

http://aubbc.googlecode.com/

Development Notes: Highlighting functions list and tags/commands for more
language highlighters. Ideas make some new tags like [perl] or have a command in the code
tag like [code]perl:print 'perl';[/code] with a default highlighting method if
a command was not used. Then highlighting of many types of code could be allowed
even markup like HTML.

Notes: This code has a lot of settings and works good
with most default settings see the POD and example files
in the archive for usage.

=head1 NAME

AUBBC

=head1 SYNOPSIS

  use AUBBC;
  my $aubbc = AUBBC->new();

AUBBC.pod  view on Meta::CPAN

Allows easy conversion to HTML and XHTML, existing tags will convert to the HTML type set.

If there isn't a popular tag available this module provides a method to "Build your own tags" custom tags can help link to parts of the current web page, other web pages and add other HTML elements.

=head1 Security

Security advice to ensure the proper usage of this module.

=head2 Database Manipulation

The default settings of AUBBC.pm is not good for most forums, blogs, wiki's and bulletin boards
because by default AUBBC should work and be secure. The other reason is these programs will want some
of the user input editable and portable.

For editing and portability purposes you would want to retain the tags or user input as they typed it,
but always use the script_escape before saving to a back-end. This will allow you to change the settings
of AUBBC on the fly so the tags remain portable to setting changes.
The script_escape filter is vital to security for many reasons and provides a standard format for other
methods of AUBBC. There is a file in the examples folder called Database_Manipulation.pm that try's to explain what settings
to change and how to stay safe.

=head2 Mixing HTML and BBcode

AUBBC.pod  view on Meta::CPAN


Default security levels are from low to high!!!

        # The array numbers >>:    0        1         2             3
        $aubbc->security_levels('Guest', 'User', 'Moderator','Administrator')

1) The security levels array needs to have the security levels from low to high in it!!

2) The names must be spelled the same as the name passed to method user_level();

3) Security access is determined by low to high numbers and with the default Guest
will be number/level 0 in the array. if the links was set for User
the links level will have to be 1 = User making any lower level unable to
see any bbcode links but, the Administrator would still see all.

=head2 Tag Security Levels

To change the security level of links, images and code use this method this way:

        $aubbc->tag_security(
                code         => { level => 0, text => 'register to see this', },

AUBBC.pod  view on Meta::CPAN

        type     => 1,
        function => 'My_Message::check_ok_tag',
        level    => 3,
        error    => 'register to see this',
        );
        
level - the array number of the security level

error - the text or HTML to show if user has no access

For the build tags leaving the variables blank will default level to 0 and
error to the $AUBBC::BAD_MESSAGE string.

=head2 User Access

This method receives the current users security level name from the web application.

        $aubbc->user_level('Administrator');

If you are using the tag security you will want to set the user_level after the user
was authenticated by the web application and before do_all_ubbc is used.

AUBBC.pod  view on Meta::CPAN


function - a pre-defined subroutine that receives the matched pattern, tag name and returns what you want,
unless type is set to 4 then it will replace the tag with what text is in the function.

   Note: if the function returns undefined, '' or 0 the tag will not be changed.

level - the array number of the security level

error - the text or HTML to show if user has no access

        Note: For the build tags leaving the variables blank will default level to 0 and
        error to the $AUBBC::BAD_MESSAGE string.

Usage:

  package My_Message;

  use AUBBC;
  my $aubbc = AUBBC->new();

  $aubbc->add_build_tag(

AUBBC.pod  view on Meta::CPAN


Changed - forgot to say in version 4.05 that I changed the aubbc_error so a new line
will be added after each inserted error.


v4.05 - 04/05/2011

Addition - Assign security levels for links, images, built and code tags.
New subroutine names: security_levels, user_level, tag_security, check_access

Changed - The default value for $AUBBC::BAD_MESSAGE is now 'Unathorized'

v4.04 - 02/05/2011

Fixed - Bug with quote tag, needed to convert all its tags.

v4.03 - 02/03/2011

Addition - New Object method aubbc_error . Developers can now controle if or when
to handle errors, see the POD 'Error Message' for usage.

AUBBC.pod  view on Meta::CPAN

Addition - Perl subroutine highlighting for the code tag highlighter. Had a
problem making this till this version because a HTML code name can look like
&TheName; and a Perl subroutine looked the same till ; got converted.

Addition - AUBBC::make_image($align,$src,$width,$height,$alt) this is useful enough
to mention once.

v4.00 - 11/02/2010

Addition - New feature to the code tags aubbc_setting code_download.
the default setting for code_download is '^Download above code^' this message will
be the links name. the link will open a JavaScript pop-up window and write the
code in it to be copied or printed to a printer. A new JavaScript function was
added to the js_print method called MyCodePrint. JavaScript makes this feature
portable and dynamic. the link for code_download is added after the code_extra
setting so a disclaimer can be added before the code_download link

Addition - $AUBBC::MEMOIZE This setting can turn AUBBC's usage of Memoize on or off.
Default setting 1 will check if it needs to load Memoize, if loaded then load the sub's that need the speed.
Setting 0 will not use Memoize.

AUBBC.pod  view on Meta::CPAN

Advanced Universal Bulletin Board Code a Perl BBcode API

shakaflex [at] gmail.com

http://search.cpan.org/~sflex/

http://aubbc.googlecode.com/

Development Notes: Highlighting functions list and tags/commands for more
language highlighters. Ideas make some new tags like [perl] or have a command in the code
tag like [code]perl:$some ='perl';[/code] with a default highlighting method if
a command was not used. Then highlighting of many types of code could be allowed
even markup like HTML.

Notes: This code has a lot of settings and works good
with most default settings see the POD and example files
in the archive for usage.

=cut

CHANGES  view on Meta::CPAN

in it, as intended.

Changed - forgot to say in version 4.05 that I changed the aubbc_error so a new line
will be added after each inserted error.

v4.05 - 04/05/2011

Addition - Assign security levels for links, images, built and code tags.
New subroutine names: security_levels, user_level, tag_security, check_access

Changed - The default value for $AUBBC::BAD_MESSAGE is now 'Unathorized'

v4.04 - 02/05/2011

Fixed - Bug with quote tag, needed to convert all its tags.

v4.03 - 02/03/2011

Addition - New Object method aubbc_error . Developers can now controle if or when
to handle errors, see the POD 'Error Message' for usage.

CHANGES  view on Meta::CPAN

Addition - Perl subroutine highlighting for the code tag highlighter. Had a
problem making this till this version because a HTML code name can look like
&TheName; and a Perl subroutine looked the same till ; got converted.

Addition - AUBBC::make_image($align,$src,$width,$height,$alt) this is useful enough
to mention once.

v4.00 - 11/02/2010

Addition - New feature to the code tags aubbc_setting code_download.
the default setting for code_download is '^Download above code^' this message will
be the links name. the link will open a JavaScript pop-up window and write the
code in it to be copied or printed to a printer. A new JavaScript function was
added to the js_print method called MyCodePrint. JavaScript makes this feature
portable and dynamic. the link for code_download is added after the code_extra
setting so a disclaimer can be added before the code_download link

Addition - $AUBBC::MEMOIZE This setting can turn AUBBC's usage of Memoize on or off.
Default setting 1 will check if it needs to load Memoize, if loaded then load the sub's that need the speed.
Setting 0 will not use Memoize.

README  view on Meta::CPAN

Allows easy conversion to HTML and XHTML, existing tags will convert to the HTML type set.

If there isn't a popular tag available this module provides a method to "Build your own tags" custom tags can help link to parts of the current web page, other web pages and add other HTML elements.

=head1 Security

Security advice to ensure the proper usage of this module.

=head2 Database Manipulation

The default settings of AUBBC.pm is not good for most forums, blogs, wiki's and bulletin boards
because by default AUBBC should work and be secure. The other reason is these programs will want some
of the user input editable and portable.

For editing and portability purposes you would want to retain the tags or user input as they typed it,
but always use the script_escape before saving to a back-end. This will allow you to change the settings
of AUBBC on the fly so the tags remain portable to setting changes.
The script_escape filter is vital to security for many reasons and provides a standard format for other
methods of AUBBC. There is a file in the examples folder called Database_Manipulation.pm that try's to explain what settings
to change and how to stay safe.

=head2 Mixing HTML and BBcode

README  view on Meta::CPAN


Default security levels are from low to high!!!

        # The array numbers >>:    0        1         2             3
        $aubbc->security_levels('Guest', 'User', 'Moderator','Administrator')

1) The security levels array needs to have the security levels from low to high in it!!

2) The names must be spelled the same as the name passed to method user_level();

3) Security access is determined by low to high numbers and with the default Guest
will be number/level 0 in the array. if the links was set for User
the links level will have to be 1 = User making any lower level unable to
see any bbcode links but, the Administrator would still see all.

=head2 Tag Security Levels

To change the security level of links, images and code use this method this way:

        $aubbc->tag_security(
                code         => { level => 0, text => 'register to see this', },

README  view on Meta::CPAN

        type     => 1,
        function => 'My_Message::check_ok_tag',
        level    => 3,
        error    => 'register to see this',
        );

level - the array number of the security level

error - the text or HTML to show if user has no access

For the build tags leaving the variables blank will default level to 0 and
error to the $AUBBC::BAD_MESSAGE string.

=head2 User Access

This method receives the current users security level name from the web application.

        $aubbc->user_level('Administrator');

If you are using the tag security you will want to set the user_level after the user
was authenticated by the web application and before do_all_ubbc is used.

README  view on Meta::CPAN


function - a pre-defined subroutine that receives the matched pattern, tag name and returns what you want,
unless type is set to 4 then it will replace the tag with what text is in the function.

   Note: if the function returns undefined, '' or 0 the tag will not be changed.

level - the array number of the security level

error - the text or HTML to show if user has no access

        Note: For the build tags leaving the variables blank will default level to 0 and
        error to the $AUBBC::BAD_MESSAGE string.

Usage:

  package My_Message;

  use AUBBC;
  my $aubbc = AUBBC->new();

  $aubbc->add_build_tag(

README  view on Meta::CPAN


Changed - forgot to say in version 4.05 that I changed the aubbc_error so a new line
will be added after each inserted error.


v4.05 - 04/05/2011

Addition - Assign security levels for links, images, built and code tags.
New subroutine names: security_levels, user_level, tag_security, check_access

Changed - The default value for $AUBBC::BAD_MESSAGE is now 'Unathorized'

v4.04 - 02/05/2011

Fixed - Bug with quote tag, needed to convert all its tags.

v4.03 - 02/03/2011

Addition - New Object method aubbc_error . Developers can now controle if or when
to handle errors, see the POD 'Error Message' for usage.

README  view on Meta::CPAN

Addition - Perl subroutine highlighting for the code tag highlighter. Had a
problem making this till this version because a HTML code name can look like
&TheName; and a Perl subroutine looked the same till ; got converted.

Addition - AUBBC::make_image($align,$src,$width,$height,$alt) this is useful enough
to mention once.

v4.00 - 11/02/2010

Addition - New feature to the code tags aubbc_setting code_download.
the default setting for code_download is '^Download above code^' this message will
be the links name. the link will open a JavaScript pop-up window and write the
code in it to be copied or printed to a printer. A new JavaScript function was
added to the js_print method called MyCodePrint. JavaScript makes this feature
portable and dynamic. the link for code_download is added after the code_extra
setting so a disclaimer can be added before the code_download link

Addition - $AUBBC::MEMOIZE This setting can turn AUBBC's usage of Memoize on or off.
Default setting 1 will check if it needs to load Memoize, if loaded then load the sub's that need the speed.
Setting 0 will not use Memoize.

README  view on Meta::CPAN

Advanced Universal Bulletin Board Code a Perl BBcode API

shakaflex [at] gmail.com

http://search.cpan.org/~sflex/

http://aubbc.googlecode.com/

Development Notes: Highlighting functions list and tags/commands for more
language highlighters. Ideas make some new tags like [perl] or have a command in the code
tag like [code]perl:$some ='perl';[/code] with a default highlighting method if
a command was not used. Then highlighting of many types of code could be allowed
even markup like HTML.

Notes: This code has a lot of settings and works good
with most default settings see the POD and example files
in the archive for usage.

=cut

examples/tag_list.cgi  view on Meta::CPAN

#!perl

use strict;
use warnings;
#use lib '../';
use AUBBC;
my $aubbc = AUBBC->new();

# Change some default settings
$aubbc->settings(
        protect_email => 4,
        html_type => 'xhtml',
        code_class => ' class="codepost"',
        code_extra => '<div style="clear: left"> </div>',
        quote_class => ' class="quote"',
        quote_extra => '<div style="clear: left"> </div>',
        highlight_class1 => ' class="highlightclass1"',
        highlight_class2 => ' class="highlightclass2"',
        highlight_class3 => ' class="highlightclass1"',



( run in 0.642 second using v1.01-cache-2.11-cpan-0a6323c29d9 )