1. Важное и срочное обновление IPB 3.4.5 - https://nulled.cc/threads/243375/

[HELP] Мод Forum icons

Тема в разделе "IPB", создана пользователем botAniks, 26 июн 2008.

Статус темы:
Закрыта.
Модераторы: Maybe
  1. botAniks

    botAniks Постоялец

    Регистр.:
    12 май 2008
    Сообщения:
    104
    Симпатии:
    23
    Кто нибудь пробовал ставить этот мод на 2.3.5?

    Код:
    +---------------------------------------------------------------------
    |   Invision Power Board v2.2.x
    |  =================================================================
    |   http://www.invisionpower.com
    |   http://www.ibresource.ru
    |  =================================================================
    +---------------------------------------------------------------------
    |
    |   > Forum Icons PLUS
    |   > by Alex/AT, based on gtasa "Forum Icons" mod
    |
    |   > Version: 1.1
    |   > Date: 11.01.2007
    |   > Last Update: 22.04.2007
    |
    +---------------------------------------------------------------------
    |
    |   > Version 1.1
    |   > - Updated for IPB 2.2.2
    |   > - Added AJAX icon toggle for IPB 2.2.2
    |
    |   > Version 1.0
    |   > - Initial release
    |   > - Made images clickable (with the original function of marking
    |   >   forums as read, a bit hacky but works)
    |   > - Made custom images work on redirects, too
    |   > - Added possibility to enable/disable custom icons per skin
    |   > - Icon list is sorted by name
    |
    |   > *** gtasa Forum Icons
    |   > - Original mod
    |
    +---------------------------------------------------------------------
    |
    |   > This mod allows to assign custom icons (instead of standard IPB
    |   > ones) to the forums. It does also allow to enable/disable
    |   > custom icons per skin set (good for skins which make custom
    |   > icons behave badly :).
    |
    |   > Place custom icons (.GIF) files into the ./forumicons folder
    |   > which you must create in the root folder of IPB. The images
    |   > must be named <icon>.gif and <icon_off>.gif, the first is for
    |   > forums with new messages, the second is for forums without new
    |   > messages.
    |
    |   > Before testing, don't forget to enable custom icons in the
    |   > skin manager (using skin options).
    |
    +---------------------------------------------------------------------
    |
    |   > Author is not responsible for any consequences of using this
    |   > forum modification, including those caused by this module
    |   > Use at your own risk
    |
    +---------------------------------------------------------------------
    
    ######################################################################
    Execute the following SQL queries on the database
    ======================================================================
    ALTER TABLE `ibf_forums` ADD `icon` text NOT NULL;
    ALTER TABLE `ibf_skin_sets` ADD `set_use_fimgs` tinyint(1) DEFAULT '1';
    ======================================================================
    
    ######################################################################
    Create ./forumicons folder in the IPB root
    ======================================================================
    
    ######################################################################
    ./sources/classes/class_forums.php
    ======================================================================
    FIND
    ----------------------------------------------------------------------
            if ( $forum_data['img_new_post'] == '<{C_ON}>' )
            {
                $forum_data['img_new_post'] = $this->ipsclass->compiled_templates['skin_boards']->forum_img_with_link($forum_data['img_new_post'], $forum_data['id']);
            }
            else if ( $forum_data['img_new_post'] == '<{C_ON_CAT}>' )
            {
                $forum_data['img_new_post'] = $this->ipsclass->compiled_templates['skin_boards']->subforum_img_with_link($forum_data['img_new_post'], $forum_data['id']);
            }
    ----------------------------------------------------------------------
    BELOW, ADD
    ----------------------------------------------------------------------
            # [B] Forum icons (Alex/AT)
            else if ( substr($forum_data['img_new_post'], 0, 12) == '<img tag="" ' )
            {
                $forum_data['img_new_post'] = '<img '.substr($forum_data['img_new_post'], 12);
                $forum_data['img_new_post'] = $this->ipsclass->compiled_templates['skin_boards']->forum_img_with_link($forum_data['img_new_post'], $forum_data['id']);
            }
            else if ( substr($forum_data['img_new_post'], 0, 16) == '<img tag="_CAT" ' )
            {
                $forum_data['img_new_post'] = '<img '.substr($forum_data['img_new_post'], 16);
                $forum_data['img_new_post'] = $this->ipsclass->compiled_templates['skin_boards']->subforum_img_with_link($forum_data['img_new_post'], $forum_data['id']);
            }
            # [E] Forum icons (Alex/AT)
    ----------------------------------------------------------------------
    FIND
    ----------------------------------------------------------------------
        return ( $forum_data['last_post'] && $forum_data['last_post'] > $rtime ) ? "<{C_ON".$sub_cat_img."}>" : "<{C_OFF".$sub_cat_img."}>";
    ----------------------------------------------------------------------
    REPLACE WITH
    ----------------------------------------------------------------------
        # [B] Forum icons (Alex/AT)
        if ($this->ipsclass->skin['_fimgs'] AND $forum_data['icon']){
            return ( $forum_data['last_post'] && $forum_data['last_post'] > $rtime ) ? ( "<img tag=\"".$sub_cat_img."\" src=\"".$this->ipsclass->vars['board_url']."/forumicons/".$forum_data['icon'].".gif\">" )
            : "<img src=\"".$this->ipsclass->vars['board_url']."/forumicons/".$forum_data['icon']."_off.gif\">";
        }else{
                return ( $forum_data['last_post'] && $forum_data['last_post'] > $rtime ) ? "<{C_ON".$sub_cat_img."}>" : "<{C_OFF".$sub_cat_img."}>";
        }
        # [E] Forum icons (Alex/AT)
    ======================================================================
    
    ######################################################################
    ./sources/action_admin/forums.php
    ======================================================================
    FIND
    ----------------------------------------------------------------------
            $form['parent_id']    = $this->ipsclass->adskin->form_dropdown("parent_id"   , $forumlist, $_POST['parent_id'] ? $_POST['parent_id']    : $forum['parent_id'] );
            $form['status']       = $this->ipsclass->adskin->form_dropdown("status"      , $dd_state , $_POST['status']    ? $_POST['status']       : $forum['status'] );
            $form['sub_can_post'] = $this->ipsclass->adskin->form_yes_no(  'sub_can_post', $_POST['sub_can_post']          ? $_POST['sub_can_post'] : $forum['sub_can_post'] );
    ----------------------------------------------------------------------
    BELOW, ADD
    ----------------------------------------------------------------------
            # [B] Forum icons (Alex/AT)
            $dh = opendir( ROOT_PATH.'forumicons' );
            $icons = array();
            $icons[] = array("", "Default Icons");
            while ($icon = readdir($dh)) {
                if((preg_match("/(.gif)/",$icon) || preg_match("/(.jpg)/",$icon) || preg_match("/(.jpeg)/",$icon) || preg_match("/(.png)/",$icon)) && !preg_match("/(_off)/",$icon)) {
                    if($icon != '.' || $icon != '..') {
                    $iconname = str_replace(".gif","",$icon);
                    $icons[] = array($iconname, $iconname);
                    }
                }
            }
            closedir($dh);
    
            sort($icons);
    
            $form['icon'] = $this->ipsclass->adskin->form_dropdown( "icon", $icons, $_POST['icon'] ? $_POST['icon'] : $forum['icon'] );
            # [E] Forum icons (Alex/AT)
    ----------------------------------------------------------------------
    FIND
    ----------------------------------------------------------------------
            $save = array (  'name'                    => $this->ipsclass->input['name'],
    ----------------------------------------------------------------------
    BELOW, ADD
    ----------------------------------------------------------------------
                            # [B] Forum icons (Alex/AT)
                             'icon'                    => $this->ipsclass->input['icon'],
                            # [E] Forum icons (Alex/AT)
    ======================================================================
    
    ######################################################################
    ./skin_acp/IPB2_Standard/acp_skin_html/cp_skin_forums.php
    ======================================================================
    FIND
    ----------------------------------------------------------------------
        <tr>
            <td width='40%' class='tablerow1'><strong>Описание</strong><div class='desctext'>HTML разрешен.<br />Переносы строк автоматически заменяются на <br>.</div></td>
    
            <td width='60%' class='tablerow2'>{$form['description']}</td>
        </tr>
    ----------------------------------------------------------------------
    ABOVE, ADD
    ----------------------------------------------------------------------
        <!-- [B] Forum icons (Alex/AT) -->
        <tr>
            <td width='40%' class='tablerow1'><strong>Иконка</strong></td>
            <td width='60%' class='tablerow2'>{$form['icon']}</td>
        </tr>
        <!-- [E] Forum icons (Alex/AT) -->
    ======================================================================
    
    ######################################################################
    ./sources/action_admin/skin_sets.php
    ======================================================================
    FIND
    ----------------------------------------------------------------------
            $new['set_name']          = $this->ipsclass->input['set_name'];
            $new['set_image_dir']     = $this_set['set_image_dir'];
            $new['set_hidden']        = $this->ipsclass->input['hidden'];
            $new['set_default']       = 0;
    ----------------------------------------------------------------------
    BELOW, ADD
    ----------------------------------------------------------------------
            # [B] Forum icons (Alex/AT)
            $new['set_use_fimgs']     = $this->ipsclass->input['set_use_fimgs'];
            # [E] Forum icons (Alex/AT)
    ----------------------------------------------------------------------
    FIND
    ----------------------------------------------------------------------
                             'set_css_method'      => $this->ipsclass->input['set_css_method'],
                             'set_hidden'          => $this->ipsclass->input['set_hidden'],
                             'set_image_dir'       => $this->ipsclass->input['set_image_dir'],
                             'set_author_email'    => $this->ipsclass->input['set_author_email'],
    ----------------------------------------------------------------------
    BELOW, ADD
    ----------------------------------------------------------------------
                            # [B] Forum icons (Alex/AT)
                             'set_use_fimgs'       => $this->ipsclass->input['set_use_fimgs'],
                            # [E] Forum icons (Alex/AT)
    ----------------------------------------------------------------------
    FIND
    ----------------------------------------------------------------------
                                   <td width='60%' class='tdrow1'>style_emoticons/ ".$this->ipsclass->adskin->form_dropdown('set_emoticon_folder', $emodirs, $row['set_emoticon_folder'])."</td>
                                 </tr>
    ----------------------------------------------------------------------
    BELOW, ADD
    ----------------------------------------------------------------------
                                <!-- [B] Forum icons (Alex/AT) -->
                                 <tr>
                                   <td width='40%' class='tdrow1'>Использовать нестандартные иконки для форумов?</td>
                                   <td width='60%' class='tdrow1'>".$this->ipsclass->adskin->form_yes_no('set_use_fimgs', $row['set_use_fimgs'])."</td>
                                 </tr>
                                <!-- [E] Forum icons (Alex/AT) -->
    ======================================================================
    
    ######################################################################
    ./sources/ipsclass.php
    ======================================================================
    FIND
    ----------------------------------------------------------------------
                $db_skin = $this->DB->simple_exec_query( array( 'select' => 'set_cache_css,set_cache_wrapper,set_cache_macro,set_image_dir,set_emoticon_folder,set_skin_set_id,set_name,set_css_method', 'from' => 'skin_sets', 'where' => 'set_skin_set_id='.$id ) );
    ----------------------------------------------------------------------
    REPLACE WITH
    ----------------------------------------------------------------------
                $db_skin = $this->DB->simple_exec_query( array( 'select' => 'set_cache_css,set_cache_wrapper,set_cache_macro,set_image_dir,set_emoticon_folder,set_skin_set_id,set_name,set_css_method,set_use_fimgs', 'from' => 'skin_sets', 'where' => 'set_skin_set_id='.$id ) );
    ----------------------------------------------------------------------
    FIND
    ----------------------------------------------------------------------
            $this->skin['_css']         = $db_skin['set_cache_css'];
            $this->skin['_wrapper']     = $db_skin['set_cache_wrapper'];
            $this->skin['_macro']       = $db_skin['set_cache_macro'];
            $this->skin['_imagedir']    = $db_skin['set_image_dir'];
            $this->skin['_emodir']      = $db_skin['set_emoticon_folder'];
            $this->skin['_setid']       = $db_skin['set_skin_set_id'];
    ----------------------------------------------------------------------
    BELOW, ADD
    ----------------------------------------------------------------------
            # [B] Forum icons (Alex/AT)
            $this->skin['_fimgs']       = $db_skin['set_use_fimgs'] ? 1 : 0;
            # [E] Forum icons (Alex/AT)
    ======================================================================
    
    ######################################################################
    ./sources/action_public/boards.php
    ======================================================================
    FIND (2 times)
    ----------------------------------------------------------------------
                    //-----------------------------------------
                    // Get all subforum stats
                    // and calculate
                    //-----------------------------------------
                    
                    if ( $this->ipsclass->vars['forum_cache_minimum'] )
                    {
                        $forum_data['description'] = "<!--DESCRIPTION:{$forum_data['id']}-->";
                        $need_desc[] = $forum_data['id'];
                    }
                        
                    if ( $forum_data['redirect_on'] )
                    {
                        $temp_html .= $this->ipsclass->compiled_templates['skin_boards']->forum_redirect_row( $forum_data );
                    }
                    else
                    {
                        $temp_html .= $this->ipsclass->compiled_templates['skin_boards']->ForumRow( $this->ipsclass->forums->forums_format_lastinfo( $this->ipsclass->forums->forums_calc_children( $forum_data['id'], $forum_data ) ) );
                    }
    ----------------------------------------------------------------------
    REPLACE (2 times) WITH
    ----------------------------------------------------------------------
                    //-----------------------------------------
                    // Get all subforum stats
                    // and calculate
                    //-----------------------------------------
                    
                    if ( $this->ipsclass->vars['forum_cache_minimum'] )
                    {
                        $forum_data['description'] = "<!--DESCRIPTION:{$forum_data['id']}-->";
                        $need_desc[] = $forum_data['id'];
                    }
                        
                    # [B] Forum icons (Alex/AT)
                    if ( $forum_data['redirect_on'] )
                    {
                        # Alex/AT Mod - redirect can have images, too
                        if ($this->ipsclass->skin['_fimgs'] AND ($forum_data['icon'])) {
                            $temp_html_redir = $this->ipsclass->compiled_templates['skin_boards']->forum_redirect_row( $forum_data );
                            $temp_html .= strtr($temp_html_redir, array('<{BR_REDIRECT}>' => "<img src=\"".$this->ipsclass->vars['board_url']."/forumicons/".$forum_data['icon'].".gif\">"));
                        } else {
                            $temp_html .= $this->ipsclass->compiled_templates['skin_boards']->forum_redirect_row( $forum_data );
                        }
                    }
                    else
                    {
                        $temp_html .= $this->ipsclass->compiled_templates['skin_boards']->ForumRow( $this->ipsclass->forums->forums_format_lastinfo( $this->ipsclass->forums->forums_calc_children( $forum_data['id'], $forum_data ) ) );
                    }
                    # [E] Forum icons (Alex/AT)
    ======================================================================
    
    ######################################################################
    ./jscripts/ipb_forum.js
    ======================================================================
    FIND
    ----------------------------------------------------------------------
    function boards_send_marker_update( fid, is_subforum )
    {
    try
    {
    var imgsrc = document.getElementById( 'f-'+fid ).innerHTML;
    if ( imgsrc )
    {
    var regex  = new RegExp( "src=['\"](.*/)("+regex_markers+")['\"]");var results=imgsrc.match(regex);if(img_markers[results[2]]){imgsrc=imgsrc.replace(regex,"src='$1"+img_markers[results[2]]+"'");document.getElementById('f-'+fid).innerHTML=imgsrc;}}}catch(e){}var text_return=0;do_request_function=function(){if(!xmlobj.readystate_ready_and_ok()){return;};text_return=xmlobj.xmlhandler.responseText;};xmlobj=new ajax_request();xmlobj.onreadystatechange(do_request_function);xmlobj.process(ipb_var_base_url+'act=xmlout&do=mark-forum&fid='+fid+'&sf='+is_subforum);if(text_return==1){return false;}}
    ----------------------------------------------------------------------
    REPLACE WITH
    ----------------------------------------------------------------------
    function boards_send_marker_update( fid, is_subforum )
    {
    try
    {
    var imgsrc = document.getElementById( 'f-'+fid ).innerHTML;
    if ( imgsrc )
    {
    var regex  = new RegExp( "src=['\"](.*/)("+regex_markers+")['\"]");
    var results=imgsrc.match(regex);
    if(results && img_markers[results[2]]){
    imgsrc=imgsrc.replace(regex,"src='$1"+img_markers[results[2]]+"'");
    document.getElementById('f-'+fid).innerHTML=imgsrc;
    }
    else
    {
    var regex  = new RegExp( "src=['\"](.*forumicons/)(.+)(\\..+)['\"]");
    var results=imgsrc.match(regex);
    if(results && results[2]){
    imgsrc=imgsrc.replace(regex,"src='$1$2_off$3'");
    document.getElementById('f-'+fid).innerHTML=imgsrc;
    }
    }
    }
    }catch(e){}var text_return=0;do_request_function=function(){if(!xmlobj.readystate_ready_and_ok()){return;};text_return=xmlobj.xmlhandler.responseText;};xmlobj=new ajax_request();xmlobj.onreadystatechange(do_request_function);xmlobj.process(ipb_var_base_url+'act=xmlout&do=mark-forum&fid='+fid+'&sf='+is_subforum);if(text_return==1){return false;}}
    ======================================================================
    Сделал все по инструкции, при создании темы выбираю иконку, при просмотре форума-иконки стандартные :(
    На ibresource написано, что мод подходит для этой версии...
     
    Ardis нравится это.
  2. kanan2008

    kanan2008 Постоялец

    Регистр.:
    17 окт 2007
    Сообщения:
    74
    Симпатии:
    1
    Icon u tebya gif?
     
  3. Pokemon

    Pokemon Создатель

    Регистр.:
    4 апр 2006
    Сообщения:
    46
    Симпатии:
    21
    Это делал?

    Админка -> Внешний Вид -> Настройки (твой стиль) -> Использовать нестандартные иконки для форумов?

    [​IMG]
     
  4. Dark Angell

    Dark Angell Читатель

    Заблокирован
    Регистр.:
    29 фев 2008
    Сообщения:
    1.035
    Симпатии:
    690
    ставил на 2.3.5 иконки не кликабельны вообще,что не делал ничего не помогло сделать их кликабельными,а так красивый мод,ты хоть кеш после установки обновлял?
     
  5. botAniks

    botAniks Постоялец

    Регистр.:
    12 май 2008
    Сообщения:
    104
    Симпатии:
    23
    1. Иконки .гиф и _оф.гиф (я написал, что названия иконок видит, можно выбрать, так как могут они быть не .гиф?)
    2. Использование нестандартных иконок включено (оно по умолчанию включено)
    3. Кэш обновлял

    И все это раз по 10... :nezn:
     
  6. Pokemon

    Pokemon Создатель

    Регистр.:
    4 апр 2006
    Сообщения:
    46
    Симпатии:
    21
    Проверь в базе:

    PHP:
    ALTER TABLE `ibf_forumsADD `icontext NOT NULL;
    ALTER TABLE `ibf_skin_setsADD `set_use_fimgstinyint(1) DEFAULT '1';
    Если всё нормально, тогда даже не знаю, чем тебе помочь :(
     
  7. Mons

    Mons

    Регистр.:
    2 апр 2006
    Сообщения:
    1.590
    Симпатии:
    917
    Найди в коде изменяемом те строки где написано _off.gif и меняй на свое расширение.
     
  8. botAniks

    botAniks Постоялец

    Регистр.:
    12 май 2008
    Сообщения:
    104
    Симпатии:
    23
    Ты серьезно? Эти запросы указаны первыми в установке модуля, так что не пропустить никак :read:

    Просто я отписался на русском _оф.гиф = _off.gif
    В админке выбираются правильно, проблема в том, что на форуме не отображаются :nezn:
     
  9. Pokemon

    Pokemon Создатель

    Регистр.:
    4 апр 2006
    Сообщения:
    46
    Симпатии:
    21
    Я к тому это написал, что у меня с ними проблема была. Пока не полез перепроверять шаги установки и бац, их нет в базе. Хотя как ты правильно заметил пропустить их нельзя )))
     
  10. Mons

    Mons

    Регистр.:
    2 апр 2006
    Сообщения:
    1.590
    Симпатии:
    917
    и будут. В своем случае я правил модуль. там косяк именно с иконками.
     
Статус темы:
Закрыта.