Скрываем контент от гостей на SMF2.1 RC 2 и Tinyportal-1.6.4

Все что здесь написано только для обозрения и чтобы мозги не высыхалиНа форумах что у
  1. Оффлайн

    Автор темы

    WYLEK

    Звание: Легенда

    Админ

    Сообщений: 2179

    Создано тем: 315

    Рейтинг: 10

    Репа: (245|245|0)

    Баллы: 3405

    Был: 2024-04-28 20:29

    Лайков: 196

    Все что здесь написано только для обозрения и чтобы мозги не высыхали1tooth




    На форумах что у меня были, в редакторе кнопка HIDE встроена изначально. Здесь все заточено под моды, но, новая версия форума приносила пользователям головную боль - моды не работали или логи были забиты ошибками.
    Пошарил по модам для этого дела, нашел несколько, это:
    HideContent_1.1.4
    HidePost_1-1_smf20
    Personalized BBC
    Visible, Invisible and NoQuote Tags

    Теперь по порядкуwriter

    Мод HideContent запустил на SMF2.0.15, все вроде работает, но, вот что видят всегда пользователи которым разрешен просмотр контента.



    Еще - если в админке сделать запрет скрывать текст, а пользователь вручную написал тег и... все скрывается surprised. Надо помощь програмеров, на следующий год возможно закажу его лечение.

    Мод HidePost работает нормально, но, скрывать весь пост незачемmad

    Мод Personalized BBC прекрасно устанавливается на SMF2.1 RC 2 и работает, но, он больше подходит для аудио или видео тегов, так как там код тега работает на HTML. Не то bang

    Мод Visible, Invisible and NoQuote Tags прекрасно устанавливается на SMF2.1 RC 2 и работает, но, функции создания и управление ярлыками убиты, логи забиты ошибками order.



    Хотя все функции выполняют свои предназначенияok2.
    Начал копать в сторону ошибок в логах.



    Оказалось. автор обновил мод и встроил функцию управления правами доступа в настройках а не в админке. В файле Subs-VIVNQ.php нашел код управления, автор оставил возможность отключить эти прибамбасы. Убрал слеши в строке //'еnabled' => false,.
    
    function VIVNQ_Areas(&$admin_areas)
    {
     global $txt;
     loadLanguage('VIVNQ');
     $admin_areas['config']['areas']['vivnq'] = array(
     'label' => $txt['VIVNQ_Settings'],
     'file' => 'Subs-VIVNQ_Admin.php',
     'function' => 'VIVNQ_Settings',
     'icon' => 'modifications.gif',
     'subsections' => array(
     'shortcuts' => array($txt['VIVNQ_shortcuts']),
     'newtag' => array($txt['VIVNQ_new_tag']),
     'permissions' => array($txt['membergroups_permissions']),
     ),
     'enabled' => false,
     );
    }


    Чтобы не гавкали логи и настройки мода оказались в админке, подключил в файле add_remove_hooks.php файл Subs-VIVNQ_Admin.php

    // Define the hooks
    $hook_functions = array(
     'integrate_pre_include' => '$sourcedir/Subs-VIVNQ.php,$sourcedir/Subs-VIVNQ_Admin.php',
     'integrate_load_theme' => 'VIVNQ_LoadTheme',
     'integrate_load_permissions' => 'VIVNQ_Permissions',
     'integrate_bbc_codes' => 'VIVNQ_Tags',
    // SMF 2.x Admin hooks:
     'integrate_admin_areas' => 'VIVNQ_Areas',
    );


    Чтобы работали подсказки в админке, в файлах VIVNQ.english.php и VIVNQ.russian.php вырезал языковые ресурсы помощи и вставил в файл install_21x.xml.

    <?xml version="1.0"?>
    <!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
    <modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
    <id>Dougiefresh:IXCNQ</id>
    <name>Visible, Invisible and NoQuote Tags</name>
    <version>3.7</version>
     <file name="$languagedir/Modifications.english.php">
     <operation>
     <search position="end" />
     <add><![CDATA[
    // VIVNQ Start
    $txt['permissiongroup_VIVNQ'] = $txt['permissiongroup_simple_VIVNQ'] = 'Visible, Invisible and NoQuote';
    $txt['permissionname_VIVNQ_use_visible'] = 'Allow use of the  &quot;visible&quot; tag';
    $txt['permissionhelp_VIVNQ_use_visible'] = 'Checking this option allows members of this membergroup to use the &quot;visible&quot; bbcode tag to filter out who can see the message contained within the tags.<br/><br/>Unchecking this option will cause the forum to remove the tags from the message before committing it to the database.';
    $txt['permissionname_VIVNQ_quote_visible'] = 'Quote the contents of &quot;visible&quot; tag';
    $txt['permissionhelp_VIVNQ_quote_visible'] = 'Checking this option allows members of this membergroup to quote the &quot;visible&quot; bbcode tag to filter out who can see the message contained within the tags.<br/><br/>Unchecking this option will cause the forum to remove the tags from the message before committing it to the database.';
    $txt['permissionname_VIVNQ_use_invisible'] = 'Allow use of the  &quot;invisible&quot; tag';
    $txt['permissionhelp_VIVNQ_use_invisible'] = 'Checking this option allows members of this membergroup to use the &quot;invisible&quot; bbcode tag to filter out who can see the message contained within the tags.<br/><br/>Unchecking this option will cause the forum to remove the tags from the message before committing it to the database.';
    $txt['permissionname_VIVNQ_quote_invisible'] = 'Quote the contents of &quot;invisible&quot; tag';
    $txt['permissionhelp_VIVNQ_quote_invisible'] = 'Checking this option allows members of this membergroup to quote the &quot;invisible&quot; bbcode tag to filter out who can see the message contained within the tags.<br/><br/>Unchecking this option will cause the forum to remove the tags from the message before committing it to the database.';
    $txt['permissionname_VIVNQ_use_noquote'] = 'Allow use of the  &quot;noquote&quot; tag';
    $txt['permissionhelp_VIVNQ_use_noquote'] = 'Checking this option allows members of this membergroup to use the &quot;noquote&quot; bbcode tag to filter out who can see the message contained within the tags.<br/><br/>Unchecking this option will cause the forum to remove the tags from the message before committing it to the database.';
    $txt['permissionname_VIVNQ_quote_noquote'] = 'Quote the contents of &quot;noquote&quot; tag';
    $txt['permissionhelp_VIVNQ_quote_noquote'] = 'Checking this option allows members of this membergroup to quote the &quot;innoquote&quot; bbcode tag to filter out who can see the message contained within the tags.<br/><br/>Unchecking this option will cause the forum to remove the tags from the message before committing it to the database.';
    $txt['permissionname_VIVNQ_toggle_filter'] = 'Toggle filtering of &quot;visible&quot; &amp; &quot;invisible&quot; tag';
    $txt['permissionhelp_VIVNQ_toggle_filter'] = 'By default, only Adminstrators, Moderators and the original post author have the right to see how the unfiltered content would be processed by the forum.<br/><br/>Checking this box allows the user to view the contents of &quot;visible&quot;, &quot;invisible&quot;, and &quot;noquote&quot; tags by clicking on the &quot;Filter On&quot; or &quot;Filter Off&quot; buttons near the &quot;Modify&quot; and &quot;Quote&quot; buttons.';
    // VIVNQ End
    ]]></add>
     </operation>
     </file>
    
     <file name="$languagedir/Modifications.russian.php">
     <operation>
     <search position="end" />
     <add><![CDATA[
    // VIVNQ Start
    $txt['permissiongroup_VIVNQ'] = $txt['permissiongroup_simple_VIVNQ'] = 'Visible, Invisible и NoQuote';
    $txt['permissionname_VIVNQ_use_visible'] = 'Разрешить использование тега  &quot;visible&quot; ';
    $txt['permissionhelp_VIVNQ_use_visible'] = 'Если этот параметр установлен, члены группы могут использовать тег &quot;visible&quot; для фильтрации сообщений, содержащихся в тегах.<br/><br/>Отмена выбора этого параметра приведет к тому, что форум удалит теги из сообщения перед его привязкой к базе данных.';
    $txt['permissionname_VIVNQ_quote_visible'] = 'Цитировать содержимое тега &quot;visible&quot; ';
    $txt['permissionhelp_VIVNQ_quote_visible'] = 'Если этот параметр установлен, члены группы могут цитировать тег &quot;visible&quot; для фильтрации сообщений, содержащихся в тегах.<br/><br/>Отмена выбора этого параметра приведет к тому, что форум удалит теги из сообщения перед его привязкой к базе данных.';
    $txt['permissionname_VIVNQ_use_invisible'] = 'Разрешить использование тега  &quot;invisible&quot; ';
    $txt['permissionhelp_VIVNQ_use_invisible'] = 'Если этот параметр установлен, члены группы могут использовать тег &quot;invisible&quot; для фильтрации сообщений, содержащихся в тегах.<br/><br/>Отмена выбора этого параметра приведет к тому, что форум удалит теги из сообщения перед его привязкой к базе данных.';
    $txt['permissionname_VIVNQ_quote_invisible'] = 'Цитировать содержимое тега &quot;invisible&quot; ';
    $txt['permissionhelp_VIVNQ_quote_invisible'] = 'Если этот параметр установлен, члены группы могут цитировать тег &quot;invisible&quot; для фильтрации сообщений, содержащихся в тегах.<br/><br/>Отмена выбора этого параметра приведет к тому, что форум удалит теги из сообщения перед его привязкой к базе данных.';
    $txt['permissionname_VIVNQ_use_noquote'] = 'Разрешить использование тега  &quot;noquote&quot; ';
    $txt['permissionhelp_VIVNQ_use_noquote'] = 'Если этот параметр установлен, члены группы могут использовать тег &quot;noquote&quot;  для фильтрации сообщений, содержащихся в тегах.<br/><br/>Отмена выбора этого параметра приведет к тому, что форум удалит теги из сообщения перед его привязкой к базе данных.';
    $txt['permissionname_VIVNQ_quote_noquote'] = 'Цитировать содержимое тега &quot;noquote&quot; ';
    $txt['permissionhelp_VIVNQ_quote_noquote'] = 'Если этот параметр установлен, члены группы могут цитировать тег &quot;innoquote&quot; для фильтрации сообщений, содержащихся в тегах.<br/><br/>Отмена выбора этого параметра приведет к тому, что форум удалит теги из сообщения перед его привязкой к базе данных.';
    $txt['permissionname_VIVNQ_toggle_filter'] = 'Переключение фильтрации тегов &quot;visible&quot; &amp; &quot;invisible&quot; ';
    $txt['permissionhelp_VIVNQ_toggle_filter'] = 'По умолчанию только администраторы, модераторы и автор оригинального поста имеют право видеть, как нефильтрованный контент будет обрабатываться форумом.<br/><br/>Установка этого флажка позволяет пользователю просматривать содержимое тегов &quot;visible&quot;, &quot;invisible&quot; и &quot;noquote&quot;, нажимая кнопки &quot;Включить фильтр&quot; или &quot;Выключить фильтр&quot; рядом с кнопками &quot;Цитировать&quot; и &quot;Редактировать&quot; .';
    // VIVNQ End
    ]]></add>
     </operation>
     </file>


    В файле package-info.xml добавил русский язык.

    <install for="2.1 RC2">
     <readme parsebbc="true">readme.txt</readme>
     <code>add_remove_hooks.php</code>
     <modification>install_21x.xml</modification>
     <modification>language_english.xml</modification>
     <modification>language_russian.xml</modification>
     <modification>language_spanish.xml</modification>
     <require-file name="Subs-VIVNQ.php" destination="$sourcedir" />
     <require-file name="Subs-VIVNQ_Admin.php" destination="$sourcedir" />
     <require-file name="VIVNQ.english.php" destination="$languagedir" />
     <require-file name="VIVNQ.spanish_latin.php" destination="$languagedir" />
     <require-file name="VIVNQ.russian.php" destination="$languagedir" />
     <require-file name="BBCode-VIVNQ.css" destination="$themedir/css" />
     </install>
     <uninstall for="2.1 RC2">
     <code>add_remove_hooks.php</code>
     <modification reverse="true">install_21x.xml</modification>
     <modification reverse="true">language_english.xml</modification>
     <modification reverse="true">language_russian.xml</modification>
     <modification reverse="true">language_spanish.xml</modification>
     <remove-file name="$sourcedir/Subs-VIVNQ.php" /> 
     <remove-file name="$sourcedir/Subs-VIVNQ_Admin.php" /> 
     <remove-file name="$languagedir/VIVNQ.english.php" /> 
     <remove-file name="$languagedir/VIVNQ.spanish_latin.php" /> 
     <remove-file name="$languagedir/VIVNQ.russian.php" />
     <remove-file name="$themedir/css/BBCode-VIVNQ.css" />
     </uninstall>


    Ошибки исчезли и в админке все можно настроить, стали видны подсказки.



    Теперь из-за функции выше в логах идут десятки ошибок при просмотре тем. Поборол так - в файле install_21x.xml заменил фильтрацию, получилось те так как задумывал автор, но он куда то исчез и сайт его померorder.

    Это находится в конце файла. 

    <operation>
     <search position="after"><![CDATA[if ($message['can_approve'] || $message['can_unapprove'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'])]]></search>
     <add><![CDATA[// Can we hide the filtered visible/invisible text?
     if (!empty($context['VIVNQ_Show']))
     echo '
     <li><a href="', $scripturl, '?topic=', $topic, '.msg', $message['id'], (!isset($_REQUEST['filter']) ? ';filter': ''), '#msg', $message['id'], '"><span class="', (!isset($_REQUEST['filter']) ? 'show' :'hide'), 'VIVNQ"></span>', (!isset($_REQUEST['filter']) ? $txt['VIVNQ_Collapse'] : $txt['VIVNQ_Expand']), '</a></li>';
     unset($context['VIVNQ_Test']);
    
     ]]></add>
     </operation>
    </file>


    Все, можно добавить изменения в мод и установить на форум. Все теги работают без ошибок кроме тега noquoteremark
    Сообщение отредактировал WYLEK 29 января 2023 - 13:57

    14 декабря 2019 - 18:09 / #1

Статистика форума, пользователей онлайн: 0 (за последние 20 минут)

---
Создано тем
1177
Всего сообщений
15352
Пользователей
17856
Новый участник
Daniel7375ysk