Security Fixes, Updates And Enhancements For IPB 1.3.1, Part A  2.7.1  Invision Power Board 1.3.1
Mod Description Updates your Invisionboard 1.3.1, inserts all known security fixes and adds more essential features.
Mod Compatibility Invision Power Board 1.3.1
Mod Category ACP Mod
Mod Author Peter
Mod Author's Email Peter@ibforen.de
Info File sources/mods/sec_update_131_A/mod_sec_update_131_howto.htm
Mod Version 2.7.1
Comment Distribution is not allowed. Download from ibforen.de
All changes could be recognized by mod_token

This html-howto was created with The ModInstaller 1.3.3 by
Peter@ibforen.de, released on 1st June, 2011
Creation time July 29, 2011

It is not for public use.

Attention
  • This modification is no freeware.
  • Redistribution of this howto or of one of the mod files is prohibited. Redistribution of the mod or its files only with my authorisation.
  • Customizing of the mod, in order to fit your board's skin, is welcomed. Share your experiences with the community.But do not hurt my copyright by distributing code segment derivated from this mod.
  • Violation of these rules will finally let me stop any production of free available modifications or programs. Please, respect the creative work of coders and take care of their copyrights.
Mod Token mod_sec_update_131

 Content

1 Newest History and Change Logs
2 Changes
3 Copy
4 Code
5 Customize
6 Comment
7 Older Change History and Change Logs

 1.  Newest History and Change Logs

Important: DO NOT INSTALL MANUALLY. Use my ModInstaller and read section Customize!

I have split the mod into 3 parts in order to avoid timeout problems. Remove the directory of an older version.

Take care of installing all three parts.


Before installing this mod:
Do not forget to remove my mods Customize Date, Load Lang Bug, Extension Bug and some other mod providing relative dates.


2.7.0 ⇒ 2.7.1, dated on July 29th, 2011

Update


2.6.9 ⇒ 2.7.0, dated on July 25th, 2011

Update


2.6.8 ⇒ 2.6.9, dated on July 15th, 2011


2.6.7 ⇒ 2.6.8, dated on June 26th, 2011


2.6.6 ⇒ 2.6.7, dated on June 14th, 2011


2.6.5 ⇒ 2.6.6, dated on November 30th, 2010
Minor bugfixes for request system. Replace mod_sec_update_ad_req_func.php and mod_sec_update_ucp_func.php in sources/mods/sec_update_131_A.

2.6.1 ⇒ 2.6.5, dated on June 6th, 2010
Attention
If you have Mod BBCode installed then you must reinstall it with version > 2.2.11. This is because a feature of Mod BBCode was moved to the new version of Mod Security&Updates (this mod).




2.6.0 ⇒ 2.6.1, dated on December 14th, 2009


2.5.2 ⇒ 2.6.0, dated on December 1st, 2009
Attention: This is a big update with a lot of code changes and sql changes. Do not install manually.


Complete Feature List (Only new functions and modules)

User Mode

Common features

Register and Login

Views

Posting

Messaging


Admin Mode (Admin Control Panel ACP)

Common Features In Admin Control Panel

Security Features For Admin Access


 2.  Changes
Changed file Changed function
admin.php body
admin.php do_admin_stuff(..)
admin.php info(..)
admin.php info(..), info(..)
index.php body
sources/Boards.php Boards(..)
sources/browsebuddy.php splash(..)
sources/Forums.php check_access(..)
sources/Forums.php Forums(..)
sources/Forums.php render_entry(..)
sources/Forums.php render_forum(..)
sources/functions.php authorise(..)
sources/functions.php build_pagelinks(..)
sources/functions.php check_perms(..)
sources/functions.php class properties or methods
sources/functions.php clean_key(..)
sources/functions.php do_output(..)
sources/functions.php get_date(..)
sources/functions.php get_time_offset(..)
sources/functions.php hdl_forum_read_cookie(..)
sources/functions.php load_member(..)
sources/functions.php load_template(..)
sources/functions.php load_words(..)
sources/functions.php my_getcookie(..)
sources/functions.php parse_incoming(..)
sources/functions.php pop_up_window(..)
sources/functions.php redirect_screen(..)
sources/functions.php update_member_session(..), update_guest_session(..)
sources/Memberlist.php Memberlist(..)
sources/Messenger.php add_member(..)
sources/Messenger.php class properties or methods(..), edit_saved(..)
sources/Messenger.php del_tracked(..)
sources/Messenger.php Messenger(..)
sources/Messenger.php msg_list(..)
sources/Messenger.php parse_member(..)
sources/Messenger.php prefs(..)
sources/Messenger.php send_msg(..)
sources/Messenger.php show_tracking(..)
sources/Messenger.php view_msg(..)
sources/Moderate.php delete_post(..)
sources/Moderate.php do_move(..)
sources/mod_cp.php approve_all(..), mod_domodposts(..), domod_topics(..)
sources/mod_cp.php complete_user_edit(..)
sources/mod_cp.php do_forum(..)
sources/mod_cp.php edit_user(..)
sources/mod_cp.php edit_user(..), complete_user_edit(..)
sources/mod_cp.php find_user_two(..)
sources/mod_cp.php Moderate(..)
sources/mod_cp.php mod_topics(..)
sources/mod_cp.php mod_topicview(..)
sources/mod_cp.php prune_juice(..)
sources/mod_cp.php show_forums(..)
sources/mod_cp.php topic_mmod(..)
sources/Online.php list_all(..)
sources/Online.php Online(..)
sources/Post.php class properties or methods
sources/Post.php compile_post(..)
sources/Post.php html_post_icons(..)
sources/Post.php notify_new_topic_approval(..)
sources/Post.php Post(..)
sources/Post.php process_upload(..)
sources/Post.php topic_tracker(..), forum_tracker(..)
sources/Profile.php class properties or methods
sources/Profile.php show_card(..)
sources/Profile.php show_card(..), view_profile(..)
sources/Profile.php view_profile(..)

 3.  Copy

Copy all files of archive into the root dir of your board. Take care of the structure of this archive.


 4.  Code


Step  1:  Open admin.php

  A. Find

/*-----------------------------------------------
  USER CONFIGURABLE ELEMENTS

     Insert above the blue code



//-- mod_sec_update_131 begin
    define("ADMIN_SCRIPT_NAME", preg_replace("`^(.*?\.php).*$`", "\\1", basename(htmlentities($_SERVER['SCRIPT_NAME']))));
    $HTTP_SERVER_VARS   = isset($_SERVER)?$_SERVER:array();
    $HTTP_GET_VARS      = isset($_GET)?$_GET:array();
    $HTTP_POST_VARS     = isset($_POST)?$_POST:array();
    $HTTP_POST_FILES    = isset($_FILES)?$_FILES:array();
    $HTTP_COOKIE_VARS   = isset($_COOKIE)?$_COOKIE:array();
    $HTTP_ENV_VARS      = isset($_ENV)?$_ENV:array();
    $HTTP_SESSION_VARS  = isset($_SESSION)?$_SESSION:array();
//-- mod_sec_update_131 end


/*-----------------------------------------------
  USER CONFIGURABLE ELEMENTS

  B. Find

define ( 'USE_MODULES', 1 );

     Insert above the blue code



//-- mod_sec_update_131 begin
if (file_exists(ROOT_PATH."modules/module_loader.php"))
//-- mod_sec_update_131 end


define ( 'USE_MODULES', 1 );

  C. Find

require ROOT_PATH."conf_global.php";

     Insert below the blue code

require ROOT_PATH."conf_global.php";



//-- mod_sec_update_131 begin
$_SET_PCRE = 0;
if ($INFO['set_pcre']) {
    $limit = intval(@ini_get("pcre.backtrack_limit"));
    if ($limit > -1 && $limit <= 100000) {
        $_SET_PCRE = 1;
        @ini_set("pcre.backtrack_limit", "1000000");
    }
    $limit = intval(@ini_get("pcre.recursion_limit"));
    if ($limit > -1 && $limit <= 100000) {
        $_SET_PCRE = 1;
        @ini_set("pcre.recursion_limit", "1000000");
    }
    unset ($limit);
}
if (substr($INFO['base_dir'], -1) != "/")
    $INFO['base_dir'] .= "/";
//-- mod_sec_update_131 end


  D. Find in function info(..)

                        $this_session      = $row;

     Insert below the blue code

                        $this_session      = $row;



//-- mod_sec_update_131 begin
                        if ($cookie = $std->my_getcookie('acpprefs')) {
                            $DB->query("REPLACE INTO ibf_acp_config (member_id, name, value) VALUES ('".$MEMBER['id']."', 'acpprefs', '$cookie')");
                        }
                        else {
                            $DB->query("SELECT value FROM ibf_acp_config WHERE member_id='".$MEMBER['id']."' AND name='acpprefs'");
                            if ($r = $DB->fetch_row()) {
                                list( $INFO['menu'], $INFO['tx'], $INFO['ty'], $INFO['preview'] ) = explode( ",", $r['value'] );
                                $std->my_setcookie( 'acpprefs', $r['value']);
                            }
                        }
                        if ($cookie = $std->my_getcookie('acpmenu')) {
                            $DB->query("REPLACE INTO ibf_acp_config (member_id, name, value) VALUES ('".$MEMBER['id']."', 'acpmenu', '$cookie')");
                        }
                        else {
                            $DB->query("SELECT value FROM ibf_acp_config WHERE member_id='".$MEMBER['id']."' AND name='acpmenu'");
                            if ($r = $DB->fetch_row()) {
                                $IN['show'] = $r['value'];
                                if ($IN['show'] == 'none')
                                    $IN['show'] = "";
                                else if ($IN['show'] == 'all') {
                                    $IN['show']     = "";
                                    foreach($CATS as $cid => $name)
                                        $IN['show'] .= $cid.',';
                                }
                                else {
                                    $IN['show'] = preg_replace( "/(?:^|,)".$IN['out']."(?:,|$)/", ",", $IN['show'] );
                                    $IN['show'] = preg_replace( "/,,/" , "" , $IN['show'] );
                                    $IN['show'] = preg_replace( "/,$/" , "" , $IN['show'] );
                                    $IN['show'] = preg_replace( "/^,/" , "" , $IN['show'] );
                                }
                                $std->my_setcookie( 'acpmenu', $r['value']);
                            }
                        }
//-- mod_sec_update_131 end


  E. Find in function info(..), info(..)

            $ADMIN->html .= "<tr><td id='tdrow1'><meta http-equiv='refresh' content='2;

     Insert above the blue code



//-- mod_sec_update_131 begin
            if (TRUE)
                $ADMIN->html .= "<tr><td id='tdrow1'><meta http-equiv='refresh' content='2; url=".$INFO['board_url']."/".ADMIN_SCRIPT_NAME."?adsess=".$IN['AD_SESS']."'><a href='".$INFO['board_url']."/".ADMIN_SCRIPT_NAME."?adsess=".$IN['AD_SESS']."'>( Click here if you do not wish to wait )</a></td></tr>";
            else
//-- mod_sec_update_131 end


            $ADMIN->html .= "<tr><td id='tdrow1'><meta http-equiv='refresh' content='2;

  F. Find in function do_admin_stuff(..)

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

     Insert above the blue code



//-- mod_sec_update_131 begin
    if (!isset($ADMIN->lang_id)) {
        $ADMIN->lang_id = $MEMBER['language']?$MEMBER['language']:($INFO['default_language']!=""?
                                                                   $INFO['default_language']:
                                                                   'en');
    }
    $ADMIN->lang = $std->load_words($ADMIN->lang, 'mod_sec_update_ad_lang', $ADMIN->lang_id);
    if ($IN['act'] == 'logout') {
        $DB->query("DELETE FROM ibf_admin_sessions WHERE id='{$IN['adsess']}'");
        if ($cookie = $std->my_getcookie('acpmenu')) {
            $DB->query("REPLACE INTO ibf_acp_config (member_id, name, value) VALUES ('".$MEMBER['id']."', 'acpmenu', '$cookie')");
        }
        $std->boink_it($ADMIN->base_url);
    }
    if ($IN['act'] == "requests") {
        if (file_exists(ROOT_PATH."sources/mods/sec_update_131_A/mod_sec_update_ad_req_func.php")) {
            require_once(ROOT_PATH."sources/mods/sec_update_131_A/mod_sec_update_ad_req_func.php");
        }
        else {
            die("Could not call required function from file 'sources/mods/sec_update_131_A/mod_sec_update_ad_func.php'<br />Does it exist?");
        }
    }
    if ($IN['act'] == "online") {
        if (file_exists(ROOT_PATH."sources/mods/sec_update_131_A/mod_sec_update_ad_online_func.php")) {
            require_once(ROOT_PATH."sources/mods/sec_update_131_A/mod_sec_update_ad_online_func.php");
        }
        else {
            die("Could not call required function from file 'sources/mods/sec_update_131_A/mod_sec_update_ad_online_func.php'<br />Does it exist?");
        }
    }
    unset($choice['ips']);
    if ($MEMBER['mgroup'] != $INFO['admin_group']) {
        global $PAGES, $CATS, $DESC;
        unset($PAGES[2]);
        unset($CATS[2]);
        unset($DESC[2]);
        unset($PAGES[10]);
        unset($CATS[10]);
        unset($DESC[10]);
        unset($PAGES[11][2]);
        unset($choice['mysql']);
        unset($choice['adminlog']);
        if (file_exists(ROOT_PATH."sources/mods/sec_update_131_A/mod_sec_update_ad_func.php")) {
            global $mod_sec_update;
            require_once(ROOT_PATH."sources/mods/sec_update_131_A/mod_sec_update_ad_func.php");
            $IN['act'] = $IN['act'] == '' ? "idx" : $IN['act'];
            if (!$mod_sec_update->test_access()) {
                $std->boink_it($ADMIN->base_url);
            }
        }
        else {
            die("Could not call required function from file 'sources/mods/sec_update_131_A/mod_sec_update_ad_func.php'<br />Does it exist?");
        }
    }
    if ($IN['act'] == "sec_update") {
        if (file_exists(ROOT_PATH."sources/mods/sec_update_131_A/mod_sec_update_ad_func.php")) {
            require_once(ROOT_PATH."sources/mods/sec_update_131_A/mod_sec_update_ad_func.php");
        }
        else {
            die("Could not call required function from file 'sources/mods/sec_update_131_A/mod_sec_update_ad_func.php'<br />Does it exist?");
        }
    }
//-- mod_sec_update_131 end


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


Step  2:  Open index.php

  A. Find

//-----------------------------------------------
// USER CONFIGURABLE ELEMENTS

     Insert above the blue code



//-- mod_sec_update_131 begin
    error_reporting  (E_ALL);
    if (isset($HTTP_POST_VARS['GLOBALS']) || isset($_POST['GLOBALS']) ||
        isset($HTTP_POST_FILES['GLOBALS']) || isset($_FILES['GLOBALS']) ||
        isset($HTTP_GET_VARS['GLOBALS']) || isset($_GET['GLOBALS']) ||
        isset($HTTP_COOKIE_VARS['GLOBALS']) || isset($_COOKIE['GLOBALS'])) {
        trigger_error('Is this a GLOBAL GPC hacking attempt?', E_USER_ERROR);
    } 
    $HTTP_SERVER_VARS   = isset($_SERVER)?$_SERVER:array();
    $HTTP_GET_VARS      = isset($_GET)?$_GET:array();
    $HTTP_POST_VARS     = isset($_POST)?$_POST:array();
    $HTTP_POST_FILES    = isset($_FILES)?$_FILES:array();
    $HTTP_COOKIE_VARS   = isset($_COOKIE)?$_COOKIE:array();
    $HTTP_ENV_VARS      = isset($_ENV)?$_ENV:array();
    $HTTP_SESSION_VARS  = isset($_SESSION)?$_SESSION:array();
//-- mod_sec_update_131 end


//-----------------------------------------------
// USER CONFIGURABLE ELEMENTS

  B. Find

define ( 'USE_MODULES', 1 );

     Insert above the blue code



//-- mod_sec_update_131 begin
if (file_exists(ROOT_PATH."modules/module_loader.php"))
//-- mod_sec_update_131 end


define ( 'USE_MODULES', 1 );

  C. Find

require ROOT_PATH."conf_global.php";

     Insert below the blue code

require ROOT_PATH."conf_global.php";



//-- mod_sec_update_131 begin
if ($INFO['set_pcre']) {
    $limit = intval(@ini_get("pcre.backtrack_limit"));
    if ($limit && $limit <= 100000)
        @ini_set("pcre.backtrack_limit", "1000000");
    $limit = intval(@ini_get("pcre.recursion_limit"));
    if ($limit && $limit <= 100000)
        @ini_set("pcre.recursion_limit", "1000000");
    unset ($limit);
}
if (substr($INFO['base_dir'], -1) != "/")
    $INFO['base_dir'] .= "/";
//-- mod_sec_update_131 end


  D. Find

    $ibforums->input['t']   = intval($ibforums->input['showtopic']);

     Insert below the blue code

    $ibforums->input['t']   = intval($ibforums->input['showtopic']);



//-- mod_sec_update_131 begin
    if (TRUE)
        $DB->query("SELECT  f.*, f.name as forum_name, f.id as forum_id, f.posts as forum_posts, f.topics as forum_topics,
                            t.*, c.name as cat_name, c.id as cat_id, c.state as cat_state
                            FROM ibf_topics t, ibf_forums f , ibf_categories c
                            WHERE t.tid=".$ibforums->input['t']." and f.id = t.forum_id and f.category=c.id");
    else
//-- mod_sec_update_131 end


  E. Find

$ibforums->member     = $sess->authorise();

     Insert below the blue code

$ibforums->member     = $sess->authorise();



//-- mod_sec_update_131 begin
    if ($ibforums->member['mgroup'] != $ibforums->vars['admin_group']) {
            $DB->obj['debug'] = 0;
            $DB->obj['debuglevel'] = 0;
            $ibforums->debug_html = "";
            $ibforums->vars['debug_level'] = min(1, $ibforums->vars['debug_level']);
            $INFO['debug_level'] = $ibforums->vars['debug_level'];
            unset($_GET['debug']);
    }
//-- mod_sec_update_131 end


  F. Find

$ibforums->lang_id = $ibforums->member['language'] ? $ibforums->member['language'] : $ibforums->vars['default_language'];

     Insert below the blue code

$ibforums->lang_id = $ibforums->member['language'] ? $ibforums->member['language'] : $ibforums->vars['default_language'];



//-- mod_sec_update_131 begin
    if (defined("IS_ACP_SESSION"))
        $ibforums->base_url = $ibforums->vars['board_url'].'/index.'.$ibforums->vars['php_ext'].'?adsess='.$ibforums->session_id.'&amp;';
    if (empty($ibforums->vars['default_language'])) {
        if (empty($ibforums->lang_id)) {
            $ibforums->vars['default_language'] = "en";
            $INFO['default_language'] = "en";
            $ibforums->lang_id = "en";
        }
        else {
            $ibforums->vars['default_language'] = $ibforums->lang_id;
            $INFO['default_language'] = $ibforums->lang_id;
        }
    }
    if($ibforums->input['lch'] == 1 && is_dir(ROOT_PATH."lang/".$ibforums->input['lang'])) {
        if ($ibforums->input['lang'] == "en")
            $DB->query("SELECT ldir FROM ibf_languages WHERE ldir='en'");
        else
            $DB->query("SELECT ldir FROM ibf_languages WHERE ldir='".$ibforums->input['lang']."'");
        if ($DB->get_num_rows()) {
            if($ibforums->member['id'] != 0) {
                $DB->query("UPDATE ibf_members SET language='".$ibforums->input['lang']."' WHERE id=".$ibforums->member['id']);
            }
            else {
                $std->my_setcookie('language', $ibforums->input['lang']);
            }
            $ibforums->lang_id = $ibforums->input['lang'];
            $ibforums->member['language'] = $ibforums->input['lang'];
        }
    }
    if ($ibforums->vars['allow_skins'] == 1) {
        if($ibforums->input['ch'] == 1) {
            $DB->query("SELECT sid FROM ibf_skins WHERE sid='".intval($ibforums->input['skinid'])."'");
            if ($DB->get_num_rows()) {
                if($ibforums->member['id'] != 0) {
                    $DB->query("UPDATE ibf_members SET skin='".intval($ibforums->input['skinid'])."' WHERE id=".$ibforums->member['id']);
                }
                else {
                    $std->my_setcookie('skin', intval($ibforums->input['skinid']));
                }
                $ibforums->member['skin'] = intval($ibforums->input['skinid']);
            }
        }
    }
//-- mod_sec_update_131 end


  G. Find

$ibforums->lang = $std->load_words($ibforums->lang, 'lang_global', $ibforums->lang_id);

     Insert below the blue code

$ibforums->lang = $std->load_words($ibforums->lang, 'lang_global', $ibforums->lang_id);



//-- mod_sec_update_131 begin
    if (is_dir($ibforums->vars['img_url']."/".$ibforums->lang_id) ) {
        $ibforums->vars['img_url'] .= "/".$ibforums->lang_id;
        $ibforums->skin['img_dir'] .= "/".$ibforums->lang_id;
    }
    if (is_dir($ibforums->vars['img_url']."/team_icons") )
        $ibforums->vars['TEAM_ICON_URL'] = $ibforums->vars['img_url']."/team_icons";
    if (is_dir($ibforums->vars['img_url']."/avatars") )
        $ibforums->vars['AVATARS_URL'] = $ibforums->vars['img_url']."/avatars";
    if (is_dir($ibforums->vars['img_url']."/emoticons") )
        $ibforums->vars['EMOTICONS_URL'] = $ibforums->vars['img_url']."/emoticons";
    if (is_dir($ibforums->vars['img_url']."/mime_types") )
        $ibforums->vars['mime_img'] = $ibforums->vars['img_url']."/mime_types";
//-- mod_sec_update_131 end



Step  3:  Open sources/Boards.php

  A. Find in function Boards(..)

        if ($ibforums->vars['show_active'])

     Insert below the blue code

        if ($ibforums->vars['show_active'])



//-- mod_sec_update_131 begin
        if ($ibforums->member['g_can_view_online'])
//-- mod_sec_update_131 end


  B. Find in function Boards(..)

            $DB->query("SELECT s.id, s.member_id, s.member_name, s.login_type, g.suffix, g.prefix

     Insert above the blue code



//-- mod_sec_update_131 begin
            if ($ibforums->member['mgroup'] == $ibforums->vars['admin_group']) {
                $DB->query("SELECT s.id, s.member_id, s.member_name, s.login_type, g.suffix, g.prefix
                            FROM ibf_sessions s
                              LEFT JOIN ibf_groups g ON (g.g_id=s.member_group)
                            WHERE running_time > $time
                            ORDER BY s.running_time DESC");
            }
            else {
                $DB->query("SELECT s.id, s.member_id, s.member_name, s.login_type, g.suffix, g.prefix
                            FROM ibf_sessions s
                              LEFT JOIN ibf_groups g ON (g.g_id=s.member_group)
                            WHERE running_time > $time
                            AND ((s.login_type IS NULL) OR s.login_type<>'1' OR (s.login_type='1' AND s.member_group<>'{$ibforums->vars['admin_group']}'))
                            ORDER BY s.running_time DESC");
            }
            if (FALSE)
//-- mod_sec_update_131 end


            $DB->query("SELECT s.id, s.member_id, s.member_name, s.login_type, g.suffix, g.prefix

  C. Find in function Boards(..)

        if ($ibforums->vars['show_birthdays'])

     Insert below the blue code

        if ($ibforums->vars['show_birthdays'])



//-- mod_sec_update_131 begin
            if ($ibforums->member['g_mem_info'])
//-- mod_sec_update_131 end



Step  4:  Open sources/browsebuddy.php

  Find in function splash(..)

                if ($i['password'] != "")

     Insert above the blue code



//-- mod_sec_update_131 begin
                if ($ibforums->member['mgroup'] != $ibforums->vars['admin_group'] && !$ibforums->member['g_is_supmod'] && (!$ibforums->member['is_mod'] || !$ibforums->member['mod_forums'][$i['id']]))
//-- mod_sec_update_131 end


                if ($i['password'] != "")


Step  5:  Open sources/Forums.php

  A. Find in function Forums(..)

        $DB->query("SELECT f.*, c.id as cat_id, c.name as cat_name

     Insert above the blue code



//-- mod_sec_update_131 begin
        $ibforums->lang = $std->load_words($ibforums->lang, 'mod_sec_lang', $ibforums->lang_id);
        $ibforums->vars['pre_pinned'] = $ibforums->lang['pre_pinned'];
        $ibforums->vars['pre_moved'] = $ibforums->lang['pre_moved'];
        $ibforums->vars['pre_polls'] = $ibforums->lang['pre_polls'];
        $this->show_preview = $ibforums->vars['display_topic_preview'] && $ibforums->member['topic_preview'] && strpos($ibforums->skin['css_text'], "domTT") !== FALSE;
        $DB->query("SELECT f.*, c.id as cat_id, c.name as cat_name, c.state as cat_state
                    FROM ibf_forums f
                      LEFT JOIN ibf_categories c ON (c.id=f.category)
                    WHERE f.id=".$ibforums->input['f']);
        if (FALSE)
//-- mod_sec_update_131 end


        $DB->query("SELECT f.*, c.id as cat_id, c.name as cat_name

  B. Find in function Forums(..)

        $this->forum = $DB->fetch_row();

     Insert below the blue code

        $this->forum = $DB->fetch_row();



//-- mod_sec_update_131 begin
        if ($ibforums->member['mgroup'] == $ibforums->vars['admin_group'] || $ibforums->member['g_is_supmod'] || ($ibforums->member['is_mod'] && $ibforums->member['mod_forums'][$this->forum['id']]))
            $this->forum['password'] = "";
//-- mod_sec_update_131 end


  C. Find in function Forums(..)

        //----------------------------------------
        // Is it a redirect forum?

     Insert above the blue code



//-- mod_sec_update_131 begin
        if ( $this->forum['cat_state'] == 0 )
            $std->Error( array( LEVEL => 1, MSG => 'is_broken_link') );
//-- mod_sec_update_131 end


        //----------------------------------------
        // Is it a redirect forum?

  D. Find in function check_access(..)

            if ($this->forum['password'])

     Insert above the blue code



//-- mod_sec_update_131 begin
            if ($ibforums->member['mgroup'] == $ibforums->vars['admin_group'] || $ibforums->member['g_is_supmod'] || ($ibforums->member['is_mod'] && $ibforums->member['mod_forums'][$this->forum['id']]))
                return 0;
//-- mod_sec_update_131 end


            if ($this->forum['password'])

  E. Find in function render_forum(..)

            $this->read_array = unserialize(stripslashes($read));

     Insert above the blue code



//-- mod_sec_update_131 begin
            if (TRUE)
                $this->read_array = $std->clean_int_array(unserialize(stripslashes($read)));
            else
//-- mod_sec_update_131 end


            $this->read_array = unserialize(stripslashes($read));

  F. Find in function render_forum(..)

        $First = $First ? $First : 0;

     Insert below the blue code

        $First = $First ? $First : 0;



//-- mod_sec_update_131 begin
        $First = max(0, $First);
//-- mod_sec_update_131 end


  G. Find in function render_forum(..)

        if ($ibforums->vars['no_au_forum'] != 1

     Insert below the blue code

        if ($ibforums->vars['no_au_forum'] != 1



//-- mod_sec_update_131 begin
            && $ibforums->member['g_can_view_online']
//-- mod_sec_update_131 end


  H. Find in function render_forum(..)

            $DB->query("SELECT s.member_id, s.member_name, s.login_type, s.location, g.suffix, g.prefix, g.g_perm_id, t.forum_id, m.org_perm_id

     Insert above the blue code



//-- mod_sec_update_131 begin
            if ($ibforums->member['mgroup'] == $ibforums->vars['admin_group']) {
                $DB->query("SELECT s.member_id, s.member_name, s.login_type, s.location, g.suffix, g.prefix, g.g_perm_id, t.forum_id, m.org_perm_id
                            FROM ibf_sessions s
                             LEFT JOIN ibf_groups g ON (g.g_id=s.member_group)
                             LEFT JOIN ibf_topics t ON (t.tid=s.in_topic)
                             LEFT JOIN ibf_members m on (s.member_id=m.id)
                            WHERE (s.in_forum={$this->forum['id']} OR t.forum_id={$this->forum['id']})
                            AND s.running_time > $time
                            ORDER BY s.running_time DESC");
            }
            else {
                $DB->query("SELECT s.member_id, s.member_name, s.login_type, s.location, g.suffix, g.prefix, g.g_perm_id, t.forum_id, m.org_perm_id
                            FROM ibf_sessions s
                             LEFT JOIN ibf_groups g ON (g.g_id=s.member_group)
                             LEFT JOIN ibf_topics t ON (t.tid=s.in_topic)
                             LEFT JOIN ibf_members m on (s.member_id=m.id)
                            WHERE (s.in_forum={$this->forum['id']} OR t.forum_id={$this->forum['id']})
                            AND s.running_time > $time
                            AND ((s.login_type IS NULL) OR s.login_type<>'1' OR (s.login_type='1' AND s.member_group<>'{$ibforums->vars['admin_group']}'))
                            ORDER BY s.running_time DESC");
            }
            if (FALSE)
//-- mod_sec_update_131 end


            $DB->query("SELECT s.member_id, s.member_name, s.login_type, s.location, g.suffix, g.prefix, g.g_perm_id, t.forum_id, m.org_perm_id

  I. Find in function render_entry(..)

        if ($pages > 1)

     Insert above the blue code



//-- mod_sec_update_131 begin
        if (TRUE) {
            if ($pages > 1) {
                if ($pages > 4 )
                    $topic['PAGES'] = "&nbsp;<a title='{$ibforums->lang['tpl_jump']}' href='javascript:multi_page_jump(\"{$this->base_url}showtopic={$topic['tid']}\",{$topic['posts']},{$ibforums->vars['display_max_posts']});'><img src='{$ibforums->vars['img_url']}/item.gif' /></a>&nbsp;";
                else
                    $topic['PAGES'] = "&nbsp;<img title='$pages {$ibforums->lang['topic_sp_pages']}' src='{$ibforums->vars['img_url']}/item.gif' />&nbsp;";
                for ($i = 0 ; $i < $pages ; ++$i ) {
                    $real_no = $i * $ibforums->vars['display_max_posts'];
                    $page_no = $i + 1;
                    if ($page_no == 4) {
                        $topic['PAGES'] .= "<a title='{$ibforums->lang['ps_page']} $pages' href='{$this->base_url}showtopic={$topic['tid']}&amp;st=" . ($pages - 1) * $ibforums->vars['display_max_posts'] . "'><span class='topic_page_link'>&raquo;$pages </span></a>";
                        break;
                    } else {
                        $topic['PAGES'] .= "<a title='{$ibforums->lang['ps_page']} $page_no' href='{$this->base_url}showtopic={$topic['tid']}&amp;st=$real_no'><span class='topic_page_link'>$page_no</span></a>";
                    }
                }
            }
        }
        else
//-- mod_sec_update_131 end


        if ($pages > 1)

  J. Find in function render_entry(..)

            return $p_start . $this->html->render_pinned_row( $topic );

     Insert above the blue code



//-- mod_sec_update_131 begin
            if ($this->show_preview) {
                $link = "{$ibforums->base_url}showtopic={$topic['tid']}&amp;tooltip=1";
                $tooltip  = "onMouseOver=\"domTT_oneOnly = true; this.style.color = '#000000';";
                $tooltip .= "return makeFalse(domTT_activate(this, event,
                                                    'caption', '',
                                                    'width', '510px',
                                                    'fade', 'both',
                                                    'fadeMax', 100,
                                                    'trail', false,
                                                    'offsetX', 20,
                                                    'offsetY', 5,
                                                    'lazy', true,
                                                    'delay', 500,
                                                    'content', '&lt;iframe src=&quot;{LINK}&quot; style=&quot;width:500px;height:200px;&quot;&gt;&lt;/iframe&gt;',
                                                    'styleClass', 'domTTlegend',
                                                    'type', 'velcro'
                                                    ));\"";
                $return = str_replace(">{$topic['title']}", " ".str_replace("{LINK}", $link, $tooltip).">{$topic['title']}", $this->html->render_pinned_row($topic));
                $link = "{$ibforums->base_url}showtopic={$topic['tid']}&amp;view=getlastpost&amp;tooltip=last";
                $return = str_replace(">{$topic['last_text']}", " ".str_replace("{LINK}", $link, $tooltip).">{$topic['last_text']}", $return);
                return $p_start.$return;
            }
//-- mod_sec_update_131 end


            return $p_start . $this->html->render_pinned_row( $topic );

  K. Find in function render_entry(..)

            return $p_end . $this->html->RenderRow( $topic

     Insert above the blue code



//-- mod_sec_update_131 begin
            if ($this->show_preview) {
                $link = "{$ibforums->base_url}showtopic={$topic['tid']}&amp;tooltip=1";
                $tooltip  = "onMouseOver=\"domTT_oneOnly = true; this.style.color = '#000000';";
                $tooltip .= "return makeFalse(domTT_activate(this, event,
                                                    'caption', '',
                                                    'width', '510px',
                                                    'fade', 'both',
                                                    'fadeMax', 100,
                                                    'trail', false,
                                                    'offsetX', 20,
                                                    'offsetY', 5,
                                                    'lazy', true,
                                                    'delay', 500,
                                                    'content', '&lt;iframe src=&quot;{LINK}&quot; style=&quot;width:500px;height:200px;&quot;&gt;&lt;/iframe&gt;',
                                                    'styleClass', 'domTTlegend',
                                                    'type', 'velcro'
                                                    ));\"";
                $return = str_replace(">{$topic['title']}", " ".str_replace("{LINK}", $link, $tooltip).">{$topic['title']}", $this->html->RenderRow($topic));
                $link = "{$ibforums->base_url}showtopic={$topic['tid']}&amp;view=getlastpost&amp;tooltip=last";
                $return = str_replace(">{$topic['last_text']}", " ".str_replace("{LINK}", $link, $tooltip).">{$topic['last_text']}", $return);
                return $p_end.$return;
            }
//-- mod_sec_update_131 end


            return $p_end . $this->html->RenderRow( $topic


Step  6:  Open sources/functions.php

  A. Find in function check_perms(..)

            $forum_perm_array = explode( ",", $forum_perm );

     Insert above the blue code



//-- mod_sec_update_131 begin
            if (!is_array($ibforums->perm_id_array)) return FALSE;
//-- mod_sec_update_131 end


            $forum_perm_array = explode( ",", $forum_perm );

  B. Find in function hdl_forum_read_cookie(..)

                        $ibforums->forum_read[$id] = $stamp;

     Insert above the blue code



//-- mod_sec_update_131 begin
                        if (TRUE)
                            $ibforums->forum_read[ intval($id) ] = intval($stamp);
                        else
//-- mod_sec_update_131 end


                        $ibforums->forum_read[$id] = $stamp;

  C. Find in function load_template(..)

        if ($ibforums->vars['safe_mode_skins'] == 0)

     Insert above the blue code



//-- mod_sec_update_131 begin
        if(class_exists($name)) {
          return new $name();
        }
        if (!$id)
            $id = $ibforums->skin_rid;
//-- mod_sec_update_131 end


        if ($ibforums->vars['safe_mode_skins'] == 0)

  D. Find in function load_template(..)

            require ROOT_PATH."Skin/".$ibforums->skin_id."/$name.php";

     Insert above the blue code



//-- mod_sec_update_131 begin
            if (file_exists(ROOT_PATH."Skin/s".$id."/$name.php"))
                require ROOT_PATH."Skin/s".$id."/$name.php";
            else
                fatal_error("Could not fetch the template from skin directory. Template File 'Skins/s".$id."/$name.php'");
            if (FALSE)
//-- mod_sec_update_131 end


            require ROOT_PATH."Skin/".$ibforums->skin_id."/$name.php";

  E. Find in function load_template(..)

            $DB->query("SELECT func_name, func_data,

     Insert above the blue code



//-- mod_sec_update_131 begin
            if (TRUE)
                $DB->query("SELECT func_name, func_data, section_content FROM ibf_skin_templates WHERE set_id='$id' AND group_name='$name'");
            else
//-- mod_sec_update_131 end


            $DB->query("SELECT func_name, func_data,

  F. Find in function build_pagelinks(..)

    function build_pagelinks($data)

     Insert above the blue code



/*-- mod_sec_update_131 exclude begin


    function build_pagelinks($data)

  G. Find

    /*-------------------------------------------------------------------------*/
    // Build the forum jump menu

     Insert above the blue code



-- mod_sec_update_131 exclude end */

//-- mod_sec_update_131 begin
    function build_pagelinks($data) {
        global $ibforums, $skin_universal;
        
        $work = array();
        $section = ($data['leave_out'] == "") ? 2 : $data['leave_out'];  // Number of pages to show per section( either side of current), IE: 1 ... 4 5 [6] 7 8 ... 10
        $work['pages']  = 1;
        if ( ($data['TOTAL_POSS'] % $data['PER_PAGE']) == 0 )
            $work['pages'] = $data['TOTAL_POSS'] / $data['PER_PAGE'];
        else {
            $number = ($data['TOTAL_POSS'] / $data['PER_PAGE']);
            $work['pages'] = ceil( $number);
        }
        $work['total_page']   = $work['pages'];
        $work['current_page'] = $data['CUR_ST_VAL'] > 0 ? ($data['CUR_ST_VAL'] / $data['PER_PAGE']) + 1 : 1;
        if ($work['pages'] > 1) {
            $work['first_page'] = $skin_universal->make_page_jump($data['TOTAL_POSS'],$data['PER_PAGE'], $data['BASE_URL'], $work['pages']);
            for( $i = 0; $i <= $work['pages'] - 1; ++$i ) {
                $RealNo = $i * $data['PER_PAGE'];
                $PageNo = $i+1;
                if ($RealNo == $data['CUR_ST_VAL'])
                    $work['page_span'] .= "<span class='page_link_active'><b>{$PageNo}</b></span>";
                else {
                    if ($PageNo < ($work['current_page'] - $section)) {
                        $work['st_dots'] = "<a href='{$data['BASE_URL']}&amp;st=0' title='{$ibforums->lang['ps_page']} 1'><span class='page_link' >&laquo;&laquo;</span></a><a href='{$data['BASE_URL']}&amp;st=".($work['current_page']-2) * $data['PER_PAGE']."' title='{$ibforums->lang['ps_previous']} {$ibforums->lang['ps_page']}'><span class='page_link' >&lt;</span></a>";
                        continue;
                    }
                    if ($PageNo > ($work['current_page'] + $section)) {
                        $work['end_dots'] = "<a href='{$data['BASE_URL']}&amp;st=".($work['current_page']) * $data['PER_PAGE']."' title='{$ibforums->lang['ps_next']} {$ibforums->lang['ps_page']}'><span class='page_link' >&gt;</span></a><a href='{$data['BASE_URL']}&amp;st=".($work['pages']-1) * $data['PER_PAGE']."' title='{$ibforums->lang['ps_page']} {$work['pages']}'><span class='page_link' >&raquo;&raquo;</span></a>";
                        break;
                    }
                    $work['page_span'] .= "<a href='{$data['BASE_URL']}&amp;st={$RealNo}' title='{$ibforums->lang['ps_page']} {$PageNo}'><span class='page_link' >{$PageNo}</span></a>";
                }
            }
            $work['return']    = $work['first_page'].$work['st_dots'].$work['page_span'].''.$work['end_dots'];
        }
        else
            $work['return']    = $data['L_SINGLE'];
        return $work['return'];
    }
//-- mod_sec_update_131 end


    /*-------------------------------------------------------------------------*/
    // Build the forum jump menu

  H. Find in function load_words(..)

        require ROOT_PATH."lang/".$lang_type."/".$area.".php";

     Insert above the blue code



//-- mod_sec_update_131 begin
        global $ADMIN, $ibforums;
        if (empty($lang_type))
            $lang_type = "en";
        if (!file_exists(ROOT_PATH."lang/".$lang_type."/".$area.".php") ) {
            $info = "Could not load ".ROOT_PATH."lang/".$lang_type."/".$area.".php. Does it exist ?";
            if (isset($ADMIN) ) {
                $ADMIN->error($info);
            }
            else {
                $ibforums->lang['lang_not_found'] = $info;
                $this->error(array('MSG' => 'lang_not_found' ) );
            }
        }
//-- mod_sec_update_131 end


        require ROOT_PATH."lang/".$lang_type."/".$area.".php";

  I. Find in function load_words(..)

        require ROOT_PATH."lang/".$lang_type."/".$area.".php";

     Insert below the blue code

        require ROOT_PATH."lang/".$lang_type."/".$area.".php";



//-- mod_sec_update_131 begin
        if (!is_array($lang)) return array();
//-- mod_sec_update_131 end


  J. Find in function get_date(..)

    function get_date($date, $method) {

     Insert above the blue code



//-- mod_sec_update_131 begin
    function set_time_replace($member = "") {
        global $ibforums;

        if ($member == "" || !$member['use_language']) $member = &$ibforums->member;

        $lang_id = $member['language']?$member['language']:
                                                           ($ibforums->vars['default_language']!=""?
                                                            $ibforums->vars['default_language']:
                                                            'en');
        if (isset($this->Date_Replace_Array) && $this->lang_id == $lang_id) return;

        $this->lang_id = $lang_id;

        $this->lang = $this->load_words($this->lang, 'lang_date', $this->lang_id);
        $this->Date_Replace_Array = array(
                                            "January" => $this->lang['M1'],
                                            "February" => $this->lang['M2'],
                                            "March" => $this->lang['M3'],
                                            "April" => $this->lang['M4'],
                                            "May" => $this->lang['M5'],
                                            "June" => $this->lang['M6'],
                                            "July" => $this->lang['M7'],
                                            "August" => $this->lang['M8'],
                                            "September" => $this->lang['M9'],
                                            "October" => $this->lang['M10'],
                                            "November" => $this->lang['M11'],
                                            "December" => $this->lang['M12'],
                                            "Jan" => $this->lang['m1'],
                                            "Feb" => $this->lang['m2'],
                                            "Mar" => $this->lang['m3'],
                                            "Apr" => $this->lang['m4'],
                                            "May" => $this->lang['m5'],
                                            "Jun" => $this->lang['m6'],
                                            "Jul" => $this->lang['m7'],
                                            "Aug" => $this->lang['m8'],
                                            "Sep" => $this->lang['m9'],
                                            "Oct" => $this->lang['m10'],
                                            "Nov" => $this->lang['m11'],
                                            "Dec" => $this->lang['m12'],
                                            "Sunday" => $this->lang['D0'],
                                            "Monday" => $this->lang['D1'],
                                            "Tuesday" => $this->lang['D2'],
                                            "Wednesday" => $this->lang['D3'],
                                            "Thursday" => $this->lang['D4'],
                                            "Friday" => $this->lang['D5'],
                                            "Saturday" => $this->lang['D6'],
                                            "Sun" => $this->lang['d0'],
                                            "Mon" => $this->lang['d1'],
                                            "Tue" => $this->lang['d2'],
                                            "Wed" => $this->lang['d3'],
                                            "Thu" => $this->lang['d4'],
                                            "Fri" => $this->lang['d5'],
                                            "Sat" => $this->lang['d6']
                                         );
    }

    function format_date($date = "", $method = "") {
        global $ibforums;

        if (is_array($date)) {
            if ($date[5] < 1970) {
                $real_year = $date[5];
                $date[5] = 1970;
            }
            $date = mktime( $date[0],
                            $date[1],
                            $date[2],
                            $date[3],
                            $date[4],
                            $date[5]);
        }
        if (!$date) {
            return '--';
        }
        if (empty($method)) {
            $method = 'LONG';
        }
        $this->set_time_replace();
        if ($this->time_options[$method] != "") {
            $return = Strtr(date((isset($this->lang["time_format_".$method])?
                                     $this->lang["time_format_".$method]:
                                     $this->time_options[$method]
                                 ),
                                $date),
                                $this->Date_Replace_Array);
        } else {
            $return = Strtr(date($method, $date), $this->Date_Replace_Array);
        }
        if ($real_year)
            $return = str_replace("1970", $real_year, $return);
        return $return;
    }


    function get_member_date($member, $date = "", $method = "") {
        global $ibforums;

        if (!$date) {
            return '--';
        }
        if (empty($method)) {
            $method = 'LONG';
        }
        $offset = $this->get_time_offset($member);
        $this->set_time_replace($member);
        if ($this->time_options[$method] != "") {
            $return = Strtr(gmdate((isset($this->lang["time_format_".$method])?
                                     $this->lang["time_format_".$method]:
                                     $this->time_options[$method]
                                 ),
                                ($date + $offset) ),
                                $this->Date_Replace_Array);
        } else {
            $return = Strtr(gmdate($method, ($date + $offset) ), $this->Date_Replace_Array);
        }
        unset($this->Date_Replace_Array);
        return $return;
    }

    function get_date($date = "", $method = "", $override = FALSE, $detailed = false, $noclock = false) {
        global $ibforums;

        if (!$date) {
            return '--';
        }
        if (empty($method)) {
            $method = 'LONG';
        }
        if ($this->offset_set == 0) {
            $this->offset = $this->get_time_offset();
            $this->offset_set = 1;
        }
        if (!isset($this->Date_Replace_Array)) {
            $this->set_time_replace();
        }
        if ($ibforums->vars['use_relative_date'] && !$override) {
            $now = mktime();
            $today = gmdate("F j Y", $now + $this->offset);
            $yesterday = gmdate("F j Y", $now - 86400 + $this->offset);
            $tomorrow = gmdate("F j Y", $now + 86400 + $this->offset);
            $this_date = gmdate("F j Y", $date + $this->offset);
            if ($this_date == $today) {
                if ($noclock) {
                    return $this->lang['rel_today_noclock'];
                }
                else if ($now == $date) {
                    $rel_date = $this->lang['rel_now'];
                    return str_replace("{time}", $now - $date , $rel_date);
                }
                else if ($now - $date > 0 && $now - $date < 60) {
                    $rel_date = $this->lang['rel_seconds'];
                    return str_replace("{time}", $now - $date , $rel_date);
                }
                else if ($date - $now > 0 && $date - $now < 60) {
                    $rel_date = $this->lang['rel_seconds_soon'];
                    return str_replace("{time}", $date - $now , $rel_date);
                }
                else if ($now - $date > 0 && $now - $date < 3600) {
                    $rel_date = $this->lang['rel_minutes'];
                    return str_replace("{time}", round(($now - $date)/60) , $rel_date);
                }
                else if ($date - $now > 0 && $date - $now < 3600) {
                    $rel_date = $this->lang['rel_minutes_soon'];
                    return str_replace("{time}", round(($date - $now)/60) , $rel_date);
                }
                else if ($date - $now > 0){
                    if ($detailed) {
                        $hours = floor(($date - $now)/3600);
                        $minutes = round((($date - $now) % 3600)/60);
                        if ($hours == 1)
                            if ($minutes == 1)
                                $rel_date = $this->lang['rel_today_soon_h_m'];
                            else
                                $rel_date = $this->lang['rel_today_soon_h'];
                        else
                            if ($minutes == 1)
                                $rel_date = $this->lang['rel_today_soon_m'];
                            else
                                $rel_date = $this->lang['rel_today_soon_hm'];
                        $rel_date = str_replace("{hours}", $hours, $rel_date);
                        $rel_date = str_replace("{minutes}", $minutes, $rel_date);
                    }
                    else {
                        $rel_date = $this->lang['rel_today_soon'];
                    }
                    $method = $this->lang['time_format_rel'];
                    $rel_date = str_replace("{time}", gmdate($method, $date + $this->offset) , $rel_date);
                    return $rel_date;
                }
                else {
                    if ($detailed) {
                        $hours = floor(($now - $date)/3600);
                        $minutes = round((($now - $date) % 3600)/60);
                        if ($hours == 1)
                            if ($minutes == 1)
                                $rel_date = $this->lang['rel_today_h_m'];
                            else
                                $rel_date = $this->lang['rel_today_h'];
                        else
                            if ($minutes == 1)
                                $rel_date = $this->lang['rel_today_m'];
                            else
                                $rel_date = $this->lang['rel_today_hm'];
                        $rel_date = str_replace("{hours}", $hours, $rel_date);
                        $rel_date = str_replace("{minutes}", $minutes, $rel_date);
                    }
                    else {
                        $rel_date = $this->lang['rel_today'];
                    }
                    $method = $this->lang['time_format_rel'];
                    $rel_date = str_replace("{time}", gmdate($method, $date + $this->offset) , $rel_date);
                    return $rel_date;
                }
            }
            if ($this_date == $yesterday) {
                if ($noclock) {
                    return $this->lang['rel_yesterday_noclock'];
                }
                $rel_date = $this->lang['rel_yesterday'];
                $method = $this->lang['time_format_rel'];
                return str_replace("{time}", gmdate($method, $date + $this->offset) , $rel_date);
            }
            if ($this_date == $tomorrow) {
                if ($noclock) {
                    return $this->lang['rel_tomorrow_noclock'];
                }
                $rel_date = $this->lang['rel_tomorrow'];
                $method = $this->lang['time_format_rel'];
                return str_replace("{time}", gmdate($method, $date + $this->offset) , $rel_date);
            }
        }
        if ($this->time_options[$method] != "") {
            return Strtr(gmdate((isset($this->lang["time_format_".$method])?
                                     $this->lang["time_format_".$method]:
                                     $this->time_options[$method]
                                 ),
                                ($date + $this->offset) ),
                                $this->Date_Replace_Array);
        } else {
            return Strtr(gmdate($method, ($date + $this->offset) ), $this->Date_Replace_Array);
        }
    }

    function get_time_offset($member = "") {
        global $ibforums;
        $d = 0;
        if ($member == "")
            $member = &$ibforums->member;
        if (!$member['id'] || ($member['time_offset'] === "" && !$member['dst_in_use']) ) {
            $d = ($ibforums->vars['time_offset'] + $ibforums->vars['dst_in_use'])*3600 + ($ibforums->vars['time_adjust']) * 60;
        }
        else {
            $d  = ($member['time_offset'] + $member['dst_in_use'])*3600  +  ($ibforums->vars['time_adjust']) * 60;
        }
        return $d;
    }
//-- mod_sec_update_131 end

/*-- mod_sec_update_131 exclude begin


    function get_date($date, $method) {

  K. Find

    /*-------------------------------------------------------------------------*/
    // Returns the offset needed and stuff - quite groovy.
    /*-------------------------------------------------------------------------*/

     Insert above the blue code



-- mod_sec_update_131 exclude end */


    /*-------------------------------------------------------------------------*/
    // Returns the offset needed and stuff - quite groovy.
    /*-------------------------------------------------------------------------*/

  L. Find

    /*-------------------------------------------------------------------------*/
    // Returns the offset needed and stuff - quite groovy.
    /*-------------------------------------------------------------------------*/

     Insert below the blue code

    /*-------------------------------------------------------------------------*/
    // Returns the offset needed and stuff - quite groovy.
    /*-------------------------------------------------------------------------*/



/*-- mod_sec_update_131 exclude begin


  M. Find in function get_time_offset(..)

        return $r;

    }

     Insert below the blue code

        return $r;

    }



-- mod_sec_update_131 exclude end */


  N. Find in function my_getcookie(..)

            return urldecode($HTTP_COOKIE_VARS[$INFO['cookie_id'].$name]);

     Insert above the blue code



//-- mod_sec_update_131 begin
            return $this->clean_value(urldecode($HTTP_COOKIE_VARS[$INFO['cookie_id'].$name]));
//-- mod_sec_update_131 end


            return urldecode($HTTP_COOKIE_VARS[$INFO['cookie_id'].$name]);

  O. Find in function parse_incoming(..)

            while( list($k, $v) = each($HTTP_GET_VARS) )
            {

     Insert below the blue code

            while( list($k, $v) = each($HTTP_GET_VARS) )
            {



//-- mod_sec_update_131 begin
                if (strpos($k, "amp;") === 0)
                    $k = substr($k, 4);
//-- mod_sec_update_131 end


  P. Find in function clean_key(..)

    function clean_key($key) {

     Insert above the blue code



//-- mod_sec_update_131 begin
    function clean_int_array($array=array()) {
        $return = array();
        if (is_array($array))
            foreach($array as $k => $v)
                $return[ intval($k) ] = intval($v);
        return $return;
    }
//-- mod_sec_update_131 end


    function clean_key($key) {

  Q. Find in function do_output(..)

        if ($ibforums->vars['gl_show'] and $ibforums->vars['gl_title'])

     Insert above the blue code



//-- mod_sec_update_131 begin
        if (file_exists(ROOT_PATH."lang/".$ibforums->lang_id."/mod_sec_lang_macro.php")) {
            global $std;
            $ibforums->lang = $std->load_words($ibforums->lang, 'mod_sec_lang_macro', $ibforums->lang_id );
        }
        if ($ibforums->vars['gl_show'] && file_exists(ROOT_PATH."lang/".$ibforums->lang_id."/lang_glines.php")) {
            global $std;
            $ibforums->lang = $std->load_words($ibforums->lang, 'lang_glines', $ibforums->lang_id );
            if ($ibforums->lang['gl_link'] == "")
                $ibforums->lang['gl_link'] = $ibforums->base_url."act=boardrules";
            $this_header = str_replace( "<!--IBF.RULES-->", $skin_universal->rules_link($ibforums->lang['gl_link'], $ibforums->lang['gl_title']), $this_header );
        }
        else
//-- mod_sec_update_131 end


        if ($ibforums->vars['gl_show'] and $ibforums->vars['gl_title'])

  R. Find in function do_output(..)

                $ibforums->skin['template'] = str_replace( "<{".$row['macro_value']."}>"

     Insert above the blue code



//-- mod_sec_update_131 begin
                $row['macro_replace'] = preg_replace("`\<\{LANG_M_(.*?)\}\>`e", "\$ibforums->lang['MACRO_\\1']", $row['macro_replace']);
//-- mod_sec_update_131 end


                $ibforums->skin['template'] = str_replace( "<{".$row['macro_value']."}>"

  S. Find in function redirect_screen(..)

        $htm = $skin_universal->Redirect($text, $url, $css);

     Insert above the blue code



//-- mod_sec_update_131 begin
        if (file_exists(ROOT_PATH."lang/".$ibforums->lang_id."/mod_sec_lang_macro.php")) {
            global $std;
            $ibforums->lang = $std->load_words($ibforums->lang, 'mod_sec_lang_macro', $ibforums->lang_id );
        }
//-- mod_sec_update_131 end


        $htm = $skin_universal->Redirect($text, $url, $css);

  T. Find in function redirect_screen(..)

                $htm = str_replace( "<{".$row['macro_value']."}>", $row['macro_replace'], $htm );

     Insert above the blue code



//-- mod_sec_update_131 begin
                $row['macro_replace'] = preg_replace("`\<\{LANG_M_(.*?)\}\>`e", "\$ibforums->lang['MACRO_\\1']", $row['macro_replace']);
//-- mod_sec_update_131 end


                $htm = str_replace( "<{".$row['macro_value']."}>", $row['macro_replace'], $htm );

  U. Find in function pop_up_window(..)

        $html = $skin_universal->pop_up_window($title, $css, $text);

     Insert above the blue code



//-- mod_sec_update_131 begin
        if (file_exists(ROOT_PATH."lang/".$ibforums->lang_id."/mod_sec_lang_macro.php")) {
            global $std;
            $ibforums->lang = $std->load_words($ibforums->lang, 'mod_sec_lang_macro', $ibforums->lang_id );
        }
//-- mod_sec_update_131 end


        $html = $skin_universal->pop_up_window($title, $css, $text);

  V. Find in function pop_up_window(..)

                $html = str_replace( "<{".$row['macro_value']."}>", $row['macro_replace'], $html );

     Insert above the blue code



//-- mod_sec_update_131 begin
                $row['macro_replace'] = preg_replace("`\<\{LANG_M_(.*?)\}\>`e", "\$ibforums->lang['MACRO_\\1']", $row['macro_replace']);
//-- mod_sec_update_131 end


                $html = str_replace( "<{".$row['macro_value']."}>", $row['macro_replace'], $html );

  W. Find in function authorise(..)

        if ($ibforums->vars['load_limit'] > 0)
        {

     Insert below the blue code

        if ($ibforums->vars['load_limit'] > 0)
        {



//-- mod_sec_update_131 begin
            if (true) {
                if (file_exists('/proc/loadavg')) {
                    if ($fh = @fopen( '/proc/loadavg', 'r' )) {
                        $data = @fread( $fh, 6 );
                        @fclose( $fh );
                        $load_avg = explode( " ", $data );
                        $ibforums->server_load = trim($load_avg[0]);
                    }
                }
                // no /proc/loadavg or no permission to read it
                if (!$ibforums->server_load && $serverstats = @exec("uptime")) {
                    if (preg_match( "/average.*?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/", $serverstats, $load ))
                        $ibforums->server_load = $load[1];
                }
                // are we on a windows with load average installed?
                if (!$ibforums->server_load && $serverstats = @exec("getloadavg")) {
                    if (preg_match( "/average.*?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/", $serverstats, $load ))
                        $ibforums->server_load = $load[1];
                }
                if ($ibforums->server_load > $ibforums->vars['load_limit']) {
                    $std->Error( array( 'LEVEL' => 1, 'MSG' => 'server_too_busy', 'INIT' => 1 ) );
                }
            }
            else
//-- mod_sec_update_131 end


  X. Find in function authorise(..)

        if ( $ibforums->input['act'] == 'Attach' )

     Insert above the blue code



//-- mod_sec_update_131 begin
        if ($ibforums->vars['guests_attach'])
//-- mod_sec_update_131 end


        if ( $ibforums->input['act'] == 'Attach' )

  Y. Find in function authorise(..)

        $this->ip_address = $ibforums->input['IP_ADDRESS'];

     Insert below the blue code

        $this->ip_address = $ibforums->input['IP_ADDRESS'];



//-- mod_sec_update_131 begin
        $this->ip_address = $ibforums->input['IP_ADDRESS'] ? $ibforums->input['IP_ADDRESS'] : $_SERVER['REMOTE_ADDR'];
//-- mod_sec_update_131 end


  Z. Find in function authorise(..)

        //-------------------------------------------------
        // Do we have a valid session ID?

     Insert above the blue code



//-- mod_sec_update_131 begin
        $ibforums->input['Privacy'] = max(0, intval($ibforums->input['Privacy']));
        if ($adsess = $ibforums->input['adsess']) {
            $DB->query("SELECT s.*, m.mgroup FROM ibf_admin_sessions s LEFT JOIN ibf_members m ON (s.MEMBER_ID=m.id) WHERE s.ID='$adsess'");
            if ($r = $DB->fetch_row()) {
                if ($r['mgroup'] == $ibforums->vars['admin_group']) {
                    define("IS_ACP_SESSION", "1");
                    require_once(ROOT_PATH."sources/mods/sec_update_131_A/mod_sec_update_acp_session.php");
                    $acp_session = new mod_acp_session();
                    $acp_session->load_vars($this, $r);
                }
            }
        }
//-- mod_sec_update_131 end


        //-------------------------------------------------
        // Do we have a valid session ID?

  AA. Find in function load_member(..)

            $DB->query("SELECT moderator.mid as is_mod,

     Insert above the blue code



//-- mod_sec_update_131 begin
            if (TRUE)
                $DB->query("SELECT m.*, g.*, moderator.mid as is_mod, moderator.forum_id as mod_fid, moderator.allow_warn
                                FROM ibf_members m
                                LEFT JOIN ibf_groups g ON (g.g_id=m.mgroup)
                                LEFT JOIN ibf_moderators moderator ON (moderator.member_id=m.id OR moderator.group_id=m.mgroup )
                                WHERE m.id=$member_id");
            else
//-- mod_sec_update_131 end


            $DB->query("SELECT moderator.mid as is_mod,

  AB. Find in function load_member(..)

                $this->unload_member();
            }

     Insert below the blue code

                $this->unload_member();
            }



//-- mod_sec_update_131 begin
            else if (defined("IS_ACP_SESSION")) {
                require_once(ROOT_PATH."sources/mods/sec_update_131_A/mod_sec_update_acp_session.php");
                $acp_session = new mod_acp_session();
                $acp_session->load_member($this->member);
            }
//-- mod_sec_update_131 end


  AC. Find in function update_member_session(..), update_guest_session(..)

            $this->create_guest_session();
            return;
        }

     Insert below the blue code

            $this->create_guest_session();
            return;
        }



//-- mod_sec_update_131 begin
        if (strpos($ibforums->input['act'], "xajax") !== false)
            return;
//-- mod_sec_update_131 end



Step  7:  Open sources/Memberlist.php

  A. Find in function Memberlist(..)

        $this->html = $std->load_template('skin_mlist');

     Insert below the blue code

        $this->html = $std->load_template('skin_mlist');



//-- mod_sec_update_131 begin
        $this->html = $std->load_template('mod_sec_update_skin_mlist');
        $ibforums->lang = $std->load_words($ibforums->lang, 'mod_sec_lang_mlist', $ibforums->lang_id );
        $DB->query("SELECT fid, ftitle from ibf_pfields_data WHERE fhide<>'1' AND fsearchable='1' ORDER BY forder");
        while ($r = $DB->fetch_row() ) {
            $pfield_filter[$r['fid']] = $r['ftitle'];
        }
        unset($r);
        $DB->free_result();
//-- mod_sec_update_131 end


  B. Find in function Memberlist(..)

        if ($ibforums->input['name_box'] != 'all')

     Insert above the blue code



//-- mod_sec_update_131 begin
        if (FALSE)
//-- mod_sec_update_131 end


        if ($ibforums->input['name_box'] != 'all')

  C. Find in function Memberlist(..)

        if ($ibforums->input['photoonly'] == 1)

     Insert above the blue code



//-- mod_sec_update_131 begin
        $this->first = max(0, $this->first);
        $ibforums->input['name'] = str_replace( '|', '&#124;', $ibforums->input['name']);
        if ($ibforums->input['name_box'] != 'all')
            if ( $ibforums->input['name_box'] == 'begins' )
                $q_extra .= " AND m.name LIKE '".str_replace("*", "%", $ibforums->input['name'])."%'";
            else
                $q_extra .= " AND m.name LIKE '%".str_replace("*", "%", $ibforums->input['name'])."%'";
        if ($ibforums->input['pfield_box']) {
            $ibforums->input['pfield'] = str_replace("*", "%", $ibforums->input['pfield']);
            $ibforums->input['pfield'] = str_replace("&gt;", ">", $ibforums->input['pfield']);
            $ibforums->input['pfield'] = str_replace("&lt;", "<", $ibforums->input['pfield']);
            if (intval($ibforums->input['pfield_box']) == $ibforums->input['pfield_box'] && intval($ibforums->input['pfield_box']) > 0) {
                $joined = "LEFT JOIN ibf_pfields_content p ON (m.id=p.member_id)";
                $q_extra .= " AND p.field_".intval($ibforums->input['pfield_box'])." LIKE '%".$ibforums->input['pfield']."%'";
            }
            else if (in_array($ibforums->input['pfield_box'], array("birthday","website", "icq_number", "aim_name", "yahoo", "msnname", "location", "interests"))) {
                if ($ibforums->input['pfield_box'] == "birthday")
                    $q_extra .= " AND CONCAT(m.bday_year, '-', m.bday_month, '-', m.bday_day) LIKE '%".$ibforums->input['pfield']."%'";
                else
                    $q_extra .= " AND m.".$ibforums->input['pfield_box']." LIKE '%".$ibforums->input['pfield']."%'";
            }
        }
        if ($ibforums->input['photoonly'] == 1) {
            $DB->query("SELECT COUNT(m.id) as total_members FROM ibf_members m
                        LEFT JOIN ibf_member_extra me ON me.id=m.id
                        $joined
                        LEFT JOIN ibf_groups g ON m.mgroup=g.g_id
                        WHERE me.photo_location <> '' AND m.id > 0  AND g.g_hide_from_list <> 1".$q_extra);

            $q_extra .= " AND me.photo_location <> ''";
        }
        else {
            $DB->query("SELECT COUNT(m.id) as total_members FROM ibf_members m
                        $joined
                        LEFT JOIN ibf_groups g ON m.mgroup=g.g_id
                        WHERE m.id > 0  AND g.g_hide_from_list <> 1".$q_extra);
        }
        if (FALSE)
//-- mod_sec_update_131 end


        if ($ibforums->input['photoonly'] == 1)

  D. Find in function Memberlist(..)

        $links = $std->build_pagelinks(  array( 'TOTAL_POSS'  => $max['total_members'],

     Insert above the blue code



//-- mod_sec_update_131 begin
        $ibforums->input['name'] = $std->txt_stripslashes(isset($_GET['name'])?$_GET['name']:$_POST['name']);
        $ibforums->input['pfield'] = $std->txt_stripslashes(isset($_GET['pfield'])?$_GET['pfield']:$_POST['pfield']);
        $links = $std->build_pagelinks(  array( 'TOTAL_POSS'  => $max['total_members'],
                                                'PER_PAGE'    => $this->max_results,
                                                'CUR_ST_VAL'  => $this->first,
                                                'L_SINGLE'     => "",
                                                'L_MULTI'      => $ibforums->lang['pages'],
                                                'BASE_URL'     => $this->base_url."&amp;act=Members&amp;photoonly={$ibforums->input['photoonly']}&amp;name=".urlencode($ibforums->input['name'])."&amp;name_box={$ibforums->input['name_box']}&amp;pfield=".urlencode($ibforums->input['pfield'])."&amp;pfield_box={$ibforums->input['pfield_box']}&amp;max_results={$this->max_results}&amp;filter={$this->filter}&amp;sort_order={$this->sort_order}&amp;sort_key={$this->sort_key}"
                                              )
                                       );
        if (FALSE)
//-- mod_sec_update_131 end


        $links = $std->build_pagelinks(  array( 'TOTAL_POSS'  => $max['total_members'],

  E. Find in function Memberlist(..)

        // START THE LISTING
        //-----------------------------

     Insert below the blue code

        // START THE LISTING
        //-----------------------------



//-- mod_sec_update_131 begin
        if (!is_numeric($this->first)) {
            $this->first = "0";
        }
        $DB->query("SELECT m.name, m.id, m.posts, m.joined, m.mgroup, m.email,m.title, m.hide_email, m.location, m.aim_name, m.icq_number,
                           me.photo_location, me.photo_type, me.photo_dimensions
                    FROM ibf_members m
                      $joined
                      LEFT JOIN ibf_member_extra me ON me.id=m.id
                      LEFT JOIN ibf_groups g ON m.mgroup=g.g_id
                    WHERE m.id > 0".$q_extra." AND g.g_hide_from_list <> 1
                    ORDER BY m.".$this->sort_key." ".$this->sort_order."
                    LIMIT ".$this->first.",".$this->max_results);
        if (FALSE)
//-- mod_sec_update_131 end


  F. Find in function Memberlist(..)

        $this->output .= $this->html->Page_end( $checked );

     Insert above the blue code



//-- mod_sec_update_131 begin
        $data = array();
        $data['checked'] = $checked;
        $selected = "selected='selected'";
        if ($ibforums->input['name_box'] == "begins") $data['bsel'] = $selected;
        if ($ibforums->input['name_box'] == "contains") $data['csel'] = $selected;
        if (!empty($ibforums->vars['profile_fields'])) {
            $fields = explode("|", $ibforums->vars['profile_fields']);
            if (is_array($fields))
                foreach ($fields as $k) {
                    $item = explode(",", $k);
                    if ($item[3])
                        if ($ibforums->input['pfield_box'] == $item[0])
                            $options .= "<option value='{$item[0]}' $selected>{$ibforums->lang[$item[0]]}</option>\n";
                        else
                            $options .= "<option value='{$item[0]}'>{$ibforums->lang[$item[0]]}</option>\n";
                }
        }
        if (is_array($pfield_filter)) {
            foreach($pfield_filter as $k => $v) {
                if ($ibforums->input['pfield_box'] == $k)
                    $options .= "<option value='$k' $selected>$v</option>\n";
                else
                    $options .= "<option value='$k'>$v</option>\n";
            }
            $data['pfield'] = $this->html->pfield_filter($options);
        }
        $this->output .= $this->html->Page_end($data);
        if (FALSE)
//-- mod_sec_update_131 end


        $this->output .= $this->html->Page_end( $checked );


Step  8:  Open sources/Messenger.php

  A. Find in function Messenger(..)

        $this->html = $std->load_template('skin_msg');

     Insert below the blue code

        $this->html = $std->load_template('skin_msg');



//-- mod_sec_update_131 begin
        $ibforums->lang = $std->load_words($ibforums->lang, 'mod_sec_lang_ucp', $ibforums->lang_id);
        $ibforums->lang = $std->load_words($ibforums->lang, 'mod_sec_lang_msg', $ibforums->lang_id);
        $ibforums->lang = $std->load_words($ibforums->lang, 'mod_sec_lang', $ibforums->lang_id);
        $this->html = $std->load_template('mod_sec_update_skin_msg');
//-- mod_sec_update_131 end


  B. Find in function Messenger(..)

            $this->msg_stats['dir_data'][] = array( 'id' => $id, 'real' => $real );

     Insert above the blue code



//-- mod_sec_update_131 begin
            if ($id == "in")
                $real = $ibforums->lang['inbox'];
            if ($id == "sent")
                $real = $ibforums->lang['outbox'];
//-- mod_sec_update_131 end


            $this->msg_stats['dir_data'][] = array( 'id' => $id, 'real' => $real );

  C. Find in function Messenger(..)

        //--------------------------------------------
        // Using Sub Manager?

     Insert above the blue code



//-- mod_sec_update_131 begin
        if ($ibforums->vars['requests_active']) {
            require(ROOT_PATH."sources/mods/sec_update_131_A/mod_sec_update_ucp_func.php");
            $ucp = new mod_sec_update_ucp();
            $req_html  = $ucp->get_menu();
            if (strpos($menu_html, "<!--REQUEST_LINK-->") !== FALSE) {
                $menu_html = str_replace(  "<!--REQUEST_LINK-->", $req_html, $menu_html);
            }
            else {
                $menu_html = str_replace("<!-- Options -->", $req_html."\n<!-- Options -->", $menu_html);
            }
        }
//-- mod_sec_update_131 end


        //--------------------------------------------
        // Using Sub Manager?

  D. Find in function prefs(..)

                 $extra = "&nbsp;&nbsp;( ".$v['real']." - ".$ibforums->lang['cannot_remove']." )";

     Insert below the blue code

                 $extra = "&nbsp;&nbsp;( ".$v['real']." - ".$ibforums->lang['cannot_remove']." )";



//-- mod_sec_update_131 begin
                $v['id'] .= "' readonly='readonly";
//-- mod_sec_update_131 end


  E. Find in function add_member(..)

         $DB->query("SELECT name, id FROM ibf_members WHERE LOWER(name)='".$ibforums->input['mem_name']."'");

     Insert above the blue code



//-- mod_sec_update_131 begin
         $ibforums->input['mem_name'] = strtolower(str_replace( '|', '&#124;',trim($ibforums->input['mem_name'])));
//-- mod_sec_update_131 end


         $DB->query("SELECT name, id FROM ibf_members WHERE LOWER(name)='".$ibforums->input['mem_name']."'");

  F. Find in function del_tracked(..)

             $DB->query("DELETE FROM ibf_messages WHERE tracking=1 AND read_state=0

     Insert above the blue code



//-- mod_sec_update_131 begin
            if (TRUE)
                $DB->query("UPDATE ibf_messages SET tracking=0 WHERE tracking=1 AND from_id='".$this->member['id']."' AND msg_id IN ($id_string)");
            else
//-- mod_sec_update_131 end


             $DB->query("DELETE FROM ibf_messages WHERE tracking=1 AND read_state=0

  G. Find in function view_msg(..)

         if ($ibforums->member['new_msg'] >= 1)
         {

     Insert above the blue code



//-- mod_sec_update_131 begin
        $tooltip = intval($ibforums->input['tooltip']);
        if ($msg['tracking'] && !$tooltip) {
            $time = time();
            if (!$msg['read_state']) {
                $query = "UPDATE ibf_messages SET read_state=1, read_date='0' WHERE msg_id='".$ibforums->input['MSID']."'";
            }
            if ($msg['read_date'] == 0) {
                if ($ibforums->input['read_track']) {
                    $query = "UPDATE ibf_messages SET read_state=1, read_date='".$time."' WHERE msg_id='".$ibforums->input['MSID']."'";
                    $msg['read_date'] = $time;
                }
            }
            if ($query) {
                $DB->query($query);
                $msg['read_state'] = 1;
            }
        }
        if (!$tooltip)
//-- mod_sec_update_131 end


         if ($ibforums->member['new_msg'] >= 1)
         {

  H. Find in function view_msg(..)

         if ($msg['read_state'] < 1)

     Insert above the blue code



//-- mod_sec_update_131 begin
        if (!$tooltip)
//-- mod_sec_update_131 end


         if ($msg['read_state'] < 1)

  I. Find in function view_msg(..)

         $DB->query("SELECT g.*, m.* ".

     Insert above the blue code



//-- mod_sec_update_131 begin
        if ($tooltip) {
            global $print;
             $msg['message'] = $this->parser->convert( array( 'TEXT'    => $msg['message'],
                                                             'SMILIES' => 1,
                                                             'CODE'    => $ibforums->vars['msg_allow_code'],
                                                             'HTML'    => $ibforums->vars['msg_allow_html']
                                                           )
                                                    );
            $print->pop_up_window($ibforums->lang['t_welcome'], $msg['message']);
            die;
        }
        $can_view_onoff = $ibforums->member['g_can_view_on_off'] || $ibforums->member['mgroup'] == $ibforums->vars['admin_group'] || $ibforums->member['access_cp'] || $ibforums->member['is_sup_mod'];
        if ($can_view_onoff) {
            $ibforums->lang = $std->load_words($ibforums->lang, 'lang_date', $ibforums->lang_id);
            $DB->query("SELECT g.*, m.*, s.login_type, s.running_time ".
                       "FROM ibf_groups g,ibf_members m
                       LEFT JOIN ibf_sessions s ON (s.member_id=m.id AND s.member_id<>0 AND s.member_id IS NOT NULL)
                       WHERE m.id='".$msg['from_id']."' AND g.g_id=m.mgroup");
        }
        else
//-- mod_sec_update_131 end


         $DB->query("SELECT g.*, m.* ".

  J. Find in function view_msg(..)

        if ($this->member['view_sigs'])

     Insert above the blue code



//-- mod_sec_update_131 begin
        if ($can_view_onoff) {
            $cutoff = time() - ($ibforums->vars['au_cutoff']?$ibforums->vars['au_cutoff']:15)*60;
            
            if ($ibforums->member['mgroup'] == $ibforums->vars['admin_group'] || $ibforums->member['access_cp'] || $ibforums->member['is_sup_mod']) {
                $online = $member['login_type'] == 1?"online_anon":($member['login_type'] === '0' || $member['login_type'] == -1?"online":"offline");
            }
            else if ($ibforums->member['g_can_view_on_off']) {
                $online = $member['login_type'] == 1?"offline":($member['login_type'] === '0' || $member['login_type'] == -1?"online":"offline");
            }
            if ($online == "online" && intval($member['running_time']) < $cutoff) {
                $online = "offline";
            }
            
            if (method_exists($this->html, "state_online"))
                switch($online) {
                    case "online"       :   $member['state_on_off'] = $this->html->state_online();
                                            break;
                    case "online_anon"  :   $member['state_on_off'] = $this->html->state_online_anon();
                                            break;
                    case "offline"      :   $member['state_on_off'] = $this->html->state_offline();
                                            break;
                }
        }
//-- mod_sec_update_131 end


        if ($this->member['view_sigs'])

  K. Find in function view_msg(..)

        $this->output .= $this->html->Render_msg( array(

     Insert above the blue code



//-- mod_sec_update_131 begin
        $thread = intval($ibforums->input['thread']>0);
        if ($msg['last'] || $msg['next']) {
            if ($thread) {
                $show_preview = $ibforums->vars['msg_preview'] && strpos($ibforums->skin['css_text'], "domTT") !== FALSE;
                $switch_title = $ibforums->lang['normal_view'];
                $switch_title_info = $ibforums->lang['normal_view_info'];
                $DB->query("SELECT m.member_id, m.msg_id, m.vid, m.msg_date, m.title, m.from_id, mem.name as from_name, m.recipient_id as to_id, mem2.name as to_name FROM ibf_messages m LEFT JOIN ibf_members mem ON (m.from_id = mem.id) LEFT JOIN ibf_members mem2 ON (m.recipient_id = mem2.id) WHERE ref='".$msg['ref']."' AND member_id='".$this->member['id']."' ORDER BY msg_date");
                if ($DB->get_num_rows()) {
                    $i = 0;
                    while ($r = $DB->fetch_row()) {
                        $r['msg_date'] = $std->get_date($r['msg_date'], "SHORT");
                        if ($r['to_id'] == $this->member['id'])
                            $r['to_name'] = $ibforums->lang['to_me'];
                        if ($r['from_id'] == $this->member['id'])
                            $r['from_name'] = $ibforums->lang['from_me'];
                        if ($i > 0) {
                            $r['tab'] = $tab."<img src='{$ibforums->vars['img_url']}/children_last.gif' />";
                            $tab .= "<img src='{$ibforums->vars['img_url']}/children_space.gif' />";
                        }
                        if ($r['msg_id'] == $msg['msg_id'])
                            $r['class'] = "searchlite";
                        else    
                            $r['class'] = "row1";
                        if ($show_preview) {
                            $link = "{$ibforums->base_url}act=Msg&amp;CODE=03&amp;tooltip=1&amp;VID={$r['vid']}&amp;MSID={$r['msg_id']}";
                            $r['tooltip']  = "onMouseOver=\"domTT_oneOnly = true; this.style.color = '#000000';";
                            $r['tooltip'] .= "return makeFalse(domTT_activate(this, event,
                                                                'caption', '',
                                                                'width', '410px',
                                                                'fade', 'both',
                                                                'fadeMax', 100,
                                                                'trail', false,
                                                                'offsetX', 20,
                                                                'offsetY', 5,
                                                                'lazy', true,
                                                                'delay', 500,
                                                                'content', '&lt;iframe src=&quot;$link&quot; class=&quot;tableborder&quot; style=&quot;width: 400px; height: 200px;&quot;&gt;&lt;/iframe&gt;',
                                                                'styleClass', 'domTTlegend',
                                                                'type', 'velcro'
                                                                ));\"";
                        }
                        else
                            $r['tooltip'] = "title='".$ibforums->lang['show_msg']."'";
                        $html .= $this->html->render_thread_msg($r);
                        $i++;
                    }
                    $this->output .= $this->html->wrap_thread($html, intval($ibforums->input['scroll']));
                }
            }
            else {
                $switch_title = $ibforums->lang['thread_view'];
                $switch_title_info = $ibforums->lang['thread_view_info'];
            }
            $switch = "<a href='{$ibforums->base_url}act=Msg&amp;CODE=03&amp;VID={$msg['vid']}&amp;MSID={$msg['msg_id']}&amp;thread=".(1 - $thread)."&amp;MID={$member['id']}' title='$switch_title_info'>$switch_title</a>";
        }
        else {
            $switch = "&nbsp;";
            $msg['next'] = "";
            $msg['last'] = "";
        }
        if ($msg['sent']) {
            if ($msg['next'])
                $msg['next'] = "<a href='".$ibforums->base_url."act=Msg&CODE=03&thread=$thread&VID=in&MSID=".$msg['next']."' title='".$ibforums->lang['show_your_reply']."'><{B_HOT_NN_DOT}></a>&nbsp;";
            if ($msg['last'])
                $msg['last'] = "<a href='".$ibforums->base_url."act=Msg&CODE=03&thread=$thread&VID=in&MSID=".$msg['last']."' title='".$ibforums->lang['show_ref']."'><{B_NORM_DOT}></a>&nbsp;";
        }
        else {
            if ($msg['next'])
                $msg['next'] = "<a href='".$ibforums->base_url."act=Msg&CODE=03&thread=$thread&VID=sent&MSID=".$msg['next']."' title='".$ibforums->lang['show_reply']."'><{B_HOT_NN_DOT}></a>&nbsp;";
            if ($msg['last'])
                $msg['last'] = "<a href='".$ibforums->base_url."act=Msg&CODE=03&thread=$thread&VID=sent&MSID=".$msg['last']."' title='".$ibforums->lang['show_recent_reply']."'><{B_NORM_DOT}></a>&nbsp;";
        }
        $this->output .= $this->html->Render_msg( array( 'switch' => $switch,
                                                         'msg'    => $msg,
                                                         'member' => $member,
                                                         'jump'   => $this->jump_html,
                                                )      );
        $this->output = str_replace("x = posleft", "X = posleft", $this->output);
        $this->output = str_replace("y = postop", "Y = postop", $this->output);
        if ($msg['tracking']) {
            if ($msg['read_date'])
//                $read_track = "<div style='text-align:right;vertical-align:bottom;'>{$ibforums->lang['read_track_sent']}&nbsp;".$std->format_date($msg['read_date'], "LONG")."</div>";
                $read_track = "<tr><td class='row2'>&nbsp;</td><td class='row2' style='text-align:right;'>{$ibforums->lang['read_track_sent']}&nbsp;".$std->format_date($msg['read_date'], "LONG")."</td></tr>";
            else
//                $read_track = "<div style='text-align:right;vertical-align:bottom;'>{$ibforums->lang['read_track_title']}&nbsp;<b><a href='{$ibforums->base_url}CODE=03&amp;act=Msg&amp;MSID={$msg['msg_id']}&amp;MID={$member['id']}&amp;read_track=1' class='' >{$ibforums->lang['read_track_send']}</a></b></div>";
                $read_track = "<tr><td class='row2'>&nbsp;</td><td class='row2' style='text-align:right;'>{$ibforums->lang['read_track_title']}&nbsp;<b><a href='{$ibforums->base_url}CODE=03&amp;act=Msg&amp;MSID={$msg['msg_id']}&amp;MID={$member['id']}&amp;read_track=1' class='' >{$ibforums->lang['read_track_send']}</a></b></td></tr>";
//            $match = "`(".preg_quote($member['signature']).")`is";
//            $this->output = preg_replace($match, "\\1".$read_track."</td>", $this->output );
            $match = "`^(.*)(<tr.*?CODE=02)`is";
            $this->output = preg_replace($match, "\\1".$read_track."\\2", $this->output );
        }
        if (FALSE)
//-- mod_sec_update_131 end


        $this->output .= $this->html->Render_msg( array(

  L. Find in function class properties or methods(..), edit_saved(..)

         $ibforums->lang['the_max_length'] = $ibforums->vars['max_post_length'] * 1024;

     Insert above the blue code



//-- mod_sec_update_131 begin
        $ref = "<input type='hidden' name='REF' value='".(is_array($msg)?$msg['my_ref']:intval($ibforums->input['MSID']))."' />\n";
        $add = $ref."<input type='hidden' name='auth_key' value='".$std->return_md5_check()."' />\n";
        $this->output = preg_replace("`(<input.*?OID.*?\/>)`", "\\1\n$add", $this->output);
//-- mod_sec_update_131 end


         $ibforums->lang['the_max_length'] = $ibforums->vars['max_post_length'] * 1024;

  M. Find in function send_msg(..)

         $ibforums->input['from_contact'] = $ibforums->input['from_contact'] ? $ibforums->input['from_contact'] : '-';

     Insert below the blue code

         $ibforums->input['from_contact'] = $ibforums->input['from_contact'] ? $ibforums->input['from_contact'] : '-';



//-- mod_sec_update_131 begin
        if ( $ibforums->input['auth_key'] != $std->return_md5_check() ) {
            return;
        }
//-- mod_sec_update_131 end


  N. Find in function send_msg(..)

             $query = "id='".$ibforums->input['from_contact']."'";

     Insert below the blue code

             $query = "id='".$ibforums->input['from_contact']."'";



//-- mod_sec_update_131 begin
             $query = "id='".intval($ibforums->input['from_contact'])."'";
//-- mod_sec_update_131 end


  O. Find in function send_msg(..)

                          'cc_users'       => $ibforums->input['carbon_copy']

     Insert above the blue code



//-- mod_sec_update_131 begin
                          'my_ref'         => intval($ibforums->input['REF']),
//-- mod_sec_update_131 end


                          'cc_users'       => $ibforums->input['carbon_copy']

  P. Find in function send_msg(..)

             $this->send_form(1);

     Insert above the blue code



//-- mod_sec_update_131 begin
             $ibforums->input['MSID'] = intval($ibforums->input['REF']);
//-- mod_sec_update_131 end


             $this->send_form(1);

  Q. Find in function send_msg(..)

         unset($to_member);

     Insert above the blue code



//-- mod_sec_update_131 begin
         $DB->query("SELECT * FROM ibf_messages WHERE member_id='".$ibforums->member['id']."' AND msg_id='".intval($ibforums->input['REF'])."'");
         $ref = array();
         if ($DB->get_num_rows())
             $ref = $DB->fetch_row();
         $DB->query("SELECT * FROM ibf_messages WHERE member_id='".$ref['from_id']."' AND msg_id='".intval($ref['your_ref'])."'");
         $your_ref = array();
         if ($DB->get_num_rows())
             $your_ref = $DB->fetch_row();
         if ($ibforums->input['add_sent']) {
            $DB->query("UPDATE ibf_members SET ".
                        "msg_total = msg_total + 1 ".
                        "WHERE id='" . $this->member['id'] . "'");
            $DB->query("UPDATE ibf_members SET msg_total = msg_total + 1 WHERE id='" . $this->member['id'] . "'");
            $db_string = $std->compile_db_string( array(
                                                         'member_id'      => $this->member['id'],
                                                         'msg_date'       => time(),
                                                         'read_state'     => 1,
                                                         'title'          => $ibforums->lang['saved_sent_msg'].' '.$ibforums->input['msg_title'],
                                                         'message'        => $ibforums->input['Post'],
                                                         'from_id'        => $this->member['id'],
                                                         'vid'            => 'sent',
                                                         'recipient_id'   => $to_member['id'],
                                                         'sent'           => 1,
                                                         'last'           => $ref['msg_id'],
                                                         'ref'            => $ref['ref'],
                                                )      );
            $DB->query("INSERT INTO ibf_messages (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")");
            unset($db_string);
            $sent_id = $DB->get_insert_id();
            if (!$ref['ref']) {
                $ref_id = $sent_id;
                if ($ref['msg_id']) {
                    $DB->query("UPDATE ibf_messages SET ref=msg_id WHERE msg_id='".$ref['msg_id']."'");
                    $ref_id = $ref['msg_id'];
                }
                $DB->query("UPDATE ibf_messages SET ref='$ref_id' WHERE msg_id='$sent_id'");
            }
        }
        $DB->query("UPDATE ibf_messages SET next='$sent_id', my_ref='".$ref['my_ref']."' WHERE msg_id='".intval($ibforums->input['REF'])."'");
//-- mod_sec_update_131 end


         unset($to_member);

  R. Find in function send_msg(..)

'tracking'       => $ibforums->input['add_tracking'],

     Insert below the blue code

'tracking'       => $ibforums->input['add_tracking'],



//-- mod_sec_update_131 begin
                                                         'last'           => $ref['your_ref'],
                                                         'my_ref'         => $ref['your_ref'],
                                                         'your_ref'       => $sent_id,
                                                         'ref'            => $your_ref['ref'],
//-- mod_sec_update_131 end


  S. Find in function send_msg(..)

            $new_id = $DB->get_insert_id();

     Insert below the blue code

            $new_id = $DB->get_insert_id();



//-- mod_sec_update_131 begin
            $DB->query("UPDATE ibf_messages SET next='$new_id' WHERE msg_id='".$ref['your_ref']."'");
//-- mod_sec_update_131 end


  T. Find in function send_msg(..)

         if ($ibforums->input['add_sent'])
         {

     Insert above the blue code



//-- mod_sec_update_131 begin
        if (FALSE)
//-- mod_sec_update_131 end


         if ($ibforums->input['add_sent'])
         {

  U. Find in function msg_list(..)

         $start = intval($ibforums->input['st']) > 0 ? intval($ibforums->input['st']) : 0;

     Insert below the blue code

         $start = intval($ibforums->input['st']) > 0 ? intval($ibforums->input['st']) : 0;



//-- mod_sec_update_131 begin
        $start = max(0, $start);
//-- mod_sec_update_131 end


  V. Find in function msg_list(..)

         $this->output .= $this->html->inbox_table_header( $this->msg_stats['current_dir'], $info, $this->jump_html, $pages );

     Insert below the blue code

         $this->output .= $this->html->inbox_table_header( $this->msg_stats['current_dir'], $info, $this->jump_html, $pages );



//-- mod_sec_update_131 begin
        $show_preview = $ibforums->vars['msg_preview'] && strpos($ibforums->skin['css_text'], "domTT") !== FALSE;
//-- mod_sec_update_131 end


  W. Find in function msg_list(..)

                 if ($this->vid == 'sent')

     Insert above the blue code



//-- mod_sec_update_131 begin
                if ($row['sent']) {
                    if ($row['last'])
                        $row['icon'] = "<a href='".$ibforums->base_url."act=Msg&VID=in&CODE=03&MSID=".$row['last']."' target='_blank' title='".$ibforums->lang['show_ref']."'><{B_NORM_DOT}></a>";
                    else    
                        $row['icon'] = "<{B_NORM}>";
                }
                else {
                    if ($row['msg_date'] > $ibforums->member['last_visit'])
                        $row['icon'] = $row['read_state'] == 1 ? "<{B_HOT_NN}>" : "<{B_HOT}>";
                    else
                        $row['icon'] = $row['read_state'] == 1 ? "<{B_NORM}>" : "<{B_NEW}>";
                    if ($row['next'])
                        $row['icon'] = "<a href='".$ibforums->base_url."act=Msg&VID=sent&CODE=03&MSID=".$row['next']."' target='_blank' title='".$ibforums->lang['show_reply']."'>".str_replace("}>", "_DOT}>", $row['icon'])."</a>";
                }
                if (FALSE)
//-- mod_sec_update_131 end


                 if ($this->vid == 'sent')

  X. Find in function msg_list(..)

                 $this->output .= $this->html->inbox_row( $d_array );

     Insert above the blue code



//-- mod_sec_update_131 begin
                if ($show_preview) {
                    $link = "{$ibforums->base_url}act=Msg&amp;CODE=03&amp;tooltip=1&amp;VID={$d_array['stat']['current_id']}&amp;MSID={$d_array['msg']['msg_id']}";
                    $tooltip  = "onMouseOver=\"domTT_oneOnly = true; this.style.color = '#000000';";
                    $tooltip .= "return makeFalse(domTT_activate(this, event,
                                                        'caption', '',
                                                        'width', '410px',
                                                        'fade', 'both',
                                                        'fadeMax', 100,
                                                        'trail', false,
                                                        'offsetX', 20,
                                                        'offsetY', 5,
                                                        'lazy', true,
                                                        'delay', 500,
                                                        'content', '&lt;iframe src=&quot;$link&quot; class=&quot;tableborder&quot; style=&quot;width: 400px; height: 200px;&quot;&gt;&lt;/iframe&gt;',
                                                        'styleClass', 'domTTlegend',
                                                        'type', 'velcro'
                                                        ));\"";
                     $this->output .= preg_replace("`(CODE=03.*VID.*?)>`s", "\\1 $tooltip >", $this->html->inbox_row($d_array));
                 }
                 else
//-- mod_sec_update_131 end


                 $this->output .= $this->html->inbox_row( $d_array );

  Y. Find in function show_tracking(..)

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

     Insert below the blue code

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



//-- mod_sec_update_131 begin
        $ibforums->lang['tk_untrack_button']  = $ibforums->lang['read_track_untrack_button'];
        $ibforums->lang['selected_msg']  = $ibforums->lang['read_track_selected_msg'];
        $ibforums->lang['delete_button']  = $ibforums->lang['read_track_untrack_button'];
        if (TRUE)
             $DB->query("SELECT m.*, mp.name as to_name, mp.id as memid
                           FROM ibf_messages m, ibf_members mp
                         WHERE m.tracking=1
                            AND m.read_state=1 AND read_date<>0
                            AND m.from_id=".$this->member['id']."
                            AND m.member_id=mp.id
                         ORDER BY msg_date DESC");
        else
//-- mod_sec_update_131 end


  Z. Find in function show_tracking(..)

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

     Insert below the blue code

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



//-- mod_sec_update_131 begin
        if (TRUE)
            $DB->query("SELECT m.*, mp.name as to_name, mp.id as memid
                        FROM ibf_messages m, ibf_members mp
                        WHERE m.tracking=1 AND (m.read_state=0 OR (m.read_state=1 AND m.read_date=0))
                        AND m.from_id='".$this->member['id']."' AND m.member_id=mp.id
                        ORDER BY msg_date DESC");
        else
//-- mod_sec_update_131 end


  AA. Find in function parse_member(..)

        {            $member['msn_icon']

     Insert above the blue code



//-- mod_sec_update_131 begin
            $member['msn_icon'] = "<a href=\"javascript:PopUp('{$this->base_url}act=MSN&amp;control=1&amp;MID={$member['id']}','MSNCONTROL','455','300',0,1,1,5,50);PopUp('{$this->base_url}act=MSN&amp;MID={$member['id']}','Pager',450,370,1,0,0,50,50);\"><{P_MSN}></a>";
            $name = $member['msnname'];
            $names = explode("(", $name);
            if (count($names) > 1) {
                $names[1] = trim(str_replace(")", "", $names[1]));
                $lid = $names[1]."@apps.messenger.live.com";
                $member['msn_icon'] .= "<img style='position:relative;left:-8px' src='http://messenger.services.live.com/users/{$lid}/presenceimage' />";
            }
            if (FALSE)
//-- mod_sec_update_131 end


        {            $member['msn_icon']


Step  9:  Open sources/Moderate.php

  A. Find in function do_move(..)

    function do_move() {
        global $std, $ibforums, $DB, $print;

     Insert below the blue code

    function do_move() {
        global $std, $ibforums, $DB, $print;



//-- mod_sec_update_131 begin
        $ibforums->input['sf'] = intval($ibforums->input['sf']);
        $ibforums->input['move_id'] = intval($ibforums->input['move_id']);
        $ibforums->input['tid'] = intval($ibforums->input['tid']);
//-- mod_sec_update_131 end


  B. Find in function delete_post(..)

        // Get this post id.

     Insert below the blue code

        // Get this post id.



//-- mod_sec_update_131 begin
        $ibforums->input['p'] = intval($ibforums->input['p']);
//-- mod_sec_update_131 end



Step 10:  Open sources/mod_cp.php

  A. Find in function Moderate(..)

        $this->html      = $std->load_template('skin_modcp');

     Insert below the blue code

        $this->html      = $std->load_template('skin_modcp');



//-- mod_sec_update_131 begin
        $this->html      = $std->load_template('mod_sec_update_skin_modcp');
        $ibforums->lang = $std->load_words($ibforums->lang, 'mod_sec_lang', $ibforums->lang_id);
        $ibforums->lang = $std->load_words($ibforums->lang, 'mod_sec_lang_modcp', $ibforums->lang_id);
        $ibforums->vars['pre_pinned'] = $ibforums->lang['pre_pinned'];
        $ibforums->vars['pre_moved'] = $ibforums->lang['pre_moved'];
        $ibforums->vars['pre_polls'] = $ibforums->lang['pre_polls'];
        require ROOT_PATH."sources/mods/sec_update_131_A/mod_sec_update_modcp_func.php";
        $this->modcp = new mod_sec_update_modcp();
//-- mod_sec_update_131 end


  B. Find in function Moderate(..)

        $this->start_val = intval($ibforums->input['st']);

     Insert below the blue code

        $this->start_val = intval($ibforums->input['st']);



//-- mod_sec_update_131 begin
        $this->start_val = max(0,$this->start_val);
//-- mod_sec_update_131 end


  C. Find in function Moderate(..)

        $this->output = $this->html->mod_cp_start();

     Insert above the blue code



//-- mod_sec_update_131 begin
        $this->modcp->menu($this);
        if (false)
//-- mod_sec_update_131 end


        $this->output = $this->html->mod_cp_start();

  D. Find in function Moderate(..)

                $this->do_ip();
                break;

            default:

     Insert below the blue code

                $this->do_ip();
                break;

            default:



//-- mod_sec_update_131 begin
                $this->modcp->dispatch($this);
                if (FALSE)
//-- mod_sec_update_131 end


  E. Find in function Moderate(..)

        $print->add_output("$this->output");
        $print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 1, 'NAV' => $this->nav ) );

     Insert above the blue code



//-- mod_sec_update_131 begin
        $this->output .= $this->html->mod_cp_end();
//-- mod_sec_update_131 end


        $print->add_output("$this->output");
        $print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 1, 'NAV' => $this->nav ) );

  F. Find in function topic_mmod(..)

        $DB->query("UPDATE ibf_topics SET title=CONCAT

     Insert above the blue code



//-- mod_sec_update_131 begin
        if (TRUE) {
            $title = "'title'";
            if ($pre)
                $title = "'$pre', ".$title;
            if ($end)
                $title .= ", '$end'";
            if ($title != "'title'")
                $DB->query("UPDATE ibf_topics SET title=CONCAT($title) WHERE tid IN(".implode( ",", $this->tids ).")");
        }
        else
//-- mod_sec_update_131 end


        $DB->query("UPDATE ibf_topics SET title=CONCAT

  G. Find in function show_forums(..)

                $this->cats[ $c_q['cat_id'] ] = array( 'id'          => $r['cat_id'],

     Insert above the blue code



//-- mod_sec_update_131 begin
                $this->cats[ $c_q['cat_id'] ] = array( 'id'          => $c_q['cat_id'],
                                                       'position'    => $c_q['cat_position'],
                                                       'state'       => $c_q['cat_state'],
                                                       'name'        => $c_q['cat_name'],
                                                     );
                if (FALSE)
//-- mod_sec_update_131 end


                $this->cats[ $c_q['cat_id'] ] = array( 'id'          => $r['cat_id'],

  H. Find in function do_forum(..)

        if ($forum['password'] != "")

     Insert above the blue code



//-- mod_sec_update_131 begin
        if ($ibforums->member['mgroup'] == $ibforums->vars['admin_group'] || $ibforums->member['g_is_supmod'] || ($ibforums->member['is_mod'] && $ibforums->member['mod_forums'][$forum['id']]))
            $forum['password'] = "";
//-- mod_sec_update_131 end


        if ($forum['password'] != "")

  I. Find in function approve_all(..), mod_domodposts(..), domod_topics(..)

                    if ( $groups[ $member['mgroup'] ]['g_promotion'] != '-1&-1' )

     Insert above the blue code



//-- mod_sec_update_131 begin
                    $mgroup = "";
//-- mod_sec_update_131 end


                    if ( $groups[ $member['mgroup'] ]['g_promotion'] != '-1&-1' )

  J. Find in function mod_topicview(..)

            $this->output .= $this->html->mod_postentry_checkbox($r['pid']);

     Insert above the blue code



//-- mod_sec_update_131 begin
            $edit = "<a href='".$ibforums->base_url."&act=Post&CODE=08&redirect_opener=1&opener_reload=1&f=".$this->forum['id']."&t=".$r['topic_id']."&p=".$r['pid']."' target='_blank'>{$ibforums->lang['EDIT_TOPIC']}</a>";
            $r['post_date'] .= "&nbsp;[$edit]";
//-- mod_sec_update_131 end


            $this->output .= $this->html->mod_postentry_checkbox($r['pid']);

  K. Find in function mod_topics(..)

        $start   = $ibforums->input['st'] ? $ibforums->input['st'] : 0;

     Insert below the blue code

        $start   = $ibforums->input['st'] ? $ibforums->input['st'] : 0;



//-- mod_sec_update_131 begin
        $start = max(0, $start);
//-- mod_sec_update_131 end


  L. Find in function mod_topics(..)

            $this->output .= $this->html->mod_topic_title($r['title'], $r['tid']);

     Insert above the blue code



//-- mod_sec_update_131 begin
            if (TRUE) {
                $edit = "<a href='".$ibforums->base_url."&act=Post&CODE=08&redirect_opener=1&opener_reload=1&f=".$this->forum['id']."&t=".$r['tid']."&p=".$r['pid']."' target='_blank'>{$ibforums->lang['EDIT_TOPIC']}</a>";
                $this->output .= $this->html->mod_topic_title($r['title']."&nbsp;[$edit]", $r['tid']);
            }
            else
//-- mod_sec_update_131 end


            $this->output .= $this->html->mod_topic_title($r['title'], $r['tid']);

  M. Find in function prune_juice(..)

    function prune_juice()
    {
        global $std, $ibforums, $DB, $print;

     Insert below the blue code

    function prune_juice()
    {
        global $std, $ibforums, $DB, $print;



//-- mod_sec_update_131 begin
        $button = "<input type='hidden' name='f' value='".intval($ibforums->input['f'])."'>";
        if (!isset($ibforums->input['f'])) {
            $button = "";
            $forums = $std->build_forum_jump(0,0,1);
            $confirm = $this->html->prune_source($forums);
        }
        else
//-- mod_sec_update_131 end


  N. Find in function find_user_two(..)

        $DB->query("SELECT id, name FROM ibf_members WHERE name LIKE '".$ibforums->input['name']."%' LIMIT 0,100");

     Insert above the blue code



//-- mod_sec_update_131 begin
         $ibforums->input['name'] = str_replace( '|', '&#124;',trim($ibforums->input['name']));
//-- mod_sec_update_131 end


        $DB->query("SELECT id, name FROM ibf_members WHERE name LIKE '".$ibforums->input['name']."%' LIMIT 0,100");

  O. Find in function edit_user(..), complete_user_edit(..)

        $DB->query("SELECT m.*, g.* FROM ibf_members m, ibf_groups g WHERE m.id='".$ibforums->input['memberid']."' AND m.mgroup=g.g_id");

     Insert above the blue code



//-- mod_sec_update_131 begin
        $DB->query("SELECT m.*, me.photo_type, me.photo_location, me.photo_dimensions, g.* FROM ibf_groups g, ibf_members m  LEFT JOIN ibf_member_extra me ON (m.id=me.id) WHERE m.id='".$ibforums->input['memberid']."' AND m.mgroup=g.g_id");
        if (FALSE)
//-- mod_sec_update_131 end


        $DB->query("SELECT m.*, g.* FROM ibf_members m, ibf_groups g WHERE m.id='".$ibforums->input['memberid']."' AND m.mgroup=g.g_id");

  P. Find in function edit_user(..)

        $this->output .= $this->html->edit_user_form($editable);

     Insert above the blue code



//-- mod_sec_update_131 begin
        $editable['location']  = $parser->unconvert( $member['location']  );
        $editable['interests'] = $parser->unconvert( $member['interests'] );
        if (!empty($member['website']) && strtolower($member['website']) != "http://") {
            $url_array = parse_url($member['website']);
            if (!$url_array['scheme']) $url_array['scheme'] = "http";
            $url .= $url_array['scheme']."://";
            $url .= $url_array['host'];
            $url .= $url_array['port'];
            $url .= $url_array['path'];
            $url .= $url_array['query'];
            $url .= $url_array['fragment'];
            $member['website'] = "<a href='$url' target='ModCPWebsite'>".$member['website']."</a>";
        }
        $member['avatar'] = $std->get_avatar( $member['avatar'], 1, $member['avatar_size'] );
        if ($member['photo_type'] == 'upload' )
             $member['photo'] = "<img src=\"".$ibforums->vars['upload_url']."/".$member['photo_location']."\" $width $height alt='Photo' />";
         else if ($member['photo_type'] == 'url')
             $member['photo'] = "<img src=\"".$member['photo_location']."\" $width $height alt='Photo' />";
        $required_output = "";
        $optional_output = "";
        $field_data     = array();
        $DB->query("SELECT * from ibf_pfields_content WHERE member_id='".$member['id']."'");
        while ($content = $DB->fetch_row())
            foreach($content as $k => $v)
                if ( preg_match( "/^field_(\d+)$/", $k, $match) ) 
                    $field_data[ $match[1] ] = $v;
        if (count($field_data)) {
            $DB->query("SELECT * from ibf_pfields_data WHERE fedit=1 ORDER BY forder");
            while( $row = $DB->fetch_row() ) {
                $form_element = "";
                if ( $row['freq'] == 1 )
                    $ftype = 'required_output';
                else
                    $ftype = 'optional_output';
                $preview = $field_data[$row['fid']];
                if ($row['ftype'] != "drop")
                    $field_data[$row['fid']] = $parser->unconvert( $field_data[$row['fid']], $ibforums->vars['profile_allow_ibc'], 0 );
                if ($row['ftype'] == "drop") {
                    $carray = explode( '|', trim($row['fcontent']) );
                    $d_content = "";
                    foreach( $carray as $entry ) {
                        $value = explode( '=', $entry );
                        $ov = trim($value[0]);
                        $td = trim($value[1]);
                        if ($ov !="" and $td !="")
                            $d_content .= ($field_data[$row['fid']] == $ov) ? "<option value='$ov' selected='selected' >$td</option>\n"
                                                                            : "<option value='$ov'>$td</option>\n";
                    }
                    if ($d_content != "")
                        $form_element = $this->html->profile_field_dropdown( 'field_'.$row['fid'], $d_content );
                }
                else if ( $row['ftype'] == 'area' )
                    $form_element = $this->html->profile_field_textarea( 'field_'.$row['fid'], $field_data[$row['fid']] );
                else
                    $form_element = $this->html->profile_field_textinput( 'field_'.$row['fid'], $field_data[$row['fid']] );
                ${$ftype} .= $this->html->profile_field_entry( $row['ftitle'], $row['fdesc'], $form_element, $preview);
            }
        }
        $ip_access_groups = array($ibforums->vars['admin_group']);
        $ip_access_members = array($ibforums->member['id']);
        if (in_array($ibforums->member['mgroup'],$ip_access_groups) || in_array($ibforums->member['id'],$ip_access_members)) {
            if (isset($ibforums->input['show_ips'])) {
                $DB->query("SELECT DISTINCT ip_address FROM ibf_posts WHERE author_id =  '".$ibforums->input['memberid']."' ORDER BY ip_address");
                $num = $DB->get_num_rows();
                $data['ips']  = $ibforums->lang['ip_reg'].$member['ip_address'];
                if ($num) {
                    $data['ips'] .= "\n\n{$ibforums->lang['ips_used']}:\n";
                    while ($r = $DB->fetch_row())
                        $data['ips'] .= str_pad($r['ip_address'],20);
                }
                else {
                    $data['ips'] .= "\n\n".$ibforums->lang['ips_used_noresult'];
                }
                $data['rows'] = min(15,3+round($num/4));
                $editable['ips'] = $this->html->profile_form_ips($data);
            }
        }
        $this->output .= $this->html->profile_form($editable, $member);
        if ($required_output != "")
                $this->output = str_replace( "<!--{REQUIRED.FIELDS}-->", $this->html->profile_required_title()."\n".$required_output, $this->output );
        if ($optional_output != "")
            $this->output = str_replace( "<!--{OPTIONAL.FIELDS}-->", "\n".$this->html->profile_optional_title()."\n".$optional_output, $this->output );
        if (FALSE)
//-- mod_sec_update_131 end


        $this->output .= $this->html->edit_user_form($editable);

  Q. Find in function complete_user_edit(..)

    function complete_user_edit()
    {
        global $std, $ibforums, $DB, $print;

     Insert below the blue code

    function complete_user_edit()
    {
        global $std, $ibforums, $DB, $print;



//-- mod_sec_update_131 begin
        if (isset($ibforums->input['show_ips'])) {
            $this->edit_user();
            return;
        }
//-- mod_sec_update_131 end


  R. Find in function complete_user_edit(..)

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

     Insert above the blue code



//-- mod_sec_update_131 begin
        global $HTTP_POST_VARS;
        $custom_fields = array();
        $in = array('SMILIES'   => 0,
                    'CODE'      => 1,
                    'HTML'      => 0,
                    'SIGNATURE' => 0
                    );
        $DB->query("SELECT * from ibf_pfields_data WHERE fedit=1");
        while ($row = $DB->fetch_row()) {
            if ($row['freq'] == 1)
                if ($HTTP_POST_VARS[ 'field_'.$row['fid'] ] == "")
                    $std->Error( array( 'LEVEL' => 1, 'MSG' => 'complete_form' ) );
            if ($row['fmaxinput'] > 0)
                if (strlen($HTTP_POST_VARS[ 'field_'.$row['fid'] ]) > $row['fmaxinput'])
                    $std->Error( array( 'LEVEL' => 1, 'MSG' => 'cf_to_long', 'EXTRA' => $row['ftitle'] ) );
            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'] ] = $parser->convert($in);
                $DB->query_id = $query_id;
            }
            else
                $custom_fields[ 'field_'.$row['fid'] ] = str_replace( '<br>', "\n", $ibforums->input[ 'field_'.$row['fid'] ] );
        }
        if (count($custom_fields) > 0){
            $DB->query("SELECT member_id FROM ibf_pfields_content WHERE member_id='".$member['id']."'");
            $test = $DB->fetch_row();
            if ($test['member_id']) {
                $db_string = $DB->compile_db_update_string($custom_fields);
                $DB->query("UPDATE ibf_pfields_content SET $db_string WHERE member_id='".$member['id']."'");
            }
            else {
                $custom_fields['member_id'] = $member['id'];
                $db_string = $DB->compile_db_insert_string($custom_fields);
                $DB->query("INSERT INTO ibf_pfields_content (".$db_string['FIELD_NAMES'].") VALUES(".$db_string['FIELD_VALUES'].")");
            }
        }
        if ($ibforums->vars['profile_allow_ibc']) {
            $in['TEXT'] = $ibforums->input['location'];
            $ibforums->input['location'] = $parser->convert($in);
            $in['TEXT'] = $ibforums->input['interests'];
            $ibforums->input['interests'] = $parser->convert($in);
        }
//-- mod_sec_update_131 end


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


Step 11:  Open sources/Online.php

  A. Find in function Online(..)

        if ( $ibforums->vars['allow_online_list'] != 1 )

     Insert above the blue code



//-- mod_sec_update_131 begin
        if($ibforums->input['code'] == "get_ip2loc" && $ibforums->input['ip'] != "") {
            require_once ROOT_PATH."sources/mods/sec_update_131_A/mod_sec_update_func.php";
            $lib = new mod_sec_update_lib;
            $lib->get_ip2loc($ibforums->input['ip']);
            die;
        }
        if ($ibforums->vars['allow_online_list'] != 1 || !$ibforums->member['g_can_view_online'])
            $std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_permission') );
        else
//-- mod_sec_update_131 end


        if ( $ibforums->vars['allow_online_list'] != 1 )

  B. Find in function list_all(..)

            $this->first = $ibforums->input['st'];

     Insert below the blue code

            $this->first = $ibforums->input['st'];



//-- mod_sec_update_131 begin
            $this->first = max(0, $this->first);
//-- mod_sec_update_131 end


  C. Find in function list_all(..)

            if ($last_cat_id != $i['cat_id'])

     Insert above the blue code



//-- mod_sec_update_131 begin
            if ($ibforums->member['mgroup'] == $ibforums->vars['admin_group'] || $ibforums->member['g_is_supmod'] || ($ibforums->member['is_mod'] && $ibforums->member['mod_forums'][$i['id']]))
                $i['password'] = "";
//-- mod_sec_update_131 end


            if ($last_cat_id != $i['cat_id'])

  D. Find in function list_all(..)

        $DB->query("SELECT s.id, s.in_forum, s.in_topic, s.member_name, s.member_id, s.ip_address, s.running_time, s.location,

     Insert above the blue code



//-- mod_sec_update_131 begin
        if ( ($ibforums->member['mgroup'] == $ibforums->vars['admin_group']) and ($ibforums->vars['disable_online_ip'] != 1) ) {
            $this->html2 = $std->load_template('mod_sec_update_skin_online');
            $domTT = strpos($ibforums->skin['css_text'], "domTT") !== FALSE;
            $ibforums->lang = $std->load_words($ibforums->lang, 'mod_sec_lang_online', $ibforums->lang_id);
            $loc2ip = "<a href=\"#void\" onMouseOver=\"return makeFalse(domTT_activate(this, event, 'id', 'local', 'content', '&lt;iframe src=&quot;index.php?act=Online&code=get_ip2loc&ip=<%IP%>&quot; style=&quot;{$this->html2->get_ip2loc_iframe_style()}&quot;&gt;&lt;/iframe&gt;', 'caption', '{$ibforums->lang['ip2loc_title']}', 'fade', 'both', 'fadeMax', 100, 'type', 'greasy', 'closeAction', 'hide', 'styleClass', 'domTTlegend', 'trail', 'x'));\"><%IP%></a>";
        }
//-- mod_sec_update_131 end


        $DB->query("SELECT s.id, s.in_forum, s.in_topic, s.member_name, s.member_id, s.ip_address, s.running_time, s.location,

  E. Find in function list_all(..)

                if ($fid != "" and ($act == 'SF' or $act == 'ST' or $act == 'Post'))

     Insert above the blue code



//-- mod_sec_update_131 begin
                if ($fid != "" && ($act == 'SF' || $act == 'ST' || $act == 'Post' || $act == 'Print'))
//-- mod_sec_update_131 end

/*-- mod_sec_update_131 exclude begin


                if ($fid != "" and ($act == 'SF' or $act == 'ST' or $act == 'Post'))

  F. Find in function list_all(..)

                if ($fid != "" and ($act == 'SF' or $act == 'ST' or $act == 'Post'))

     Insert below the blue code

                if ($fid != "" and ($act == 'SF' or $act == 'ST' or $act == 'Post'))



-- mod_sec_update_131 exclude end */


  G. Find in function list_all(..)

                $sess['ip_address'] = " ( ".$sess['ip_address']." )";

     Insert above the blue code



//-- mod_sec_update_131 begin
                if ($domTT) {
                    $sess['ip_address'] = str_replace("<%IP%>", $sess['ip_address'], $loc2ip);
                }
//-- mod_sec_update_131 end


                $sess['ip_address'] = " ( ".$sess['ip_address']." )";


Step 12:  Open sources/Post.php

  A. Find in function Post(..)

        $this->forum = $DB->fetch_row();

     Insert below the blue code

        $this->forum = $DB->fetch_row();



//-- mod_sec_update_131 begin
        if ($ibforums->member['mgroup'] == $ibforums->vars['admin_group'] || $ibforums->member['g_is_supmod'] || ($ibforums->member['is_mod'] && $ibforums->member['mod_forums'][$this->forum['id']]))
            $this->forum['password'] = "";
//-- mod_sec_update_131 end


  B. Find in function notify_new_topic_approval(..)

'SHORT'

     Insert below the blue code

'SHORT'



//-- mod_sec_update_131 begin
        , TRUE
//-- mod_sec_update_131 end


  C. Find in function topic_tracker(..), forum_tracker(..)

                $r['language'] = $r['language'] ? $r['language'] : 'en';

     Insert above the blue code



//-- mod_sec_update_131 begin
                $r['language'] = $r['language'] ? $r['language'] : ($ibforums->vars['default_language'] ? $ibforums->vars['default_language'] : 'en');
                if (FALSE)
//-- mod_sec_update_131 end


                $r['language'] = $r['language'] ? $r['language'] : 'en';

  D. Find in function compile_post(..)

        // If we had any errors, parse them back to this class

     Insert above the blue code



//-- mod_sec_update_131 begin
        if ($ibforums->input['pid'])
            $post['ref'] = $ibforums->input['pid'];
//-- mod_sec_update_131 end


        // If we had any errors, parse them back to this class

  E. Find in function process_upload(..)

        if (preg_match( "/\.(cgi|pl|js|asp|php|html|htm|jsp|jar)/", $FILE_NAME ))

     Insert above the blue code



//-- mod_sec_update_131 begin
        if (TRUE) {
            if (preg_match( "/\.(cgi|pl|js|asp|php|html|htm|jsp|jar)$/", $FILE_NAME ))
                $FILE_TYPE = 'text/plain';
        }
        else
//-- mod_sec_update_131 end


        if (preg_match( "/\.(cgi|pl|js|asp|php|html|htm|jsp|jar)/", $FILE_NAME ))

  F. Find in function process_upload(..)

        $real_file_name .= $ext;

     Insert below the blue code

        $real_file_name .= $ext;



//-- mod_sec_update_131 begin
        //-------------------------------------------------
        // Is this a malicious image?
        //-------------------------------------------------
        
        $allowed_ext = explode("|", $ibforums->vars['img_ext']);
        
        if ( is_array($allowed_ext) and count($allowed_ext)) {
            $ext = substr($ext,1);
            if (in_array($ext,$allowed_ext)) {
                $file = $HTTP_POST_FILES['FILE_UPLOAD']['tmp_name'];
                $size = @getimagesize($file);
                if (!is_array($size)) $size = @getimagesize($file, $info);
                if (!is_array($size) || !$size[0] || !$size[1] || !$size[2]) {
                    $this->obj['post_errors'] = 'invalid_mime_type';
                    return $attach_data;
                }
                if (function_exists("imagecreatefromgif")) {
                    switch($ext) {
                        case 'gif' :   $im = @imagecreatefromgif($file);
                                        break;
                        case 'jpg':    $im = @imagecreatefromjpeg($file);
                                        break;
                        case 'png':    $im = @imagecreatefrompng($file);
                                        break;
                    }
                    if ($im) {
                        imagedestroy($im);
                    }
                    elseif ($ext == "gif" || $ext == "jpg" || $ext == "png") {
                        $this->obj['post_errors'] = 'invalid_mime_type';
                        return $attach_data;
                    }
                }
            }
        }
//-- mod_sec_update_131 end


  G. Find

                "<input type='hidden' name='auth_key' value='".$this->md5_check."' />\n".

     Insert above the blue code



//-- mod_sec_update_131 begin
                "<input type='hidden' name='pid' value='".$ibforums->input['pid']."' />\n".
//-- mod_sec_update_131 end


                "<input type='hidden' name='auth_key' value='".$this->md5_check."' />\n".

  H. Find in function html_post_icons(..)

            $post_icon = $ibforums->input['iconid'];

     Insert below the blue code

            $post_icon = $ibforums->input['iconid'];



//-- mod_sec_update_131 begin
            $post_icon = intval($post_icon);
        }
    if (isset($ibforums->vars['post_icons']) && !$ibforums->vars['post_icons']) {
        return;
//-- mod_sec_update_131 end


  I. Find

}

?>

     Insert above the blue code



//-- mod_sec_update_131 begin
    function get_post_link($pid = "", $tid = "") {
        global $ibforums;
        if ($pid == "") return;
        return "&nbsp;<a href='{$ibforums->base_url}&showtopic=$tid&view=findpost&p=$pid&pid=$pid' target='_blank' title='{$ibforums->lang['quoted_post_link']}'><img src='{$ibforums->vars['img_url']}/item.gif' /></a>";
    }
//-- mod_sec_update_131 end


}

?>


Step 13:  Open sources/Profile.php

  A. Find

    var $jump_html  = "";

     Insert below the blue code

    var $jump_html  = "";



/*-- mod_sec_update_131 exclude begin


  B. Find

    var $links      = array();

     Insert above the blue code



-- mod_sec_update_131 exclude end */


    var $links      = array();

  C. Find in function show_card(..), view_profile(..)

        $info['msn_name']    = $member['msnname']

     Insert above the blue code



//-- mod_sec_update_131 begin
        if ($member['msnname']) {
            $n = explode("(", $member['msnname']);
            $member['msnname'] = trim($n[0]);
        }
//-- mod_sec_update_131 end


        $info['msn_name']    = $member['msnname']

  D. Find in function show_card(..)

            $html  = $this->html->show_card_download( $member['name'], $photo, $info );

     Insert below the blue code

            $html  = $this->html->show_card_download( $member['name'], $photo, $info );



//-- mod_sec_update_131 begin
            $match = "`(^.*)<tr.*?".$ibforums->lang['integ_msg'].".*?</tr>`is";
            $html  = preg_replace($match, "\\1", $html);
//-- mod_sec_update_131 end


  E. Find in function show_card(..)

            $html  = $this->html->show_card( $member['name'], $photo, $info );

     Insert below the blue code

            $html  = $this->html->show_card( $member['name'], $photo, $info );



//-- mod_sec_update_131 begin
            $match = "`(^.*)<tr.*?".$ibforums->lang['integ_msg'].".*?</tr>`is";
            $html  = preg_replace($match, "\\1", $html);
//-- mod_sec_update_131 end


  F. Find in function view_profile(..)

        if ($member['dst_in_use'] == 1)

     Insert above the blue code



//-- mod_sec_update_131 begin
        if (FALSE)
//-- mod_sec_update_131 end


        if ($member['dst_in_use'] == 1)

  G. Find in function view_profile(..)

        $info['local_time']  = $member['time_offset'] != "" ? gmdate( $ibforums->vars['clock_long'], time() + ($member['time_offset']*3600) + ($ibforums->vars['time_adjust'] * 60) ) : $ibforums->lang['no_info'];

     Insert below the blue code

        $info['local_time']  = $member['time_offset'] != "" ? gmdate( $ibforums->vars['clock_long'], time() + ($member['time_offset']*3600) + ($ibforums->vars['time_adjust'] * 60) ) : $ibforums->lang['no_info'];



//-- mod_sec_update_131 begin
        $info['local_time']  = $member['time_offset'] != "" ? $std->get_member_date( $member, time(), "LONG" ) : $ibforums->lang['no_info'];
//-- mod_sec_update_131 end


  H. Find in function view_profile(..)

        $this->output .= $this->html->show_profile( $info );

     Insert above the blue code



//-- mod_sec_update_131 begin
        if (TRUE) {
            $match = "`(^.*)<tr.*?".$ibforums->lang['integ_msg'].".*?</tr>`is";
            $this->output .= preg_replace($match, "\\1", $this->html->show_profile( $info ));
        }
        else
//-- mod_sec_update_131 end


        $this->output .= $this->html->show_profile( $info );

  I. Find in function view_profile(..)

            $custom_out .= $this->html->custom_field($row['ftitle'], $field_data[ $row['fid'] ] );

     Insert below the blue code

            $custom_out .= $this->html->custom_field($row['ftitle'], $field_data[ $row['fid'] ] );



//-- mod_sec_update_131 begin
            $custom_out_array[$row['fid']] = $this->html->custom_field($row['ftitle'], $field_data[ $row['fid'] ] );
//-- mod_sec_update_131 end


  J. Find in function view_profile(..)

            $this->output = str_replace( "<!--{CUSTOM.FIELDS}-->", $custom_out, $this->output );

     Insert below the blue code

            $this->output = str_replace( "<!--{CUSTOM.FIELDS}-->", $custom_out, $this->output );



//-- mod_sec_update_131 begin
            foreach ($custom_out_array as $k => $v)
                $this->output = str_replace( "<!--{CUSTOM.FIELD_{$k}}-->", $v, $this->output );
//-- mod_sec_update_131 end


 5.  Customize

Manual Installation


Do not install this mod manually. Use The ModInstaller, it is so easy.

Please ? You really want to install it manually against my recommendation ?

Ok, copy ./sources/mods/sec_update_131/mod_sec_update_131_install.php into the root dir of your ipb. That is that directory where index.php and admin.php reside.

Then run the install script within your browser. It will create the missing tables and fields in your database.

Now add all modification from above to your php files. Plesae modify every occurrency of the given search text. Sometimes that part appears more than one time.



Attention
If you have Mod BBCode installed then you must reinstall it with version > 2.2.11. This is because a feature of Mod BBCode was moved to the Mod Security&Updates > 2.6.1.


Time and calendar bugs
In ACP the logic of Date and Time Formats has changed. You can set the time zone for guests and new users and you can finetune the time calculations if the server time is not set correctly. Normally the server time settings are out of your scope.

In calendar module there are a lot of bugs which are not fixed by this update. I recommend strongly to apply my mod Enhanced Calendar.

Language dependant skins
If you want language dependant buttons like New Topic then create a new subdirectory in the style_images directory of the skin.

Example:
The English language resides in lang/en and the German language resides in lang/2. The image directory of your skin is style_images/ipb-001

Now create style_images/ipb-001/en and style_images/ipb-001/2. Copy the content of the original directory style_images/ipb-001 to the new sub directories.

Finally copy the language dependant buttons like t_new.gif for "New Topic" in their assigned subdirectories. That means: t_new.gif for the English "New Topic" to style_images/ipb-001/en and t_new.gif for the German "Neues Thema" to style_images/ipb-001/2.

Skin dependant emoticons, avatars, team icons and mime type icons
This is similar to the last item. Create new subdirectories in the style_images folder of the skin. Name them

and copy the appropriate images into these folders. If a subdirectory does not exist then the default images will be used.

Load Lang Bug
This is not really a bug but a code design bug. In the original version every call to a missing language file results in a blank page. Now you will get an error message.

Mime types icons
For each file extension of allowed uploads create a new icon in html/mime_types like tar.gif, pdf.gif swf.gif etc.

In topic view the attachments will be displayed with the new icons.

Online/Offline
If the member group is allowed to view online/offline state of other members, the state can be displayed in topic view and in message view.

There are 2 new skin files of the mod

The new classes inside these files replace some functions of the original skin files. By example you will find functions RenderRow and Render_msg. I have added new lines:
CODE

{$author['state_on_off']}<br /><br />

and
CODE

<br />{$data['member']['state_on_off']}

If you have a customized skin then you should copy the original function RenderRow (Render_msg) to the mod skin files and insert the lines above.

Then you will find 2 sets with 3 functions

The first set is for macro based displaying the state and the second (outcommented) for text based displaying. You can customize these functions as you like it. Define new macros in ACP for STATE_ONLINE, STATE_ONLINE_ANON and STATE_OFFLINE.

By the way: You will find other functions in the mod skin files replacing functions in original skin files.

Tooltips, message and topic preview - the domTT library
Some new features are based on the domTT library. Here is an installation guide:

Be sure to have copied the domTT library (domTTxxx.js and fadomaticm.js) into the html folder.

Next insert the following code into the boardwrapper in the HEAD section
CODE


   <script language="javascript" type="text/javascript" src="html/domLibm.js"></script>
   <script language="javascript" type="text/javascript" src="html/domTTm.js"></script>

   <script language="javascript" type="text/javascript" src="html/domTT_drag.js"></script>
   <script language="javascript" type="text/javascript" src="html/fadomaticm.js"></script>
   <script language="javaScript" type="text/javascript">
   var domTT_classPrefix = 'domTTOverlib';
   var domTT = 0;
   var domTTs = 0;
   </script>


And last add these css styles to your Style Sheets in ACP
CODE


div.domTT { border: 1px solid #333333; background-color: #333333 }
div.domTT .caption { font-family: serif; font-size: 12px; font-weight: bold; padding: 1px 2px; color: #FFFFFF }
div.domTT a:link { text-decoration: none; color: #FFFFFF }
div.domTT a:visited { text-decoration: none; color: #FFFFFF }
div.domTT a:active { text-decoration: none; color: #0000FF }
div.domTT a:hover { text-decoration: none; color: #FF0000 }
div.domTT .contents { font-size: 11px; font-family: sans-serif; padding: 3px 2px; background-color: #F1F1FF }
div.domTT .contents a:link { text-decoration: none; color: #000000 }
div.domTT .contents a:visited { text-decoration: none; color: #777777 }
div.domTT .contents a:active { text-decoration: none; color: #0000FF }
div.domTT .contents a:hover { text-decoration: none; color: #FF0000 }
div.domTTlegend { border: 1px solid #333333; background-color: #333333 }
div.domTTlegend .caption { font-family: serif; font-size: 12px; font-weight: bold; padding: 1px 2px; color: #FFFFFF }
div.domTTlegend a:link { text-decoration: none; color: #000000 }
div.domTTlegend a:visited { text-decoration: none; color: #000000 }
div.domTTlegend a:active { text-decoration: none; color: #FF0000 }
div.domTTlegend a:hover { color: #FF0000; text-decoration: none }
div.domTTlegend .contents { font-size: 10px; font-family: sans-serif; padding: 3px 2px; background-color: #F1F1FF }



Threaded view
This is a very big modification of our IPB. Therefore we have some modifications of the files in /sources and of the skin files in Skin/. In order to keep the original skin files untouched I have added new skin files:

These files contain new classes with functions replacing original skin functions. If you have a customized skin then you should copy the appropriate functions of your original skin files to the mod skin files.
Do not overwrite the mod skin code but compare the original code with the new code. Find the differences in the Javascript section and in the topic options. I have changed the topic options like report, new poll etc. in a dropdown field. At the end you can find the insert location for the threaded view
CODE

<!--{IBF.TOGGLE_VIEW}-->

In function TableFooter we have
CODE

<div class="tableborder">
       <!--{IBF.THREAD}-->
</div>

If you have problems to fit the mod skin files to your skin feel free to visit our support forum at ibforen.de

In ACP ⇒ System Settings ⇒ Topics, Posts & Polls you can enable thread view as a global option. Forums can have their own thread settings or they can inherit the options from the global settings.

Users can set preferences in their User Control Panel (UserCP).

When everything is ok your members can toggle the view from normal to threaded by clicking on the topic options in the upper right corner of a topic. The thread list will be displayed below of the topic.
Clicking on a line in the thread list will display the thread beginning with the start post and ending with the choosen post. The specific thread is marked in the thread list.

The member selection of the view mode is stored in a cookie to save the choosen mode. In the Personal CP⇒Board Settings members can select the preferred view mode.


New Macros
In order to use the post reply and post quick reply feature you will find new images for the buttons: p_reply.gif and p_qreply.gif. You can use these graphics if you have defined new macros in ACP.
Use this:
Macro key:
CODE

{<P_QREPLY>}

Macro Replacement:
CODE

<img src='style_images/<#IMG_DIR#>/p_qreply.gif' border='0'  alt='Reply quickly to this post' />


Macro key:
CODE

{<P_REPLY>}

Macro Replacement:
CODE

<img src='style_images/<#IMG_DIR#>/p_reply.gif' border='0'  alt='Reply to this post' />
.

Draggable Quick Reply Box with scriptaculous
If you want to let your members drag the quick reply box then I recommend to use the scriptaculous library.



Multi quote
You can enable this feature in ACP ⇒ System Settings ⇒ Topics, Posts & Polls. When activated the behavior of the quote button changes: A click inserts the post into a quote list. A second click removes the post from quote list. Clicking on the reply button inserts the list of quoted posts into the reply textarea.

The quote list is based upon the use of cookies and Javascript. The cookies have a lifetime of 15 Minutes. Submitting the reply process removes the list of cookies.

Attention: IE8 users will run into problems because that browser behaves a little bit strange: If you have not set the cookie domain in ACP ⇒ System Settings ⇒ Cookies then IE8 will not set the cookies for multiquoting. I have tried to handle this as an exception but you should set the domain like .your_domain.com. Do not forget the leading point.

Page links
Modify function make_page_jump in skin_global.php. Wrap the a-tag with
CODE

<span class='page_link'><a ...>..</a></span>

It will look like this:
CODE

function make_page_jump($tp="", $pp="", $ub="", $p) {
global $ibforums;
return <<<EOF
<span class='page_link' ><a title="{$ibforums->lang['tpl_jump']}" href="javascript:multi_page_jump('$ub',$tp,$pp);">$p {$ibforums->lang['tpl_pages']}</a></span>
EOF;
}


Now you can customize the page links. The topic_page_link style is used in forum view for the topic items. For the standard IPB skin add these css styles to your Style Sheets in ACP
CODE


.page_link {border:1px solid #8FA8C4;padding-left:5px;padding-right:5px;padding-top:2px;padding-bottom:2px;background-color: #F1F7FE;}
.page_link a:link,
.page_link a:visited,
.page_link a:active{text-decoration: none;color:#000000;}
.page_link_active {font-weight:bold;border:1px solid #345487; padding:5px;padding-top:4px;padding-bottom:4px;background-color:  #FFCCCC;}
.topic_page_link {border:1px solid #C2C2DF;padding-left:3px;padding-right:3px;padding-top:0px;padding-bottom:0px;background-color: #DFE6EF;}
.topic_page_link a:link,
.topic_page_link a:visited,
.topic_page_link a:active{text-decoration: none;color:#000000;}


If you want a space between the page symbols add a margin:..px; to the styles.

Request System
As described in the change log above this release implements a request system. User requests appear in ACP and the administrators can process those requests.


Profile Fields
You will find a new option in ACP ⇒ Users and Groups ⇒ Profile Fields: Make Profile Fields searchable in member search.
Now you can customize the location of profile fields: In the original version you could place the custom profile fields by inserting <!--{CUSTOM.FIELDS}--> into skin_profile.php. In the new version you can use
<--{CUSTOM.FIELDS}--> or <!--{CUSTOM.FIELD_1}--> or <!--{CUSTOM.FIELD_2}--> etc. according to the number of profile field in ACP.

Report System
In ACP ⇒ System Settings ⇒ Security & Privacy you will find a new option below of 'Disable 'Report this post to a moderator' link?': 'Report this post' as PM?
If activated report messsages are sent as email and as personal message in order to improve notification about reports.

Guidelines and Terms of Use
New in ACP ⇒ Board Guidelines: Board guidelines are language dependent and stored in lang_glines.php. The dialogue includes fields for editing the Terms of Use in registration process.
Now you can use genuine html for board guidelines and terms of use.

 6.  Comment

This modification updates your Invisionboard 1.3.1 and adds all security code known after release date of 1.3.1. It adds more essential features e.g. like relative dates etc.

If you want to apply this update package to IPB 1.3, you have first to update that version to IPB 1.3.1. At ibforen.de you can find instructions how to fix this.

 7.  Older Change History and Change Logs

2.5.1 ⇒ 2.5.2, dated on August 24th, 2009


2.5.0 ⇒ 2.5.1, dated on March 29th, 2009


2.4.5 ⇒ 2.5.0, dated on February 23th, 2009
Reinstall completely: Replace all mod files in sources/mods and the language files. New skin file is to be copied in all skin folders. Run my ModInstaller.

2.4.4 ⇒ 2.4.5, dated on April 28th, 2008


2.4.3 ⇒ 2.4.4, dated on April 15th, 2008


2.4.2 ⇒ 2.4.3, dated on February 6th, 2008


2.4.1 ⇒ 2.4.2, dated on September 5th, 2007


2.4.0 ⇒ 2.4.1, dated on August 9th, 2007


2.3.4 ⇒ 2.4.0, dated on August 3rd, 2007


User Mode

Admin Mode

Security fixes


2.3.3 ⇒ 2.3.4, dated on June 15th, 2007


2.3.2 ⇒ 2.3.3, dated on May 17th, 2007


2.3.1 ⇒ 2.3.2, dated on May 16th, 2007


2.3.0 ⇒ 2.3.1, dated on January 8th, 2007


2.2.9 ⇒ 2.3.0, dated on December 4rd, 200


2.2.8 ⇒ 2.2.9 , dated on November 26th, 2006


2.2.7 ⇒ 2.2.8 , dated on November 3rd, 2006


2.2.6.2 ⇒ 2.2.7 , dated on September 26th, 2006


2.2.6.1 ⇒ 2.2.6.2 , dated on September 25th, 2006


2.2.6 ⇒ 2.2.6.1 , dated on September 24th, 2006


2.2.5 ⇒ 2.2.6 , dated on September 20th, 2006


2.2.4 ⇒ 2.2.5 , dated on May, 26th 2006


2.2.3 ⇒ 2.2.4 , dated on May, 25th 2006


2.2.2 ⇒ 2.2.3 , dated on May, 10th 2006


2.2.1 ⇒ 2.2.2 , dated on April, 28th 2006


2.2 ⇒ 2.2.1 , dated on April, 27th 2006


2.1.1 ⇒ 2.2 , dated on April, 26th 2006


2.1 ⇒ 2.1.1 , dated on March, 23th 2006


2.0.1 ⇒ 2.1 , dated on March, 5th 2006


2.0 ⇒ 2.0.1 , dated on March, 3th 2006


2.0 ⇒ 2.0.1 , dated on March, 3th 2006


2.0 , dated on February, 29th 2006
Only available for IPB 1.3.1. Make your IPB 1.3 ready for this mod

1.4.1 ⇒ 1.5 , dated on November, 23th 2005


1.4 ⇒ 1.4.1 , dated on October, 12th 2005


1.3 ⇒ 1.4 , dated on September, 2th 2005


1.2 ⇒ 1.3 , dated on May, 10th 2005


1.1 ⇒ 1.2 , dated on April, 27th 2005


1.0 ⇒ 1.1 , dated on April, 25th 2005


Version 1.0 , dated on April, 19th 2005