Create BBCodes in ACP  2.2.10  Invision Power Board 1.3
Description de la Mod Create your own BBCode and the button in ACP stored in the database
Compatibilité de la Mod Invision Power Board 1.3
Catégorie de la Mod Major Mod
Auteur de la Mod Peter
Adresse e-mail de l'auteur de la mod Peter@ibforen.de
Info Fichier sources/mods/bbcode/mod_bbcode_howto.htm
Version de la Mod 2.2.10
Commentaires Distribution interdite. Téléchargement autorisé depuis ibforen.de.
Tous les changements peuvent être reconnus avec le mod_token

Cette page html-howto a été créée par The ModInstaller 1.3.2 de
Peter@ibforen.de, sorti le 2007-01-08
Date de création 2009-10-31

Ce n'est pas pour un usage public.

Attention
  • Cette Mod n'est pas libre.
  • La redistribution de ce howto ou d'un des fichiers de la mod est interdite. La redistribution de la mod ou de ses fichiers seulement est soumise à mon autorisation.
  • La personnalisation de la Mod, afin d'adapter le skin de votr forum, est la bienvenue. Partager vos expériences avec la communauté également. Mais n'enfreignez pas mon copyright en distribuant des portions de code dérivées de cette mod.
  • La violation de ces règles m'ammèneraient à stopper toute production de modifications ou programmes libres. SVP, respectez le travail créatif des codeurs et le salut de leurs copyrights.
Mod Token mod_bbcode

 Contenu

1 Nouveautés et changements
2 Fichier(s) modifié(s) par la mod
3 Copie
4 Code
5 Personnalisation
6 Commentaires
7 Historiques des changements

 1.  Nouveautés et changements

2.2.10


2.2.9


2.2.8


2.2.7


2.2.6/b]


[b]2.2.5



2.2.4


2.2.3


2.2.2


2.2.1


2.2


2.1g


2.1c


2.1

Update:


 2.  Fichier(s) modifié(s) par la mod
Changed file Changed function
admin.php do_admin_stuff(..), do_admin_stuff(..)
html/ibfcode.js class properties or methods
html/ibfcode.js closeall(..), simpletag(..)
html/ibfcode.js doInsert(..)
html/ibfcode.js simpletag(..)
html/ibfcode.js tag_image(..)
html/ibfcode.js tag_list(..)
html/ibfcode.js tag_url(..)
index.php body
sources/Admin/admin_pages.php body
sources/Admin/ad_groups.php group_form(..)
sources/Admin/ad_groups.php save_group(..)
sources/Admin/ad_settings.php ad_settings(..)
sources/Admin/ad_settings.php avatars(..)
sources/calendar.php class properties or methods
sources/calendar.php class properties or methods(..), new_event(..), new_event(..)
sources/lib/post_parser.php convert(..)
sources/lib/post_parser.php convert(..), regex_parse_quotes(..)
sources/lib/post_parser.php regex_build_url(..)
sources/lib/post_parser.php regex_html_tag(..)
sources/lib/post_parser.php regex_sql_tag(..)
sources/lib/post_parser.php unconvert(..)
sources/lib/post_parser.php wrap_style(..)
sources/lib/post_q_reply_post.php show_form(..)
sources/lib/usercp_functions.php do_profile(..)
sources/Messenger.php class properties or methods
sources/Messenger.php edit_saved(..)
sources/Messenger.php send_form(..)
sources/mod_cp.php complete_user_edit(..)
sources/mod_cp.php edit_user(..)
sources/Post.php html_post_body(..)
sources/Post.php html_start_form(..)
sources/Post.php html_topic_summary(..)
sources/Topics.php Topics(..)
sources/Usercp.php personal(..)
sources/Usercp.php signature(..)

 3.  Copie

Attention: Update 2.0 ⇒ 2.01

Before a new installation of version 2.01 and before uploading these files you must uninstall the previous 2.0 with the old CodeChange.php. But do not remove then changes on the database. Otherwise you will loose your current bbcodes.

This step is necessary because of the new mod structure. Changes in sources/lib/post_xxx_post.php are not longer needed, so we have to remove the changes.

Then copy all files in folder upload of archive into the root dir of your board. Take care of the structure of this archive.


 4.  Code


Étape  1:  Ouvrir admin.php

  Trouver dans function do_admin_stuff(..), do_admin_stuff(..)

    $IN['act'] = $IN['act'] == '' ? "idx" : $IN['act'];

     Ajouter en-dessous le code en bleu

    $IN['act'] = $IN['act'] == '' ? "idx" : $IN['act'];



//-- mod_bbcode begin
    if ($IN['act'] == "bbcode") {
        if (file_exists(ROOT_PATH."sources/mods/bbcode/mod_bbcode_ad_func.php")) {
            require ROOT_PATH."sources/mods/bbcode/mod_bbcode_ad_func.php";
            $idx=new bbcode;
        }
        else {
            die("Could not call required function from file 'sources/mods/bbcode/mod_bbcode_ad_func.php'<br>Does it exist?");
        }
    }
//-- mod_bbcode end



Étape  2:  Ouvrir index.php

  Trouver

require ROOT_PATH."conf_global.php";

     Ajouter en-dessous le code en bleu

require ROOT_PATH."conf_global.php";



//-- mod_bbcode begin
    if (file_exists(ROOT_PATH."sources/mods/bbcode/mod_bbcode_func.php")) {
        require ROOT_PATH."sources/mods/bbcode/mod_bbcode_func.php";
        $my_bbcode = new bbcode_user;
    }
    else {
        die("Could not call required function from file 'sources/mods/bbcode/mod_bbcode_func.php'<br>Does it exist?");
    }
//-- mod_bbcode end



Étape  3:  Ouvrir sources/Admin/ad_groups.php

  A. Trouver dans function save_group(..)

                             'g_edit_topic'            => $IN['g_edit_topic'],
                             'g_email_limit'        => intval($IN['join_limit']).':'.intval($IN['join_flood']),

     Ajouter en-dessous le code en bleu

                             'g_edit_topic'            => $IN['g_edit_topic'],
                             'g_email_limit'        => intval($IN['join_limit']).':'.intval($IN['join_flood']),



//-- mod_bbcode begin
                             'mod_bbcodes_set'=> $IN['button_set'],
//-- mod_bbcode end


  B. Trouver dans function group_form(..)

                                                  $SKIN->form_yes_no("g_hide_from_list", $group['g_hide_from_list'] )
                                         )      );

     Ajouter en-dessous le code en bleu

                                                  $SKIN->form_yes_no("g_hide_from_list", $group['g_hide_from_list'] )
                                         )      );



//-- mod_bbcode begin
        $lang = $std->load_words($this->lang, 'mod_bbcode_ad_lang', $ADMIN->lang_id);

        $DB->query("SELECT * FROM ibf_bbcodes_sets");

        while ($s = $DB->fetch_row())
            $sets[] = array('0' => $s['id'], '1' => $s['name'] );
        $ADMIN->html .= $SKIN->add_td_row( array($lang['ad_bbcodeset'],
                                                 $SKIN->form_dropdown("button_set", $sets, $group['mod_bbcodes_set']),
                                          )      );
//-- mod_bbcode end



Étape  4:  Ouvrir sources/lib/post_parser.php

  A. Trouver dans function convert(..)

            $txt = preg_replace( "#\[code\](.+?)\[/code\]#ies", "\$this->regex_code_tag('\\1')", $txt );

     Ajouter au-dessus le code en bleu



//-- mod_bbcode begin
            if (!$ibforums->vars['std_buttons_off'])
//-- mod_bbcode end


            $txt = preg_replace( "#\[code\](.+?)\[/code\]#ies", "\$this->regex_code_tag('\\1')", $txt );

  B. Trouver dans function convert(..)

            $txt = preg_replace( "#\[code\](.+?)\[/code\]#ies", "\$this->regex_code_tag('\\1')", $txt );

     Ajouter en-dessous le code en bleu

            $txt = preg_replace( "#\[code\](.+?)\[/code\]#ies", "\$this->regex_code_tag('\\1')", $txt );



//-- mod_bbcode begin
            global $my_bbcode;
            if (!class_exists("bbcode_user") ) {
                if (file_exists(ROOT_PATH."sources/mods/bbcode/mod_bbcode_func.php")) {
                    require ROOT_PATH."sources/mods/bbcode/mod_bbcode_func.php";
                    $my_bbcode = new bbcode_user;
                }
                else {
                    die("Could not call required function from file 'sources/mods/bbcode/mod_bbcode_func.php'<br>Does it exist?");
                }
            }
            $txt = $my_bbcode->convert($txt);
//-- mod_bbcode end


  C. Trouver dans function convert(..), regex_parse_quotes(..)

        $txt = preg_replace( "/\n/", "<br>", $txt );

     Ajouter au-dessus le code en bleu



//-- mod_bbcode begin
        $txt = str_replace( "\n", "<br />", $txt );
//-- mod_bbcode end


        $txt = preg_replace( "/\n/", "<br>", $txt );

  D. Trouver dans function unconvert(..)

        if ($code == 1)
        {

     Ajouter en-dessous le code en bleu

        if ($code == 1)
        {



//-- mod_bbcode begin
            global $my_bbcode;
            if (!class_exists("bbcode_user") ) {
                if (file_exists(ROOT_PATH."sources/mods/bbcode/mod_bbcode_func.php")) {
                    require ROOT_PATH."sources/mods/bbcode/mod_bbcode_func.php";
                    $my_bbcode = new bbcode_user;
                }
                else {
                    die("Could not call required function from file 'sources/mods/bbcode/mod_bbcode_func.php'<br>Does it exist?");
                }
            }
            $txt = $my_bbcode->unconvert($txt);
//-- mod_bbcode end


  E. Trouver dans function unconvert(..)

            $txt = preg_replace( "#(\[/QUOTE\])\s*?<br>\s*#si", "\\1\n", $txt );

     Ajouter au-dessus le code en bleu



//-- mod_bbcode begin
            $txt = preg_replace( "#(\[/QUOTE\])\s*?<br \/>\s*#si", "\\1\n", $txt );
//-- mod_bbcode end


            $txt = preg_replace( "#(\[/QUOTE\])\s*?<br>\s*#si", "\\1\n", $txt );

  F. Trouver dans function unconvert(..)

        $txt = preg_replace( "#<br>#", "\n", $txt );

     Ajouter au-dessus le code en bleu



//-- mod_bbcode begin
        $txt = str_replace( "<br />", "\n", $txt );
//-- mod_bbcode end


        $txt = preg_replace( "#<br>#", "\n", $txt );

  G. Trouver dans function wrap_style(..)

        return array( 'START' => "</div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>{$possible_use[$in[STYLE]][1]}</b> {$in[EXTRA]}</td></tr><tr><td id='{$possible_use[ $in[STYLE] ][0]}'>",

     Ajouter au-dessus le code en bleu



//-- mod_bbcode begin
        global $std;
        
        if (!isset($ibforums->lang_id)) {
            if ( defined( 'IN_ACP' ) ) {
                global $ADMIN;
                $ibforums->lang_id = $ADMIN->lang_id;
            }
            else {
                $ibforums->lang_id = $ibforums->member['language'] ? $ibforums->member['language'] : $ibforums->vars['default_language'];
            }
            $ibforums->lang = $std->load_words($ibforums->lang, 'mod_bbcode_lang', $ibforums->lang_id);
        }
        
        if (!isset($ibforums->lang['bb_code_title'])) {
            $ibforums->lang = $std->load_words($ibforums->lang, 'mod_bbcode_lang', $ibforums->lang_id);
        }
        
        $possible_use['CODE'] = array( 'CODE',  $ibforums->lang['bb_code_title'] );
        $possible_use['QUOTE'] = array( 'QUOTE',  $ibforums->lang['bb_quote_title'] );
        $possible_use['SQL'] = array( 'CODE',  $ibforums->lang['bb_sql_title'] );
        $possible_use['PHP'] = array( 'CODE',  $ibforums->lang['bb_php_title'] );
        return array( 'START' => "<div style='width:___BOXWIDTH___px;'><div class='codebox_title' style='width:70%;float:left;'><b>{$possible_use[$in[STYLE]][1]}</b> {$in[EXTRA]}</div><!--CODEBOX_DIV_BEGIN<div class='codebox_title' style='width:28%;float:left;font-size:9px;text-align:right;'><a href='#' onclick='return SelectAllInBox(this,___JSQUOTE___{$possible_use[ $in[STYLE] ][0]}___JSQUOTE___)'>BOX_SELECT</a>&nbsp;&nbsp;&nbsp;<a href='#' onclick='return ToggleBox(this,___JSQUOTE___{$possible_use[ $in[STYLE] ][0]}___JSQUOTE___)'>BOX_EXPAND</a></div>CODEBOX_DIV_END--><br clear='all' /><div id='{$possible_use[ $in[STYLE] ][0]}' CODEBOX_STYLE>",
                      'END'   => "</div></div>"
                    );
//-- mod_bbcode end


        return array( 'START' => "</div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>{$possible_use[$in[STYLE]][1]}</b> {$in[EXTRA]}</td></tr><tr><td id='{$possible_use[ $in[STYLE] ][0]}'>",

  H. Trouver dans function regex_html_tag(..)

        $html = preg_replace( "/^<br>/", "", $html );

     Ajouter au-dessus le code en bleu



//-- mod_bbcode begin
        $html = preg_replace( "`^<br />`", "", $html );
//-- mod_bbcode end


        $html = preg_replace( "/^<br>/", "", $html );

  I. Trouver dans function regex_sql_tag(..)

        $sql = preg_replace( "/^<br>/", "", $sql );

     Ajouter au-dessus le code en bleu



//-- mod_bbcode begin
        $sql = preg_replace( "`^<br />`", "", $sql );
//-- mod_bbcode end


        $sql = preg_replace( "/^<br>/", "", $sql );

  J. Trouver dans function regex_build_url(..)

        return $url['st'] . "<a href='".$url['html']."' target='_blank'>".$show."</a>" . $url['end'];

     Ajouter au-dessus le code en bleu



//-- mod_bbcode begin
        global $ibforums;
        $domain = parse_url($ibforums->vars['board_url']);
        $domain = $domain['scheme']."://".$domain['host'];
        if ($ibforums->vars['url_nofollow'] && strpos($url['html'], $domain) === FALSE )
            return $url['st'] . "<a href='".$url['html']."' target='_blank' rel='nofollow'>".$show."</a>" . $url['end'];
        else
//-- mod_bbcode end


        return $url['st'] . "<a href='".$url['html']."' target='_blank'>".$show."</a>" . $url['end'];


Étape  5:  Ouvrir sources/lib/post_q_reply_post.php

  Trouver dans function show_form(..)

        //-------------------------------------------------
        // Do we have any posting errors?

     Ajouter au-dessus le code en bleu



//-- mod_bbcode begin
        if (isset($ibforums->input['quote'])) {
            $this->quoted_post['post'] = $std->txt_htmlspecialchars(utf8_decode($_GET['quote']));
        }
//-- mod_bbcode end


        //-------------------------------------------------
        // Do we have any posting errors?


Étape  6:  Ouvrir sources/lib/usercp_functions.php

  A. Trouver dans function do_profile(..)

        $DB->query("SELECT * from ibf_pfields_data WHERE fedit=1");

     Ajouter au-dessus le code en bleu



//-- mod_bbcode begin
        $in = array('SMILIES'   => 0,
                    'CODE'      => 1,
                    'HTML'      => 0,
                    'SIGNATURE' => 0
                    );
//-- mod_bbcode end


        $DB->query("SELECT * from ibf_pfields_data WHERE fedit=1");

  B. Trouver dans function do_profile(..)

            $custom_fields[ 'field_'.$row['fid'] ] =

     Ajouter au-dessus le code en bleu



//-- mod_bbcode begin
            if ($ibforums->vars['profile_allow_ibc'] && $row['ftype'] != "drop") {
                $in['TEXT'] = $ibforums->input['field_'.$row['fid']];
                $query_id = $DB->query_id;
                $custom_fields[ 'field_'.$row['fid'] ] = $this->class->parser->convert($in);
                $DB->query_id = $query_id;
            }
            else
//-- mod_bbcode end


            $custom_fields[ 'field_'.$row['fid'] ] =

  C. Trouver dans function do_profile(..)

        // Start off our array
        //----------------------------------

     Ajouter en-dessous le code en bleu

        // Start off our array
        //----------------------------------



//-- mod_bbcode begin
        if ($ibforums->vars['profile_allow_ibc']) {
            $in['TEXT'] = $ibforums->input['Interests'];
            $ibforums->input['Interests'] = $this->class->parser->convert($in);
            $in['TEXT'] = $ibforums->input['Location'];
            $ibforums->input['Location'] = $this->class->parser->convert($in);
        }
//-- mod_bbcode end



Étape  7:  Ouvrir sources/Admin/ad_settings.php

  A. Trouver dans function ad_settings(..)

'sig_allow_ibc',

     Ajouter en-dessous le code en bleu

'sig_allow_ibc',



//-- mod_bbcode begin
                'profile_allow_ibc',
//-- mod_bbcode end


  B. Trouver dans function avatars(..)

                                          $SKIN->form_yes_no( "sig_allow_ibc", $INFO['sig_allow_ibc'] )
                                 )      );

     Ajouter en-dessous le code en bleu

                                          $SKIN->form_yes_no( "sig_allow_ibc", $INFO['sig_allow_ibc'] )
                                 )      );



//-- mod_bbcode begin
        $ADMIN->html .= $SKIN->add_td_row( array( "<b>Allow IBF Code in profile fields?<b>" ,
                                          $SKIN->form_yes_no( "profile_allow_ibc", $INFO['profile_allow_ibc'] )
                                 )      );
//-- mod_bbcode end



Étape  8:  Ouvrir sources/Admin/admin_pages.php

  Trouver

?>

     Ajouter au-dessus le code en bleu



//-- mod_bbcode begin
$PAGES[2][] = array( 'BBCodes', 'act=bbcode');
//-- mod_bbcode end


?>


Étape  9:  Ouvrir html/ibfcode.js

  A. Trouver

var HTML_open = 0;

     Ajouter en-dessous le code en bleu

var HTML_open = 0;



//-- mod_bbcode begin
//-- bbcode_open begin
//-- bbcode_open end
//-- mod_bbcode end


  B. Trouver

var is_mac    = (myAgent.indexOf("mac")!=-1);

     Ajouter en-dessous le code en bleu

var is_mac    = (myAgent.indexOf("mac")!=-1);



//-- mod_bbcode begin
var is_opera = (myAgent.indexOf("opera") != -1);
if (is_opera) {
    var myVersion = parseFloat(myAgent.substr(myAgent.indexOf('opera') + 6, 4) );
}
//-- mod_bbcode end


  C. Trouver dans function closeall(..), simpletag(..)

                eval("document.REPLIER." + tagRemove + ".value = ' " + tagRemove + " '");

     Ajouter au-dessus le code en bleu



/*-- mod_bbcode exclude begin


                eval("document.REPLIER." + tagRemove + ".value = ' " + tagRemove + " '");

  D. Trouver dans function closeall(..), simpletag(..)

eval("document.REPLIER." + tagRemove + ".value = ' " + tagRemove + " '");

     Ajouter en-dessous le code en bleu

eval("document.REPLIER." + tagRemove + ".value = ' " + tagRemove + " '");



-- mod_bbcode exclude end */

//-- mod_bbcode begin
                if (tagRemove == 'CODE')
                    eval("document.REPLIER." + tagRemove + "_.value = document.REPLIER." + tagRemove + "_.value.replace(/\\*$/,'');");
                else {
                    if (document.getElementsByName(tagRemove)[0])
                        eval("document.REPLIER." + tagRemove + ".value = document.REPLIER." + tagRemove + ".value.replace(/\\*$/,'');");
                    else if (document.getElementsByName("sel" + tagRemove)[0])
                        eval("document.REPLIER.sel" + tagRemove + ".value = document.REPLIER.sel" + tagRemove + ".value.replace(/\\*$/,'');");
                }
//-- mod_bbcode end


  E. Trouver dans function simpletag(..)

                eval("document.REPLIER." + thetag + ".value += '*'");

     Ajouter au-dessus le code en bleu



//-- mod_bbcode begin
                if (thetag == 'CODE')
                    eval("document.REPLIER." + thetag + "_.value += '*'");
                else
//-- mod_bbcode end


                eval("document.REPLIER." + thetag + ".value += '*'");

  F. Trouver dans function tag_list(..)

function tag_list()
{

     Ajouter en-dessous le code en bleu

function tag_list()
{



//-- mod_bbcode begin
    var Text = get_SelectedText();
    if (Text) {
        doInsert( "[LIST]\n[*]" + Text.replace(/\n/g, "\n[*]") + "[/LIST]\n", "", false);
        return;
    }
//-- mod_bbcode end


  G. Trouver dans function tag_url(..)

    var enterTITLE = prompt(text_enter_url_name, "My Webpage");

     Ajouter au-dessus le code en bleu



//-- mod_bbcode begin
    var enterTITLE = get_SelectedText();
    if (!enterTITLE)
//-- mod_bbcode end


    var enterTITLE = prompt(text_enter_url_name, "My Webpage");

  H. Trouver dans function tag_image(..)

function tag_image()

     Ajouter au-dessus le code en bleu



//-- mod_bbcode begin
function tag_self(tag) {
    doInsert("[" + tag + "/]", "", false);
}

function tag_one(tag) {
    eval("info = " + tag + "_info;");
    eval("preset = " + tag + "_preset;");
    eval("error = " + tag + "_error;");

    var param   = prompt(info, preset);

    if (!param) {
        alert(error);
        return;
    }

    doInsert("[" + tag + "]" + param + "[/" + tag + "]", "", false);
}


function tag_multiple(tag, params)
{

    var parameters = "";
    var params_array = new Array(params.length);
    for (i = 1; i <= params.length; i++) {
        eval("info = " + tag + "_info" + i + ";");
        eval("preset = " + tag + "_preset" + i + ";");
        eval("error = " + tag + "_error" + i + ";");
        param = prompt(info, preset);
        if (!param) {
            alert(error);
            return;
        }
         params_array[params[i-1] - 1] = param;
    }
    parameters = params_array.slice(0,params_array.length-1).join(",");
    doInsert("[" + tag + "=" + parameters + "]" + params_array[params_array.length-1] + "[/" + tag + "]", "", false);

}


function tag_select(theval, thetag) {
    if (theval == 0)
        return;
    if(doInsert("[" + thetag + "=" + theval + "]", "[/" + thetag + "]", true))
        pushstack(bbtags, thetag);
    eval("document.REPLIER.sel" + thetag + ".selectedIndex  = 0;");
    cstat();
}

function tag_newlist(tag, params)
{

    if (params == "2") {
        eval("info1 = " + tag + "_info1;");
        eval("preset1 = " + tag + "_preset1;");
        eval("info2 = " + tag + "_info2;");
        eval("preset2 = " + tag + "_preset2;");
    }
    else {
        eval("info2 = " + tag + "_info1;");
        eval("preset2 = " + tag + "_preset1;");
    }
    var option = "start";
    var option_list = "";
    
    if (params == "2") {
        param = prompt(info1, preset1);
    }

    while ( (option != "") && (option != null) )
    {
        option = prompt(info2, preset2);
        if ( (option != "") && (option != null) )
        {
            option_list = option_list + "[*]" + option + "\n";
        }
    }
    
    if ( option_list != "" ) {
        if (params == "2") 
            doInsert( "[" + tag + "=" + param + "]\n" + option_list + "[/" + tag + "]\n", "", false);
        else
            doInsert( "[" + tag + "]\n" + option_list + "[/" + tag + "]\n", "", false);
    }
}

function simple_BBCode(text) {
    if (text == "") return;

    var obj_ta = document.REPLIER.Post;

    text = text.replace(/\{cr\}/g,"\n");

    if ( (myVersion >= 4) && is_ie && is_win) {
        if(obj_ta.isTextEdit) {
            obj_ta.focus();
            var sel = document.selection;
            var rng = sel.createRange();
            rng.colapse;
            if((sel.type == "Text" || sel.type == "None") && rng != null){
                rng.text = text;
            }
        }
        else{
            obj_ta.value += text;
        }
    }
    else {
        if ( (myVersion >= 4) && is_win && (!is_opera || (is_opera && myVersion >= 8))) {
            var length = obj_ta.textLength;
            var start = obj_ta.selectionStart;
            var end = obj_ta.selectionEnd;
            var head = obj_ta.value.substring(0,start);
            var rng = obj_ta.value.substring(start, end);
            var tail = obj_ta.value.substring(end, length);
            if( start != end ){
                rng = text;
                obj_ta.value = head + rng + tail;
                start = start + rng.length;
            }
            else{
                obj_ta.value = head + text + tail;
                start = start + text.length;
            }
            obj_ta.selectionStart = start;
            obj_ta.selectionEnd = start;
        }
        else {
            obj_ta.value += text;
        }
    }

    obj_ta.focus();
    return;
}

function get_SelectedText() {
    var obj_ta = document.REPLIER.Post;

    if ( (myVersion >= 4) && is_ie && is_win) {
        if(obj_ta.isTextEdit) {
            var sel = document.selection;
            var rng = sel.createRange();
            rng.colapse;
            return rng.text;
        }
    }
    else {
        if ( (myVersion >= 4) && is_win && (!is_opera || (is_opera && myVersion >= 8))) {
            var length = obj_ta.textLength;
            var start = obj_ta.selectionStart;
            var end = obj_ta.selectionEnd;
            if( start != end ){
                return obj_ta.value.substring(start, end);
            }
        }
    }
}

<!-- bbcode_function -->
//-- mod_bbcode end


function tag_image()

  I. Trouver dans function doInsert(..)

        if(isSingle)
            isClose = true;

        obj_ta.value += ibTag;

     Ajouter au-dessus le code en bleu



//-- mod_bbcode begin
        // this should work with Mozillas
        if ( (myVersion >= 4) && is_win && (!is_opera || (is_opera && myVersion >= 8))) {
            var length = obj_ta.textLength;
            var start = obj_ta.selectionStart;
            var end = obj_ta.selectionEnd;
            var head = obj_ta.value.substring(0,start);
            var rng = obj_ta.value.substring(start, end);
            var tail = obj_ta.value.substring(end, length);
            if( start != end ){
                if (ibClsTag != "" && length > 0)
                    ibTag += rng + ibClsTag;
                else if (isSingle)
                    isClose = true;
                rng = ibTag;
                obj_ta.value = head + rng + tail;
                obj_ta.selectionStart = start;
                obj_ta.selectionEnd = start + rng.length;
            }
            else{
                if(isSingle)
                    isClose = true;
                obj_ta.value = head + ibTag + tail;
                start = start + ibTag.length;
                obj_ta.selectionStart = start;
                obj_ta.selectionEnd = start;
            }
        }
        else {
//-- mod_bbcode end


        if(isSingle)
            isClose = true;

        obj_ta.value += ibTag;

  J. Trouver dans function doInsert(..)

        if(isSingle)
            isClose = true;

        obj_ta.value += ibTag;

     Ajouter en-dessous le code en bleu

        if(isSingle)
            isClose = true;

        obj_ta.value += ibTag;



//-- mod_bbcode begin
        }
//-- mod_bbcode end



Étape 10:  Ouvrir sources/Post.php

  A. Trouver dans function html_start_form(..)

        $form = $this->html->get_javascript();

     Ajouter au-dessus le code en bleu



//-- mod_bbcode begin
        global $my_bbcode;
        if (isset($my_bbcode) && $ibforums->vars['codebox_collapsed']) {
            $this->output = $my_bbcode->change_codebox_style($this->output);
        }
        else {
            $this->output = str_replace("___JSQUOTE___", "\"", $this->output);
            $this->output = str_replace("CODEBOX_STYLE", "", $this->output);
            $this->output = str_replace("___BOXWIDTH___", $ibforums->vars['codebox_width'], $this->output);
            $this->output = str_replace("___BOXHEIGHT___", $ibforums->vars['codebox_height'], $this->output);
            $this->output = str_replace("___HEIGHT___", "height:{$ibforums->vars['codebox_height']}px;", $this->output);
        }
//-- mod_bbcode end


        $form = $this->html->get_javascript();

  B. Trouver dans function html_post_body(..)

        return $this->html->postbox_buttons($raw_post);

     Ajouter au-dessus le code en bleu



//-- mod_bbcode begin
        global $my_bbcode;
        $raw_post = $my_bbcode->update_postbox($this->html->postbox_buttons($raw_post));
        $raw_post = $my_bbcode->insert_codes($raw_post);
        $raw_post = $my_bbcode->clean_comments($raw_post);
        return $raw_post;
//-- mod_bbcode end


        return $this->html->postbox_buttons($raw_post);

  C. Trouver dans function html_topic_summary(..)

            $row['post']   = str_replace( "<br>", "<br />", $row['post'] );

     Ajouter en-dessous le code en bleu

            $row['post']   = str_replace( "<br>", "<br />", $row['post'] );



//-- mod_bbcode begin
            global $my_bbcode;
            if (isset($my_bbcode) && $ibforums->vars['codebox_collapsed']) {
                $row['post'] = $my_bbcode->change_codebox_style($row['post']);
            }
            else {
                $row['post'] = str_replace("___JSQUOTE___", "\"", $row['post']);
                $row['post'] = str_replace("CODEBOX_STYLE", "", $row['post']);
                $row['post'] = str_replace("___BOXHEIGHT___", $ibforums->vars['codebox_height'], $row['post']);
                $row['post'] = str_replace("___BOXWIDTH___", $ibforums->vars['codebox_width'], $row['post']);
                $row['post'] = str_replace("___HEIGHT___", "height:{$ibforums->vars['codebox_height']}px;", $row['post']);
            }
//-- mod_bbcode end



Étape 11:  Ouvrir sources/Messenger.php

  A. Trouver dans function send_form(..)

         $this->output .= $this->post_html->pm_postbox_buttons($old_message);

     Ajouter en-dessous le code en bleu

         $this->output .= $this->post_html->pm_postbox_buttons($old_message);



//-- mod_bbcode begin
        global $my_bbcode;
        $this->output =  $my_bbcode->update_postbox($this->output );
        if (!$ibforums->skin['use_rte_bbcode_compat'])
            $this->output = $my_bbcode->insert_codes($this->output);
//-- mod_bbcode end


  B. Trouver

         $this->output .= $this->html->send_form_footer();

     Ajouter en-dessous le code en bleu

         $this->output .= $this->html->send_form_footer();



//-- mod_bbcode begin
        $this->output = $my_bbcode->clean_comments($this->output);
//-- mod_bbcode end


  C. Trouver dans function edit_saved(..)

         $this->output .= $this->post_html->postbox_buttons( str_replace( "<br>", "\n", $msg['message']) );

     Ajouter en-dessous le code en bleu

         $this->output .= $this->post_html->postbox_buttons( str_replace( "<br>", "\n", $msg['message']) );



//-- mod_bbcode begin
        global $my_bbcode;
        $this->output =  $my_bbcode->update_postbox($this->output );
        if (!$ibforums->skin['use_rte_bbcode_compat'])
            $this->output = $my_bbcode->insert_codes($this->output);
//-- mod_bbcode end



Étape 12:  Ouvrir sources/mod_cp.php

  A. Trouver dans function edit_user(..)

        $editable['interests'] = $member['interests'];

     Ajouter en-dessous le code en bleu

        $editable['interests'] = $member['interests'];



//-- mod_bbcode begin
        $editable['location']  = $parser->unconvert( $member['location']  );
         $editable['interests'] = $parser->unconvert( $member['interests'] );
//-- mod_bbcode end


  B. Trouver dans function complete_user_edit(..)

        if ($parser->error != "")

     Ajouter au-dessus le code en bleu



//-- mod_bbcode begin
        $in = array('SMILIES'   => 0,
                    'CODE'      => 1,
                    'HTML'      => 0,
                    'SIGNATURE' => 0
                    );
        if ($ibforums->vars['profile_allow_ibc']) {
            $in['TEXT'] = $ibforums->input['location'];
            $ibforums->input['interests'] = $parser->convert($in);
            $in['TEXT'] = $ibforums->input['location'];
            $ibforums->input['interests'] = $parser->convert($in);
        }
//-- mod_bbcode end


        if ($parser->error != "")


Étape 13:  Ouvrir sources/Topics.php

  Trouver dans function Topics(..)

        //-------------------------------------
        // Print the footer

     Ajouter au-dessus le code en bleu



//-- mod_bbcode begin
        $this->output = str_replace("><{P_QUOTE}>", " onclick=\"javascript:t=get_SelectedText(); if (t != '') {document.location.href=this.href + '&quote=' + encodeURIComponent(t);return false;}\"><{P_QUOTE}>", $this->output);
        global $my_bbcode;
        if (isset($my_bbcode) && $ibforums->vars['codebox_collapsed']) {
            $this->output = $my_bbcode->change_codebox_style_topics($this->output);
        }
        else {
            $this->output = str_replace("___JSQUOTE___", "\"", $this->output);
            $this->output = str_replace("CODEBOX_STYLE", "", $this->output);
            $this->output = str_replace("___BOXHEIGHT___", $ibforums->vars['codebox_height'], $this->output);
            $this->output = str_replace("___BOXWIDTH___", $ibforums->vars['codebox_width'], $this->output);
            $this->output = str_replace("___HEIGHT___", "height:{$ibforums->vars['codebox_height']}px;", $this->output);
        }
//-- mod_bbcode end


        //-------------------------------------
        // Print the footer


Étape 14:  Ouvrir sources/calendar.php

  A. Trouver dans function class properties or methods(..), new_event(..), new_event(..)

        $this->output  = str_replace( '<!--IBF.EMO-->'

     Ajouter au-dessus le code en bleu



//-- mod_bbcode begin
        global $my_bbcode;
        $this->output =  $my_bbcode->update_postbox($this->output );
        $this->output = $my_bbcode->insert_codes($this->output);
//-- mod_bbcode end


        $this->output  = str_replace( '<!--IBF.EMO-->'

  B. Trouver

        $this->output = preg_replace( "/<!--SIG-->.+?<!--ESIG-->/s", "", $this->output );

     Ajouter en-dessous le code en bleu

        $this->output = preg_replace( "/<!--SIG-->.+?<!--ESIG-->/s", "", $this->output );



//-- mod_bbcode begin
        $this->output  = $my_bbcode->clean_comments($this->output );
//-- mod_bbcode end



Étape 15:  Ouvrir sources/Usercp.php

  A. Trouver dans function signature(..)

         $this->output .= $this->html->signature($this->member['signature'], $t_sig, $std->return_md5_check());

     Ajouter en-dessous le code en bleu

         $this->output .= $this->html->signature($this->member['signature'], $t_sig, $std->return_md5_check());



//-- mod_bbcode begin
        global $my_bbcode;
        $this->output = $my_bbcode->insert_codes($this->output);
//-- mod_bbcode end


  B. Trouver dans function signature(..)

         $this->page_title = $ibforums->lang['t_welcome'];
         $this->nav        = array( "<a href='".$this->base_url."act=UserCP&amp;CODE=00'>".$ibforums->lang['t_title']."</a>" );

     }

     function do_signature() {

     Ajouter au-dessus le code en bleu



//-- mod_bbcode begin
        $this->output = $my_bbcode->clean_comments($this->output);
//-- mod_bbcode end


         $this->page_title = $ibforums->lang['t_welcome'];
         $this->nav        = array( "<a href='".$this->base_url."act=UserCP&amp;CODE=00'>".$ibforums->lang['t_title']."</a>" );

     }

     function do_signature() {

  C. Trouver dans function personal(..)

            if ( $row['ftype'] == 'drop' )

     Ajouter au-dessus le code en bleu



//-- mod_bbcode begin
            if ($row['ftype'] != "drop") {
                $field_data[$row['fid']] = $this->parser->unconvert( $field_data[$row['fid']], $ibforums->vars['profile_allow_ibc'], 0 );
            }
//-- mod_bbcode end


            if ( $row['ftype'] == 'drop' )

 5.  Personnalisation

Installation manuelle


N'installez pas la mod manuellement. Utilisez Le ModInstaller, parce qu'il est tr&egrave;s facile.

Comment ? Vous voulez vraiment installer la mod manuellement ? Contre mon avis ?

D'accord, copiez ./sources/mods/bbcode/mod_bbcode_install.php dans le r&eacute;pertoire racine de votre IPB. C'est le r&eacute;pertoire o&ugrave; vous pouvez trouver le fichier index.php ou admin.php.

Puis ex&eacute;cutez le script avec votre navigateur. Le script ajoutera les champs et les tables manquants dans votre base de donn&eacute;es.

Maintenant appliquez toutes les modifications dans les fichiers appropri&eacute;s, telles que d&eacute;crites dans cette documentation. Attention &agrave; changer les bonnes parties. Faites attention aux fonctions qui sont impact&eacute;es.




 6.  Commentaires

You will find some BBCodes as importable sql-archive in dir archive_in. There are two variants:


Similar meanings for the BBCodes sets ibf_bbcodes_sets-standard_incremental.sql and ibf_bbcodes_sets-standard.sql.

Install these archives with the import functions in ACPSystem SettingBBCodes

If you want to use BBCodes based on Microsoft filters - only seen in Internet Explorer - be sure that you board wrapper looks like this:
Zitat


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


Parameters
Do not use more than 4 parameters.

Quote boxes et.al. and new css style
In post_parser.php I have wrapped boxes for Quote, Code etc. with new div-styles in order to manage very long lines. In those cases browsers based on Gecko (Mozilla, Firefox) or Opera will now show scroll bars. They will not stretch the view any longer.
But the Internet Explorer needs absolute values (in px) for width and height before showing scroll bars correctly. But absolute values are bad for Mozillas and Opera if the boxes are nested. By the way: They do it in the right way and once more IE is not reliable.

So I suggest using relative values (in %). So we will have no improvement for IE but all advantages for the orther browsers.

In order to teach Mozillas and Opera this new behavior we have to create one new css style. Using ACP insert:

Code

.codebox_title {width:100%;padding:1px;vertical-align:middle;text-align:left;overflow:hidden;}


Don't hesitate to give me some feedback.

 7.  Historiques des changements

2.06



2.04


2.0


1.6


1.5


1.3, 1.4
Internal revisions

1.2


1.1


1.0