форум vBSupport.ru > vBulletin > vBulletin 4.2.x > Made in vBSupport.org 4.2.x
Register Меню vBsupport Изображения Files Manager О рекламе Today's Posts Search
  • Родная гавань
  • Блок РКН снят
  • Premoderation
  • For English speaking users
  • Каталог Фрилансеров
  • If you want to buy some product or script
  • Администраторам
VBsupport перешел с домена .ORG на родной .RU Ура! Пожалуйста, обновите свои закладки - VBsupport.ru
Блок РКН снят, форум доступен на всей территории России, включая новые терртории, без VPN
На форуме введена премодерация ВСЕХ новых пользователей

Почта с временных сервисов, типа mailinator.com, gawab.com и/или прочих, которые предоставляют временный почтовый ящик без регистрации и/или почтовый ящик для рассылки спама, отслеживается и блокируется, а так же заносится в спам-блок форума, аккаунты удаляются
for English speaking users:
You may be surprised with restriction of access to the attachments of the forum. The reason is the recent change in vbsupport.org strategy:

- users with reputation < 10 belong to "simple_users" users' group
- if your reputation > 10 then administrator (kerk, Luvilla) can decide to move you into an "improved" group, but only manually

Main idea is to increase motivation of community members to share their ideas and willingness to support to each other. You may write an article for the subject where you are good enough, you may answer questions, you may share vbulletin.com/org content with vbsupport.org users, receiving "thanks" equal your reputation points. We should not only consume, we should produce something.

- you may:
* increase your reputation (doing something useful for another members of community) and being improved
* purchase temporary access to the improved category:
10 $ for 3 months. - this group can download attachments, reputation/posts do not matter.
20 $ for 3 months. - this group can download attachments, reputation/posts do not matter + adds eliminated + Inbox capacity increased + files manager increased permissions.

Please contact kerk or Luvilla regarding payments.

Important!:
- if your reputation will become less then 0, you will be moved into "simple_users" users' group automatically.*
*for temporary groups (pre-paid for 3 months) reputation/posts do not matter.
Уважаемые пользователи!

На форуме открыт новый раздел "Каталог фрилансеров"

и отдельный раздел для платных заказов "Куплю/Закажу"

Если вы хотите приобрести какой то скрипт/продукт/хак из каталогов перечисленных ниже:
Каталог модулей/хаков
Ещё раз обращаем Ваше внимание: всё, что Вы скачиваете и устанавливаете на свой форум, Вы устанавливаете исключительно на свой страх и риск.
Сообщество vBSupport'а физически не в состоянии проверять все стили, хаки и нули, выкладываемые пользователями.
Помните: безопасность Вашего проекта - Ваша забота.
Убедительная просьба: при обнаружении уязвимостей или сомнительных кодов обязательно отписывайтесь в теме хака/стиля
Спасибо за понимание
 
 
 
 
DJ Kukstyler
Знаток
 
DJ Kukstyler's Avatar
Default Изменение порядка кастомных ББ-кодов в тулбаре редактора сообщений
1

И так дамы и господа, у меня была проблема касамео кастомных ББ-кодов, а точнее в порядке их отображения в редакторе. Порыскав чуток, ничего рабочего для 4-ки я не нашёл. За сим, подумал поюзать код и в итоге нашёл, может и не очень хорошее/элегантное решение, но рабочее, и как я понял не затратное. Может кому и пригодится.

В 2 файлах есть SQL запросы:

1. class_bbcode_alt.php
PHP Code:
function append_custom_tags()
    {
        if (
$this->custom_fetched == true)
        {
            return;
        }

        
$this->custom_fetched true;
        
// this code would make nice use of an interator
        
if ($this->registry->bbcodecache !== null// get bbcodes from the datastore
        
{
            foreach(
$this->registry->bbcodecache AS $customtag)
            {
                
$has_option $customtag['twoparams'] ? 'option' 'no_option';
                
$customtag['bbcodetag'] = strtolower($customtag['bbcodetag']);
        
                
//str_replace is stop gap until custom tags are updated to the new format
                
$this->tag_list["$has_option"]["$customtag[bbcodetag]"] = array(
                    
'callback' => 'handle_wysiwyg_unparsable',
                    
'strip_empty'         => $customtag['strip_empty'],
                    
'stop_parse'        => $customtag['stop_parse'],
                    
'disable_smilies'    => $customtag['disable_smilies'],
                    
'disable_wordwrap'    => $customtag['disable_wordwrap'],
                );
            }
        }
        else 
// query bbcodes out of the database
        
{
            
$bbcodes $this->registry->db->query_read_slave("
                SELECT bbcodetag, bbcodereplacement, twoparams
                FROM " 
TABLE_PREFIX "bbcode
            "
);
            while (
$customtag $this->registry->db->fetch_array($bbcodes))
            {
                
$has_option $customtag['twoparams'] ? 'option' 'no_option';

                
// str_replace is stop gap until custom tags are updated to the new format
                
$this->tag_list["$has_option"]["$customtag[bbcodetag]"] = array(
                    
'callback' => 'handle_wysiwyg_unparsable',
                    
'strip_empty'        => intval($customtag['options']) & $this->registry->bf_misc['bbcodeoptions']['strip_empty'],
                    
'stop_parse'         => intval($customtag['options']) & $this->registry->bf_misc['bbcodeoptions']['stop_parse'],
                    
'disable_smilies'    => intval($customtag['options']) & $this->registry->bf_misc['bbcodeoptions']['disable_smilies'],
                    
'disable_wordwrap'    => intval($customtag['options']) & $this->registry->bf_misc['bbcodeoptions']['disable_wordwrap']
                );
            }
        }
    } 
2. class_bbcode.php

PHP Code:
    function append_custom_tags()
    {
        if (
$this->custom_fetched == true)
        {
            return;
        }

        
$this->custom_fetched true;
         
this code would make nice use of an interator
        
if ($this->registry->bbcodecache !== null// get bbcodes from the datastore
        
{
            foreach(
$this->registry->bbcodecache AS $customtag)
            {
                
$has_option $customtag['twoparams'] ? 'option' 'no_option';
                
$customtag['bbcodetag'] = strtolower($customtag['bbcodetag']);
        
                
$this->tag_list["$has_option"]["$customtag[bbcodetag]"] = array(
                    
'html'             => $customtag['bbcodereplacement'],
                    
'strip_empty'      => (intval($customtag['options']) & $this->registry->bf_misc['bbcodeoptions']['strip_empty']) ? ,
                    
'stop_parse'       => (intval($customtag['options']) & $this->registry->bf_misc['bbcodeoptions']['stop_parse']) ? 0,
                    
'disable_smilies'  => (intval($customtag['options']) & $this->registry->bf_misc['bbcodeoptions']['disable_smilies']) ? 0,
                    
'disable_wordwrap' => (intval($customtag['options']) & $this->registry->bf_misc['bbcodeoptions']['disable_wordwrap']) ? 0,
                );
            }
        }
        else 
// query bbcodes out of the database
        
{
            
$this->registry->bbcodecache = array();

            
$bbcodes $this->registry->db->query_read_slave("
                SELECT *
                FROM " 
TABLE_PREFIX "bbcode
            "
);
            while (
$customtag $this->registry->db->fetch_array($bbcodes))
            {
                
$has_option $customtag['twoparams'] ? 'option' 'no_option';
                
$customtag['bbcodetag'] = strtolower($customtag['bbcodetag']);
                
$this->tag_list["$has_option"]["$customtag[bbcodetag]"] = array(
                    
'html'             => $customtag['bbcodereplacement'],
                    
'strip_empty'      => (intval($customtag['options']) & $this->registry->bf_misc['bbcodeoptions']['strip_empty']) ? ,
                    
'stop_parse'       => (intval($customtag['options']) & $this->registry->bf_misc['bbcodeoptions']['stop_parse']) ? ,
                    
'disable_smilies'  => (intval($customtag['options']) & $this->registry->bf_misc['bbcodeoptions']['disable_smilies']) ? ,
                    
'disable_wordwrap' => (intval($customtag['options']) & $this->registry->bf_misc['bbcodeoptions']['disable_wordwrap']) ? 0
                
);

                
$this->registry->bbcodecache["$customtag[bbcodeid]"] = $customtag;
            }
        }
    } 
Первое что я сделал это добавил order by bbcodeid в оба запроса. Но оно, естественно, не сработало.
Затем я обратил внимание на код в IF-е, что там есть некий хэш, и просто закомментил эту часть кода. Сработало.
Затем просто выставил в bbcodeid ту очерёдность которую хотел. Теперь всё так, как я хотел.

ЗЫ: я не знаком с веб языками/технологиями и тем более фактически ничего не знаю о недрах движка. Поэтому возможно я что-то упустил, возможно даже важное. По-этому здоровая критика приветствуется.
Однако насколько я понял, неиспользование cache добавляет 1 лишний запрос в базу при загрузке редактора сообщений, что на мой взгляд не является критичным.

В общем, всё. Просто хотел поделиться. Возможно, узнать, что почесал левое ухо правой ногой, и всё это делается намного проще.

DJ Kukstyler добавил 07-23-2022 в 08:16 PM
Ну и да, сейчас функции выглядят следующим образом:

1. class_bbcode_alt.php
PHP Code:
    /**
    * Loads any user specified custom BB code tags into the $tag_list. These tags
    * will not be parsed. They are loaded simply for directive parsing.
    */
    
function append_custom_tags()
    {
        if (
$this->custom_fetched == true)
        {
            return;
        }

        
$this->custom_fetched true;
        
//// this code would make nice use of an interator
        //if ($this->registry->bbcodecache !== null) // get bbcodes from the datastore
        //{
        //    foreach($this->registry->bbcodecache AS $customtag)
        //    {
        //        $has_option = $customtag['twoparams'] ? 'option' : 'no_option';
        //        $customtag['bbcodetag'] = strtolower($customtag['bbcodetag']);
        //
        //        // str_replace is stop gap until custom tags are updated to the new format
        //        $this->tag_list["$has_option"]["$customtag[bbcodetag]"] = array(
        //            'callback' => 'handle_wysiwyg_unparsable',
        //            'strip_empty'         => $customtag['strip_empty'],
        //            'stop_parse'        => $customtag['stop_parse'],
        //            'disable_smilies'    => $customtag['disable_smilies'],
        //            'disable_wordwrap'    => $customtag['disable_wordwrap'],
        //        );
        //    }
        //}
        //else // query bbcodes out of the database
        //{
            
$bbcodes $this->registry->db->query_read_slave("
                SELECT bbcodetag, bbcodereplacement, twoparams
                FROM " 
TABLE_PREFIX "bbcode order by bbcodeid
            "
);
            while (
$customtag $this->registry->db->fetch_array($bbcodes))
            {
                
$has_option $customtag['twoparams'] ? 'option' 'no_option';

                
// str_replace is stop gap until custom tags are updated to the new format
                
$this->tag_list["$has_option"]["$customtag[bbcodetag]"] = array(
                    
'callback' => 'handle_wysiwyg_unparsable',
                    
'strip_empty'        => intval($customtag['options']) & $this->registry->bf_misc['bbcodeoptions']['strip_empty'],
                    
'stop_parse'         => intval($customtag['options']) & $this->registry->bf_misc['bbcodeoptions']['stop_parse'],
                    
'disable_smilies'    => intval($customtag['options']) & $this->registry->bf_misc['bbcodeoptions']['disable_smilies'],
                    
'disable_wordwrap'    => intval($customtag['options']) & $this->registry->bf_misc['bbcodeoptions']['disable_wordwrap']
                );
            }
        
//}
    

2. class_bbcode.php
PHP Code:
    /**
    * Loads any user specified custom BB code tags into the $tag_list
    */
    
function append_custom_tags()
    {
        if (
$this->custom_fetched == true)
        {
            return;
        }

        
$this->custom_fetched true;
        
// this code would make nice use of an interator
        //if ($this->registry->bbcodecache !== null) // get bbcodes from the datastore
        //{
        //    foreach($this->registry->bbcodecache AS $customtag)
        //    {
        //        $has_option = $customtag['twoparams'] ? 'option' : 'no_option';
        //        $customtag['bbcodetag'] = strtolower($customtag['bbcodetag']);
        //
        //        $this->tag_list["$has_option"]["$customtag[bbcodetag]"] = array(
        //            'html'             => $customtag['bbcodereplacement'],
        //            'strip_empty'      => (intval($customtag['options']) & $this->registry->bf_misc['bbcodeoptions']['strip_empty']) ? 1 : 0 ,
        //            'stop_parse'       => (intval($customtag['options']) & $this->registry->bf_misc['bbcodeoptions']['stop_parse']) ? 1 : 0,
        //            'disable_smilies'  => (intval($customtag['options']) & $this->registry->bf_misc['bbcodeoptions']['disable_smilies']) ? 1 : 0,
        //            'disable_wordwrap' => (intval($customtag['options']) & $this->registry->bf_misc['bbcodeoptions']['disable_wordwrap']) ? 1 : 0,
        //        );
        //    }
        //}
        //else // query bbcodes out of the database
        //{
            
$this->registry->bbcodecache = array();

            
$bbcodes $this->registry->db->query_read_slave("
                SELECT *
                FROM " 
TABLE_PREFIX "bbcode order by bbcodeid
            "
);
            while (
$customtag $this->registry->db->fetch_array($bbcodes))
            {
                
$has_option $customtag['twoparams'] ? 'option' 'no_option';
                
$customtag['bbcodetag'] = strtolower($customtag['bbcodetag']);
                
$this->tag_list["$has_option"]["$customtag[bbcodetag]"] = array(
                    
'html'             => $customtag['bbcodereplacement'],
                    
'strip_empty'      => (intval($customtag['options']) & $this->registry->bf_misc['bbcodeoptions']['strip_empty']) ? ,
                    
'stop_parse'       => (intval($customtag['options']) & $this->registry->bf_misc['bbcodeoptions']['stop_parse']) ? ,
                    
'disable_smilies'  => (intval($customtag['options']) & $this->registry->bf_misc['bbcodeoptions']['disable_smilies']) ? ,
                    
'disable_wordwrap' => (intval($customtag['options']) & $this->registry->bf_misc['bbcodeoptions']['disable_wordwrap']) ? 0
                
);

                
$this->registry->bbcodecache["$customtag[bbcodeid]"] = $customtag;
            }
        
//}
    


Last edited by DJ Kukstyler : 07-24-2022 at 12:17 AM. Reason: Добавлено сообщение
Bot
Yandex Bot Yandex Bot is online now
 
Join Date: 05.05.2005
Реклама на форуме А что у нас тут интересного? =)
 
 
DJ Kukstyler
Знаток
 
DJ Kukstyler's Avatar
Default
0

Единственное где не работает (только заметил), это при создании новой темы...

Вроде везде проставил ORDER BY

Bезде кэш закомментил...

Last edited by DJ Kukstyler : 08-09-2022 at 07:16 PM. Reason: Добавлено сообщение
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT +4. The time now is 05:35 PM.


Powered by vBulletin® Version 3.0.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.