Autor Tópico: Hide Tag Special RC3 Suporte RCx  (Lida 2159 vezes)

0 Membros e 1 Visitante estão a ver este tópico.

Offline candidosa2

  • Suporte Tecnico
  • Fundador
  • *
  • Mensagens: 5044
  • Rank: 1658
  • Sexo: Masculino
  • Suporte
    • Hosting Moçambique
Hide Tag Special RC3 Suporte RCx
« em: 10 de Abril de 2011, 10:55 »
  • Publicar
  • [info]To a instalar automático esta a dar este erro entao melhor e instalar manualmente conforme a imagem[/info]


    /Sources/Admin.php
    Pesqusiar
    Código: [Seleccione]
    'subsections' => array(
                            'posts' => array($txt['manageposts_settings'], 'admin_forum'),

    Trocar por ( Substituir
    Código: [Seleccione]
    'subsections' => array(
                            'posts' => array($txt['manageposts_settings'], 'admin_forum'),
                            'hidetagspecial' => array($txt['manageposts_hidetagspecial_settings'], 'admin_forum'),


    ./Sources/ManagePosts.php

    Pesqusiar
    Código: [Seleccione]
            'posts' => array('ModifyPostSettings', 'admin_forum'),

    Trocar por
    Código: [Seleccione]
    'posts' => array('ModifyPostSettings', 'admin_forum'),
            'hidetagspecial' => array('ModifyHideTagSpecialSettings', 'admin_forum'),


    Bul

                'posts' => array(
                    'description' => $txt['manageposts_settings_description'],
                ),


    Código: [Seleccione]
    'posts' => array(
                    'description' => $txt['manageposts_settings_description'],
                ),
                'hidetagspecial' => array(
                    'description' => $txt['manageposts_hidetagspecial_settings_description'],
                ),


    Pesquisar
    Código: [Seleccione]
    // Bulletin Board Code...a lot of Bulletin Board Code.
    function ModifyBBCSettings($return_config = false)

    Trocar por
    Código: [Seleccione]
    //This is everything you need for the hide tag special in posts :)
    function ModifyHideTagSpecialSettings()
    {
        global $txt, $scripturl, $context, $settings, $sc, $modSettings, $sourcedir;
        global $smcFunc;

        // Wanna save this page?
        if (isset($_POST['save_settings']))
        {
            checkSession();
           
            //Prepare Textareas :)
           
            $_POST['hide_hiddentext'] = $smcFunc['htmlspecialchars'](stripslashes($_POST['hide_hiddentext']), ENT_QUOTES);
            $_POST['hide_unhiddentext'] = $smcFunc['htmlspecialchars'](stripslashes($_POST['hide_unhiddentext']), ENT_QUOTES);
       
            // Int array checkup the din lazy way :P
            $intPostVars = array('hide_autohidefirstpost', 'hide_autounhidegroups', 'hide_unhideunlockedtopicgroups', 'hide_posUnhiddenText');
            foreach ($intPostVars as $toInt)
            {
                if (!empty($_POST[$toInt]) && is_array($_POST[$toInt]))
                {
                    $new_array = array();
                    foreach ($_POST[$toInt] as $i)
                    {
                        $i = (int) $i;
                        if(!empty($i))
                            $new_array[$i] = $i;
                    }
                    $_POST[$toInt] = implode(',', $new_array);
                }
                elseif (!empty($_POST[$toInt]))
                    $_POST[$toInt] = (int) $_POST[$toInt];
            }   
           
            $_POST['hide_posUnhiddenText'] = (int) $_POST['hide_posUnhiddenText'];
           
            // Update the actual settings.
            updateSettings(array(
                'hide_MUIswitch' => empty($_POST['hide_MUIswitch']) ? '0' : '1',
                'hide_enableHTML' => empty($_POST['hide_enableHTML']) ? '0' : '1',
                'hide_useSpanTag' => empty($_POST['hide_useSpanTag']) ? '0' : '1',
                'hide_enableUnhiddenText' => empty($_POST['hide_enableUnhiddenText']) ? '0' : '1',
                'hide_hiddentext' => empty($_POST['hide_hiddentext']) ? '' : $_POST['hide_hiddentext'],
                'hide_unhiddentext' => empty($_POST['hide_unhiddentext']) ? '' : $_POST['hide_unhiddentext'],
                'hide_posUnhiddenText' => empty($_POST['hide_posUnhiddenText']) || $_POST['hide_posUnhiddenText'] > 4 ? 4 : $_POST['hide_posUnhiddenText'],
                'hide_onlyonetimeinfo' => empty($_POST['hide_onlyonetimeinfo']) ? '0' : '1',
                'hide_noinfoforguests' => empty($_POST['hide_noinfoforguests']) ? '0' : '1',
                'hide_autounhidegroups' => empty($_POST['hide_autounhidegroups']) ? '' : $_POST['hide_autounhidegroups'],
                'hide_unhideparser' => empty($_POST['hide_unhideparser']) ? '0' : '1',
                'hide_minpostunhide' => empty($_POST['hide_minpostunhide']) ? '0' : (int) $_POST['hide_minpostunhide'],
                'hide_minpostautounhide' => empty($_POST['hide_minpostautounhide']) ? '0' : (int) $_POST['hide_minpostautounhide'],
                'hide_karmaenable' => !empty($_POST['hide_karmaenable']) && !empty($modSettings['karmaMode']) ? '1' : '0',
                'hide_minkarmaunhide' => empty($_POST['hide_minkarmaunhide']) ? '0' : (int) $_POST['hide_minkarmaunhide'],
                'hide_minkarmaautounhide' => empty($_POST['hide_minkarmaautounhide']) ? '0' : (int) $_POST['hide_minkarmaautounhide'],
                'hide_minimumkarmaandpost' => empty($_POST['hide_minimumkarmaandpost']) ? '0' : '1',
                'hide_onlykarmagood' => empty($_POST['hide_onlykarmagood']) ? '0' : '1',
                'hide_unhideunlockedtopic' => empty($_POST['hide_unhideunlockedtopic']) ? '0' : '1',
                'hide_unhideunlockedtopicguest' => empty($_POST['hide_unhideunlockedtopicguest']) ? '0' : '1',
                'hide_unhideunlockedtopicgroups' => empty($_POST['hide_unhideunlockedtopicgroups']) ? '' : $_POST['hide_unhideunlockedtopicgroups'],
                'hide_autohidefirstpostenable' => empty($_POST['hide_autohidefirstpostenable']) ? '0' : '1',
                'hide_autohidefirstpost' => empty($_POST['hide_autohidefirstpost']) ? '' : $_POST['hide_autohidefirstpost'],
            ));

            //Remove the $_POST data.
            redirectexit($scripturl . '?action=admin;area=postsettings;sa=hidetagspecial');
        }

        // We'll want this for our easy save.
        require_once($sourcedir .'/ManageServer.php');

        //Load membergroups.
        $modSettings['hide_autounhidegroups'] = !empty($modSettings['hide_autounhidegroups']) ? explode(',', $modSettings['hide_autounhidegroups']) : array();
        $modSettings['hide_unhideunlockedtopicgroups'] = !empty($modSettings['hide_unhideunlockedtopicgroups']) ? explode(',', $modSettings['hide_unhideunlockedtopicgroups']) : array();
        $request = $smcFunc['db_query']('', "
            SELECT group_name, id_group, min_posts
            FROM {db_prefix}membergroups
            ORDER BY min_posts, id_group != 1, id_group != 2, id_group != 3, group_name");
        while ($row = $smcFunc['db_fetch_assoc']($request))
        {
            $context['groups'][(int) $row['id_group']] = array(
                'id' => $row['id_group'],
                'name' => trim($row['group_name']),
                'checked' => in_array($row['id_group'], $modSettings['hide_autounhidegroups']),
                'checked_2' => in_array($row['id_group'], $modSettings['hide_unhideunlockedtopicgroups']),
                'is_post_group' => $row['min_posts'] != -1,
            );
        }
        $smcFunc['db_free_result']($request);
       
        //Sorry for the lazyness... but it's easier...
        loadLanguage('ManageBoards');

        //Fix something the first time :D
        if(empty($modSettings['hide_posUnhiddenText']))
            updateSettings(array('hide_posUnhiddenText' => 4));

        // Setup the template.
        $context['sub_template'] = 'edit_hidetagspecial_settings';
        $context['page_title'] = $txt['manageposts_hidetagspecial_settings_title'];

        // Final settings...
        $context['post_url'] = $scripturl . '?action=admin;area=postsettings;save;sa=hidetagspecial';
        $context['settings_title'] = $txt['manageposts_hidetagspecial_settings'];

        // Populate this nice tree, i don't need all informations =D
        $modSettings['hide_autohidefirstpost'] = !empty($modSettings['hide_autohidefirstpost']) ? explode(',', $modSettings['hide_autohidefirstpost']) : array();

        // Find all the boards this user is allowed to see.
        $request = $smcFunc['db_query']('', "
            SELECT b.id_cat, c.name AS cat_name, b.id_board, b.name, b.child_level
            FROM {db_prefix}boards AS b
                LEFT JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat)
            WHERE {query_see_board}");
        $context['num_boards'] = $smcFunc['db_num_rows']($request);
        $context['categories'] = array();
        while ($row = $smcFunc['db_fetch_assoc']($request))
        {
            // This category hasn't been set up yet..
            if (!isset($context['categories'][$row['id_cat']]))
                $context['categories'][$row['id_cat']] = array(
                    'id' => $row['id_cat'],
                    'name' => $row['cat_name'],
                    'boards' => array()
                );

            // Set this board up, and let the template know when it's a child.  (indent them..)
            $context['categories'][$row['id_cat']]['boards'][$row['id_board']] = array(
                'id' => $row['id_board'],
                'name' => $row['name'],
                'checked' => in_array($row['id_board'], $modSettings['hide_autohidefirstpost']),
                'child_level' => $row['child_level'],
            );
        }
        mysql_free_result($request);

        // Now, let's sort the list of categories into the boards for templates that like that.
        $temp_boards = array();
        foreach ($context['categories'] as $category)
        {
            $temp_boards[] = array(
                'name' => $category['name'],
                'child_ids' => array_keys($category['boards'])
            );
            $temp_boards = array_merge($temp_boards, array_values($category['boards']));
        }

        $max_boards = ceil(count($temp_boards) / 2);
        if ($max_boards == 1)
            $max_boards = 2;

        // Now, alternate them so they can be shown left and right ;).
        $context['board_columns'] = array();
        for ($i = 0; $i < $max_boards; $i++)
        {
            $context['board_columns'][] = $temp_boards[$i];
            if (isset($temp_boards[$i + $max_boards]))
                $context['board_columns'][] = $temp_boards[$i + $max_boards];
            else
                $context['board_columns'][] = array();
        }

        $context['all_checked'] = $context['num_boards'] == count($modSettings['hide_autohidefirstpost']);
    }

    // Bulletin Board Code...a lot of Bulletin Board Code.
    function ModifyBBCSettings($return_config = false)


    ./Sources/Subs-Editor.php

    Pesquisar
    Código: [Seleccione]
        $text = parse_bbc($text, true, '', $allowed_tags);
    trocar por
    Código: [Seleccione]
    // Fix the hide tag problem... my mod is strict to strict...
        if(hideTagExists($text, 'text'))
            $text = preg_replace("/\[\/hide\]/i", '#hide#', $text);
        $text = parse_bbc($text, true, '', $allowed_tags);
        // Set it back to normal :D
        if(hideTagExists($text, 'text'))
            $text = str_replace("#hide#", '[/hide]', $text);


    ./Sources/Display.php

    Pesquisar
    Código: [Seleccione]
    // Find the previous or next topic.  Make a fuss if there are no more.

    Adicionar depois do codigo pesquisado

    Código: [Seleccione]
      //Okay let's Check an prepare ;)
        $context['user_post_avaible'] = 0; //Standard Show no hidden content ;)

        //Only a Member Thing ;)
        if (!$user_info['is_guest']) {
            $check_for_hide = true;

            //Groupcheck ;D
            if($check_for_hide && !empty($modSettings['hide_autounhidegroups'])) {
                $modSettings['hide_autounhidegroups'] = !is_array($modSettings['hide_autounhidegroups']) ? explode(',', $modSettings['hide_autounhidegroups']) : $modSettings['hide_autounhidegroups'];
                foreach($user_info['groups'] as $group_id)
                    if(in_array($group_id, $modSettings['hide_autounhidegroups'])) {
                        $check_for_hide = false;
                        $context['user_post_avaible'] = 1;
                        break; //One is enouph ;D
                    }
            }

            $karmaOk = false;
            $postOk = false;

            //Okay know let's look for the post minimum ;D
            if($check_for_hide && (!empty($modSettings['hide_minpostunhide']) || !empty($modSettings['hide_minpostautounhide']))) {
                //Load the posts data ;D
                global $user_settings;

                //Need a minimum post to unhide?
                if(!empty($modSettings['hide_minpostunhide']) && $modSettings['hide_minpostunhide'] > 0 && $user_settings['posts'] < $modSettings['hide_minpostunhide']) {
                    $postOk = true;
                    $check_for_hide = false;
                }

                //Auto Unhide????
                if(!empty($modSettings['hide_minpostautounhide']) && $modSettings['hide_minpostautounhide'] > 0 && $user_settings['posts'] > $modSettings['hide_minpostautounhide']) {
                        $check_for_hide = false;
                        $context['user_post_avaible'] = 1;
                }

            }
            else
                $postOk = true;

            //Okay Check Karma Things :)
            if(!empty($modSettings['karmaMode']) && $check_for_hide && !empty($modSettings['hide_karmaenable'])) {
                //Karma Check :D for this i need to load the user infos :x
                loadMemberData($user_info['id']);
                loadMemberContext($user_info['id']);
                global $memberContext;

                if(!empty($modSettings['hide_onlykarmagood']))
                    $karmaValue = $memberContext[$user_info['id']]['karma']['good'];
                else
                    $karmaValue = $memberContext[$user_info['id']]['karma']['good'] - $memberContext[$user_info['id']]['karma']['bad'];

                //Need a minimum karma to unhide?
                if(!empty($modSettings['hide_minkarmaunhide']) && $karmaValue < $modSettings['hide_minkarmaunhide']) {
                    $check_for_hide = false;
                    $karmaOk = true;
                }

                //Auto Unhide for Karma?
                if(!empty($modSettings['hide_minkarmaautounhide']) && $karmaValue > $modSettings['hide_minkarmaautounhide']) {
                        $check_for_hide = false;
                        $context['user_post_avaible'] = 1;
                }

            }
            else
                $karmaOk = true;

            // Find if there a post from you in this thread :) (For the hide tag, at least one Post need to be approved!)
            if (empty($context['user_post_avaible']) && $check_for_hide) {
                $request = $smcFunc['db_query']('', '
                    SELECT id_msg, id_member, approved
                    FROM {db_prefix}messages
                        WHERE id_topic = {int:topic}
                        AND id_member = {int:id_member}
                        AND approved = {int:approved}
                    LIMIT {int:limit}',
                    array(
                        'id_member' => $user_info['id'],
                        'topic' => $topic,
                        'limit' => 1,
                        'approved' => 1,
                    )
                );

                if ($smcFunc['db_num_rows']($request))
                    $context['user_post_avaible'] = 1;
                else
                    $context['user_post_avaible'] = 0;
                $smcFunc['db_free_result']($request);
            }
        }


    Pesquisar
    Código: [Seleccione]
    $context['is_approved'] = $topicinfo['approved'];
    Trocar por
    Código: [Seleccione]
    $context['is_approved'] = $topicinfo['approved'];

        // Unhide hidden content on locked topics, don't forget the guest can see it to if you allow it ;)
        if (!empty($context['is_locked']) && empty($context['user_post_avaible']) && !empty($modSettings['hide_unhideunlockedtopic']))
        {
            if (!$user_info['is_guest'] && !empty($modSettings['hide_unhideunlockedtopicgroups']))
            {
                $modSettings['hide_unhideunlockedtopicgroups'] = explode(',', $modSettings['hide_unhideunlockedtopicgroups']);
                foreach ($user_info['groups'] as $group_id)
                    if(in_array($group_id, $modSettings['hide_unhideunlockedtopicgroups'])) {
                        $context['user_post_avaible'] = 1;
                        break; // One is enouph ;D
                    }
            }
            // Yes it's unlogical to allow guest to see it and not other user... but it's you're choice :P
            elseif ($user_info['is_guest'] && !empty($modSettings['hide_unhideunlockedtopicguest']))
                $context['user_post_avaible'] = 1;
        }


    ./Sources/Post.php

    Pesquisar
    Código: [Seleccione]
                // Do all bulletin board code tags, with or without smileys.
                $context['preview_message'] = parse_bbc($context['preview_message'], isset($_REQUEST['ns']) ? 0 : 1);

    Trocar por
    Código: [Seleccione]
               // Okay this is a real preview, i will allow now to see the hidden content :D, and the best thing it's secure :P
                if (hideTagExists($context['preview_message'], 'preview'))
                    $context['user_post_avaible'] = 1;
                // Do all bulletin board code tags, with or without smileys.
                $context['preview_message'] = parse_bbc($context['preview_message'], isset($_REQUEST['ns']) ? 0 : 1);
                // Remove hiden content now :P, smf 2 work diffrent :P
                if (hideTagExists($context['preview_message'], 'preview'))
                    $context['user_post_avaible'] = 0;

    Pesquisar
    Código: [Seleccione]
          $user_info['name'] = $_POST['guestname'];
            preparsecode($_POST['message']);

    trocar por
    Código: [Seleccione]
            $user_info['name'] = $_POST['guestname'];
            preparsecode($_POST['message']);
           
            // Okay i will say there is something, so that i check for an real empty post :)
            $context['user_post_avaible'] = 1;


    Pesquisar
    Código: [Seleccione]
    $newTopic = empty($_REQUEST['msg']) && empty($topic);

    Trocar por
    Código: [Seleccione]
    $newTopic = empty($_REQUEST['msg']) && empty($topic);

        // Time to add the secret hidden content on new topics only :)
        if ($newTopic && !empty($modSettings['hide_autohidefirstpostenable']) && !empty($modSettings['hide_autohidefirstpost']))
        {
            $modSettings['hide_autohidefirstpost'] = explode(',', $modSettings['hide_autohidefirstpost']);
            if (in_array($board, $modSettings['hide_autohidefirstpost']))
            {
                // Only if there is no hidden content than i will add this automatic =)
                if(!hideTagExists($_POST['message']))
                    $_POST['message'] = '[hide]'.$_POST['message'].'[/hide]';
            }
        }


    Pesquisar
    Código: [Seleccione]
      if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img>')) === '')

    Trocar por
    Código: [Seleccione]
            // Okay i will say there is something, so that i check for an real empty post :)
                $context['user_post_avaible'] = 1;

                if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img>')) === '')


    Pesquisar
    Código: [Seleccione]
      unset($_POST['message']);
                }

    Trocar por
    Código: [Seleccione]
                    unset($_POST['message']);
                }

                // Disable it again, sorry if you not allowed to see it... only a preview is allowed ;P
                $context['user_post_avaible'] = 0;


    Pesquisar
    Código: [Seleccione]
       FROM {db_prefix}messages AS m
                INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)


    Trocar por
    Código: [Seleccione]
       , m.id_member AS id_member_check, b.id_board as id_board_check
            FROM {db_prefix}messages AS m
                INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)

    Pesquisar
    Código: [Seleccione]
         $context['sub_template'] = 'modifyfast';
                $context['message'] = array(

    Trocar por
    Código: [Seleccione]
    //This is a check that SMF not do... i will check if he allowed to edit or edit any
                if(!allowedTo('modify_any', $row['id_board_check']) && $user_info['id'] != $row['id_member_check']) {
                    //Remove the Hidden Content because it's only for the master post *g*
                    $row['body'] = preg_replace("/\[hide\](.+?)\[\/hide\]/i", "&nbsp;", $row['body']);
                    $row['body'] = preg_replace(array('~\n?\[hide.*?\].+?\[/hide\]\n?~is', '~^\n~', '~\[/hide\]~'), "&nbsp;", $row['body']);
                }

                $context['sub_template'] = 'modifyfast';
                $context['message'] = array(

    Pesquisar
    Código: [Seleccione]
            // Remove any nested quotes.
            if (!empty($modSettings['removeNestedQuotes']))

    Trocar por
    Código: [Seleccione]
            //Remove the Hidden Content because it's only for the master post *g*
            $row['body'] = preg_replace("/\[hide\](.+?)\[\/hide\]/i", "&nbsp;", $row['body']);
            $row['body'] = preg_replace(array('~\n?\[hide.*?\].+?\[/hide\]\n?~is', '~^\n~', '~\[/hide\]~'), "&nbsp;", $row['body']);

            // Remove any nested quotes.
            if (!empty($modSettings['removeNestedQuotes']))


    Pesquisar
    Código: [Seleccione]
        $form_message = preg_replace('~<br ?/?' . '>~i', "\n", $form_message);
    Trocar por
    Código: [Seleccione]
    //Remove Hidden content... i don't need a information for this...
                $form_message = preg_replace("~\[hide\](.+?)\[\/hide\]~i", "&nbsp;", $form_message);
                $form_message = preg_replace(array('~\n?\[hide.*?\].+?\[/hide\]\n?~is', '~^\n~', '~\[/hide\]~'), "&nbsp;", $form_message);




    ./Sources/Search.php

    Pesquisar
    Código: [Seleccione]
    // Do the censor thang...
        censorText($message['body']);

    Adicionar por antes
    Código: [Seleccione]
        $message['body'] = preg_replace("/\[hide\](.+?)\[\/hide\]/i", "&nbsp;", $message['body']);
        $message['body'] = preg_replace(array('~\n?\[hide.*?\].+?\[/hide\]\n?~is', '~^\n~', '~\[/hide\]~'), "&nbsp;", $message['body']);



    ./Sources/Subs.php

    Pesquisar
    Código: [Seleccione]
    static $disabled;
    Adicionar depois
    Código: [Seleccione]
    // On the first Parsing i will gernerate all things i need ;) after that it's not needable :)
        if (!isset($modSettings['hide_preparedOption']))
        {
            // First there is nothing in it ;)
            $modSettings['hide_preparedOption']['hiddentext'] = '&nbsp;';
            $modSettings['hide_preparedOption']['unhiddentext'] = '&nbsp;';

            if (empty($modSettings['hide_noinfoforguests']) || !$user_info['is_guest'])
            {
                // Prepare the hidden information :)
                $modSettings['hide_preparedOption']['hiddentext'] = isset($modSettings['hide_hiddentext']) ? $modSettings['hide_hiddentext'] : '';
                $modSettings['hide_preparedOption']['hiddentext'] = str_replace('$language', $user_info['language'], $modSettings['hide_preparedOption']['hiddentext']);
                if (!empty($modSettings['hide_MUIswitch']) && isset($txt['hide_hiddentext']))
                    $modSettings['hide_preparedOption']['hiddentext'] = str_replace('$txtvariable', $txt['hide_hiddentext'], $modSettings['hide_preparedOption']['hiddentext']);
                if (!empty($modSettings['hide_enableHTML']))
                    $modSettings['hide_preparedOption']['hiddentext'] = un_htmlspecialchars($modSettings['hide_preparedOption']['hiddentext']);

                // Prepare the unhidden infomation?
                if (!empty($modSettings['hide_enableUnhiddenText']))
                {
                    $modSettings['hide_preparedOption']['unhiddentext'] = isset($modSettings['hide_unhiddentext']) ? $modSettings['hide_unhiddentext'] : '';
                    $modSettings['hide_preparedOption']['unhiddentext'] = str_replace('$language', $user_info['language'], $modSettings['hide_preparedOption']['unhiddentext']);
                    if (!empty($modSettings['hide_MUIswitch']) && isset($txt['hide_unhiddentext']))
                        $modSettings['hide_preparedOption']['unhiddentext'] = str_replace('$txtvariable', $txt['hide_unhiddentext'], $modSettings['hide_preparedOption']['unhiddentext']);
                    if (!empty($modSettings['hide_enableHTML']))
                        $modSettings['hide_preparedOption']['unhiddentext'] = un_htmlspecialchars($modSettings['hide_preparedOption']['unhiddentext']);
                }
            }

            // So prepare the unhidden Option for the Parser ;)
            if (!empty($modSettings['hide_useSpanTag']))
            {
                $modSettings['hide_preparedOption']['before_info'] = '<span class="hiddencontent">';
                $modSettings['hide_preparedOption']['after_info'] = '</span>';
            }
            else
            {
                $modSettings['hide_preparedOption']['before_info'] = '<div class="hiddencontent">';
                $modSettings['hide_preparedOption']['after_info'] = '</div>';
            }

            // Okay Let's see where i must put the unhidden Informations :)
            if (!empty($modSettings['hide_enableUnhiddenText']) && empty($modSettings['hide_onlyonetimeinfo']))
            {
                if (empty($modSettings['hide_posUnhiddenText']) || $modSettings['hide_posUnhiddenText'] == 4)
                    $modSettings['hide_preparedOption']['after_info'] .= $modSettings['hide_preparedOption']['unhiddentext'];
                elseif ($modSettings['hide_posUnhiddenText'] == 3)
                    $modSettings['hide_preparedOption']['after_info'] = $modSettings['hide_preparedOption']['unhiddentext'].$modSettings['hide_preparedOption']['after_info'];
                elseif ($modSettings['hide_posUnhiddenText'] == 2)
                    $modSettings['hide_preparedOption']['before_info'] .= $modSettings['hide_preparedOption']['unhiddentext'];
                elseif ($modSettings['hide_posUnhiddenText'] == 1)
                    $modSettings['hide_preparedOption']['before_info'] = $modSettings['hide_preparedOption']['unhiddentext'].$modSettings['hide_preparedOption']['before_info'];
                else
                    $modSettings['hide_preparedOption']['after_info'] .= $modSettings['hide_preparedOption']['unhiddentext'];
            }

            $modSettings['hide_preparedOption']['parse_content'] = !empty($modSettings['hide_enableUnhiddenText']) && empty($modSettings['hide_onlyonetimeinfo']);

            // Okay this is the check up if he is allowed to unhide it everytime! (Risky if wrong setup or diffrent mods can handle hide tag)
            $modSettings['hide_preparedOption']['auto_unhide_parser'] = false;
            if (!empty($modSettings['hide_unhideparser']) && !empty($modSettings['hide_autounhidegroups']))
            {
                $modSettings['hide_autounhidegroups'] = !is_array($modSettings['hide_autounhidegroups']) ? explode(',', $modSettings['hide_autounhidegroups']) : $modSettings['hide_autounhidegroups'];
                foreach ($user_info['groups'] as $group_id)
                    if (in_array($group_id, $modSettings['hide_autounhidegroups']))
                    {
                        $modSettings['hide_preparedOption']['auto_unhide_parser'] = true;
                        break; //One is enouph ;D
                    }
            }
        }

        // Hide Mod.. i remove the code before i do anything...
        if ($message !== false && !empty($message))
        {
            if ($modSettings['hide_preparedOption']['auto_unhide_parser'])
                $context['user_post_avaible'] = 1;
            // Add the Hidden Text at the end of the post :)
            if ((empty($context['user_post_avaible']) || !isset($context['user_post_avaible'])) && !empty($modSettings['hide_onlyonetimeinfo']) && hideTagExists($message, $cache_id))
                $message .= '[br]'.$modSettings['hide_preparedOption']['hiddentext'];
            // Here i remove this content :) or show onetime unhide info :)
            if (!isset($context['user_post_avaible']) || empty($context['user_post_avaible']))
            {
                // Remove it ;D
                $message = preg_replace("/\[hide\](.+?)\[\/hide\]/i", (empty($modSettings['hide_onlyonetimeinfo']) ? $modSettings['hide_preparedOption']['hiddentext'] : "&nbsp"), $message);
                $message = preg_replace(array('~\n?\[hide.*?\].+?\[/hide\]\n?~is', '~^\n~', '~\[/hide\]~'), (empty($modSettings['hide_onlyonetimeinfo']) ? $modSettings['hide_preparedOption']['hiddentext'] : "&nbsp"), $message);
            }
            // Okay i need to add the unhidden information at the end of the post :)
            elseif (!empty($context['user_post_avaible']) && !empty($modSettings['hide_onlyonetimeinfo']) && !empty($modSettings['hide_enableUnhiddenText']) && hideTagExists($message, $cache_id))
                $message .= '[br]'.$modSettings['hide_preparedOption']['unhiddentext'];
        }



    Pesquisar
    Código: [Seleccione]
         array(
                    'tag' => 'white',
                    'before' => '<span style="color: white;" class="bbc_color">',
                    'after' => '</span>',
                ),

    Adicionar depois
    Código: [Seleccione]
        array(
                    'tag' => 'hide',
                    'before' => $modSettings['hide_preparedOption']['before_info'],
                    'after' => $modSettings['hide_preparedOption']['after_info'],
                    'block_level' => true,
                ),

    Pesquisar
    Código: [Seleccione]
    // Shall we take the time to cache this?

    Trocar por
    Código: [Seleccione]
    //So i parse now the unhidden bbc code one time ;)
        if($modSettings['hide_preparedOption']['parse_content']) {
            $modSettings['hide_preparedOption']['parse_content'] = false;
            if(isset($bbc_codes['h'])) {
                foreach($bbc_codes['h'] as $key => $item) {
                    if($item['tag'] == 'hide') {
                        $bbc_codes['h'][$key]['before'] = parse_bbc($item['before']);
                        $bbc_codes['h'][$key]['after'] = parse_bbc($item['after']);
                        break;
                    }
                }
            }
        }

        // Shall we take the time to cache this?

    Pesquisar
    Código: [Seleccione]
       // Cleanup whitespace.
        $message = strtr($message, array('  ' => ' &nbsp;', "\r" => '', "\n" => '<br />', '<br /> ' => '<br />&nbsp;', '' => "\n"));

    Trocar por
    Código: [Seleccione]
       // Cleanup whitespace.
        $message = strtr($message, array('  ' => ' &nbsp;', "\r" => '', "\n" => '<br />', '<br /> ' => '<br />&nbsp;', '' => "\n"));

        //Clean up some missing removed hide close tags... Hide Tags can not disabled!
        //If you don't like to reomve this tags, insert in the settings the value hide_doNotRemoveHideTag
        if(empty($modSettings['hide_doNotRemoveHideTag'])) {
            if(preg_match("/\[\/hide\]/i", $message) != 0)
                $message = preg_replace("/\[\/hide\]/i", '', $message);
            if(preg_match("/\[\hide\]/i", $message) != 0)
                $message = preg_replace("/\[\hide\]/i", '', $message);
        }



    Pesquisar
    Código: [Seleccione]
    // Generate a random seed and ensure it's stored in settings.
    Trocar por
    Código: [Seleccione]
    // Check if an hide tag exists inside the message
    function hideTagExists($message, $cache_id = '')
    {
        static $chached_tags = array();

        if (empty($message))
            return false;

        // Cashed data? (I need not check it twice)
        if (!empty($cache_id) && isset($chached_tags[$cache_id]))
            return $chached_tags[$cache_id];
        // Store the last data into the cache ;)
        elseif (empty($cache_id))
            $cache_id = 'last';

        // Check if the hidden content exist
        $chached_tags[$cache_id] = preg_match("/\[hide\](.+?)\[\/hide\]/i", $message) != 0 || preg_match("/\[hide(.+?)\](.+?)\[\/hide\]/i", $message) != 0;
        return $chached_tags[$cache_id];
    }

    // Generate a random seed and ensure it's stored in settings.


    ./Themes/default/Admin.template.php

    Pesquisar
    Código: [Seleccione]
    function template_modify_language_entries()
    trocar por
    Código: [Seleccione]
    // Template for editing hide tag special settings.
    function template_edit_hidetagspecial_settings()
    {
        global $context, $settings, $options, $txt, $scripturl, $modSettings;

        echo '
        <form name="hidesettings" action="'.$context['post_url'].'" method="post" accept-charset="', $context['character_set'], '">
            <table border="0" cellspacing="0" cellpadding="4" align="center" width="80%" class="tborder">
                <tr class="titlebg">
                    <td colspan="2">', $txt['manageposts_hidetagspecial_settings_title'], '</td>
                </tr>
                <tr class="windowbg2">
                    <th width="50%" align="right">
                        <label for="hide_MUIswitch_check">', $txt['hide_MUIswitch'], '</label> <span style="font-weight: normal;">(<a href="', $scripturl, '?action=helpadmin;help=hide_MUIswitch_help" onclick="return reqWin(this.href);">?</a>)</span>:
                    </th>
                    <td valign="top">
                        <input type="checkbox" name="hide_MUIswitch" id="hide_MUIswitch_check"', empty($modSettings['hide_MUIswitch']) ? '' : ' checked="checked"', ' class="check" />
                    </td>
                </tr>
                <tr class="windowbg2">
                    <th width="50%" align="right">
                        <label for="hide_enableHTML_check">', $txt['hide_enableHTML'], ':<br />
                        <span class="smalltext" style="font-weight: normal;">'.$txt['hide_enableHTML_help'].'</span></label>
                    </th>
                    <td valign="top">
                        <input type="checkbox" name="hide_enableHTML" id="hide_enableHTML_check"', empty($modSettings['hide_enableHTML']) ? '' : ' checked="checked"', ' class="check" />
                    </td>
                </tr>
                <tr class="windowbg2">
                    <th width="50%" align="right">
                        <label for="hide_useSpanTag_check">', $txt['hide_useSpanTag'], '</label> <span style="font-weight: normal;">(<a href="', $scripturl, '?action=helpadmin;help=hide_useSpanTag_help" onclick="return reqWin(this.href);">?</a>)</span>:
                    </th>
                    <td valign="top">
                        <input type="checkbox" name="hide_useSpanTag" id="hide_useSpanTag_check"', empty($modSettings['hide_useSpanTag']) ? '' : ' checked="checked"', ' class="check" />
                    </td>
                </tr>
                <tr class="windowbg2">
                    <th width="50%" align="right">
                        <label for="hide_enableUnhiddenText_check">', $txt['hide_enableUnhiddenText'], ':  <span style="font-weight: normal;">(<a href="', $scripturl, '?action=helpadmin;help=hide_unhiddentext_help" onclick="return reqWin(this.href);">?</a>)</span>
                    </th>
                    <td valign="top">
                        <input type="checkbox" name="hide_enableUnhiddenText" id="hide_enableUnhiddenText_check"', empty($modSettings['hide_enableUnhiddenText']) ? '' : ' checked="checked"', ' class="check" />
                    </td>
                </tr>
                <tr class="windowbg2">
                    <td colspan="2"><hr /></td>
                </tr>
                <tr class="windowbg2">
                    <th width="50%" align="right">
                        <label for="hide_hiddentext_textarea">', $txt['hide_hiddentext'], ' <span style="font-weight: normal;">(<a href="', $scripturl, '?action=helpadmin;help=hide_text_help" onclick="return reqWin(this.href);">?</a>)</span>:<br />
                        <span class="smalltext" style="font-weight: normal;">'.$txt['hide_hiddentext_help'].'</span></label>
                    </th>
                    <td valign="top">
                        <textarea name="hide_hiddentext" id="hide_hiddentext_textarea" cols="40" rows="8">', (empty($modSettings['hide_hiddentext']) ? '' : $modSettings['hide_hiddentext']), '</textarea>
                    </td>
                </tr>
                <tr class="windowbg2">
                    <th width="50%" align="right">
                        <label for="hide_unhiddentext_textarea">', $txt['hide_unhiddentext'], ' <span style="font-weight: normal;">(<a href="', $scripturl, '?action=helpadmin;help=hide_text_help" onclick="return reqWin(this.href);">?</a>)</span>:<br />
                        <span class="smalltext" style="font-weight: normal;">'.$txt['hide_hiddentext_help'].'</span></label>
                    </th>
                    <td valign="top">
                        <textarea name="hide_unhiddentext" id="hide_unhiddentext_textarea" cols="40" rows="8">', (empty($modSettings['hide_unhiddentext']) ? '' : $modSettings['hide_unhiddentext']), '</textarea>
                    </td>
                </tr>
                <tr class="windowbg2">
                    <th width="50%" align="right">
                        <label for="hide_posUnhiddenText_select">', $txt['hide_posUnhiddenText'], '</label> <span style="font-weight: normal;">(<a href="', $scripturl, '?action=helpadmin;help=hide_posUnhiddenText_help" onclick="return reqWin(this.href);">?</a>)</span>:
                    </th>
                    <td valign="top">
                        <select name="hide_posUnhiddenText" id="hide_posUnhiddenText_select" class="select">
                            <option value="1"', $modSettings['hide_posUnhiddenText'] == 1 ? ' selected="selected"' : '', '>', $txt['hide_posUnhiddenOption1'], '</option>
                            <option value="2"', $modSettings['hide_posUnhiddenText'] == 2 ? ' selected="selected"' : '', '>', $txt['hide_posUnhiddenOption2'], '</option>
                            <option value="3"', $modSettings['hide_posUnhiddenText'] == 3 ? ' selected="selected"' : '', '>', $txt['hide_posUnhiddenOption3'], '</option>
                            <option value="4"', $modSettings['hide_posUnhiddenText'] == 4 ? ' selected="selected"' : '', '>', $txt['hide_posUnhiddenOption4'], '</option>
                        </select>
                    </td>
                </tr>
                <tr class="windowbg2">
                    <th width="50%" align="right">
                        <label for="hide_onlyonetimeinfo_check">', $txt['hide_onlyonetimeinfo'], ':<br />
                        <span class="smalltext" style="font-weight: normal;">'.$txt['hide_onlyonetimeinfo_help'].'</span></label>
                    </th>
                    <td valign="top">
                        <input type="checkbox" name="hide_onlyonetimeinfo" id="hide_onlyonetimeinfo_check"', empty($modSettings['hide_onlyonetimeinfo']) ? '' : ' checked="checked"', ' class="check" />
                    </td>
                </tr>
                <tr class="windowbg2">
                    <th width="50%" align="right">
                        <label for="hide_noinfoforguests_check">', $txt['hide_noinfoforguests'], '</label>:
                    </th>
                    <td valign="top">
                        <input type="checkbox" name="hide_noinfoforguests" id="hide_noinfoforguests_check"', empty($modSettings['hide_noinfoforguests']) ? '' : ' checked="checked"', ' class="check" />
                    </td>
                </tr>
                <tr class="windowbg2">
                    <td colspan="2"><hr /></td>
                </tr>
                <tr class="windowbg2">
                    <th width="50%" align="right" valign="top">
                        <label for="hide_autounhidegroups_input" onclick="return openAutoUnhideGroupsList();">', $txt['hide_autounhidegroups'], '</lable>:
                    </th>
                    <td valign="top" align="left"><a href="#allowedAutoUnhideGroupsList" onclick="return openAutoUnhideGroupsList();">'.$txt['mboards_groups'].'</a><br />
                        <div id="allowedAutoUnhideGroupsList" style="display:block;">';

        // List all the membergroups so the user can choose who may access this board.
        foreach ($context['groups'] as $group)
            echo '
                            <label for="groups_', $group['id'], '"><input type="checkbox" name="hide_autounhidegroups[]" value="', $group['id'], '" id="groups_', $group['id'], '"', $group['checked'] ? ' checked="checked"' : '', ' /> <span', $group['is_post_group'] ? ' style="border-bottom: 1px dotted;" title="' . $txt['mboards_groups_post_group'] . '"' : '', '>', $group['name'], '</span></label><br />';
        echo '
                            <i>', $txt['check_all'], '</i> <input type="checkbox" onclick="invertAll(this, this.form, \'hide_autounhidegroups[]\');" /><br />
                            <br /></div>
        <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
            //This Skript is only for Opening and Closing the group select list
            var allowedFlashGroupListStatus = false;
           
            function openAutoUnhideGroupsList()
            {
                if(allowedFlashGroupListStatus)
                {
                    allowedFlashGroupListStatus = false;
                    document.getElementById("allowedAutoUnhideGroupsList").style.display = "block";
                }
                else
                {
                    allowedFlashGroupListStatus = true;
                    document.getElementById("allowedAutoUnhideGroupsList").style.display = "none";
                }
                return false;
            }
        // ]]></script>

                        </td>
                    </tr>
                <tr class="windowbg2">
                    <th width="50%" align="right">
                        <label for="hide_unhideparser_check">', $txt['hide_unhideparser'], ':<br />
                        <span class="smalltext" style="font-weight: normal;">'.$txt['hide_unhideparser_help'].'</span></label>
                    </th>
                    <td valign="top">
                        <input type="checkbox" name="hide_unhideparser" id="hide_unhideparser_check"', empty($modSettings['hide_unhideparser']) ? '' : ' checked="checked"', ' class="check" />
                    </td>
                </tr>
                <tr class="windowbg2">
                    <th width="50%" align="right">
                        <label for="hide_minpostunhide_input">', $txt['hide_minpostunhide'], '</label>:
                    </th>
                    <td valign="top">
                        <input type="text" name="hide_minpostunhide" id="hide_minpostunhide_input" value="', (empty($modSettings['hide_minpostunhide']) ? '0' : $modSettings['hide_minpostunhide']), '" class="check" />
                    </td>
                </tr>
                <tr class="windowbg2">
                    <th width="50%" align="right">
                        <label for="hide_minpostautounhide_input">', $txt['hide_minpostautounhide'], ':<br />
                        <span class="smalltext" style="font-weight: normal;">'.$txt['hide_minpostautounhide_help'].'</span></label>
                    </th>
                    <td valign="top">
                        <input type="text" name="hide_minpostautounhide" id="hide_minpostautounhide_input" value="', (empty($modSettings['hide_minpostautounhide']) ? '0' : $modSettings['hide_minpostautounhide']), '" class="check" />
                    </td>
                </tr>
                <tr class="windowbg2">
                    <td colspan="2"><hr /></td>
                </tr>
                <tr class="windowbg2">
                    <th width="50%" align="right">
                        <label for="hide_unhideunlockedtopic_check">', $txt['hide_unhideunlockedtopic'], ':<br /></label>
                    </th>
                    <td valign="top">
                        <input type="checkbox" name="hide_unhideunlockedtopic" id="hide_unhideunlockedtopic_check"', empty($modSettings['hide_unhideunlockedtopic']) ? '' : ' checked="checked"', ' class="check" />
                    </td>
                </tr>
                <tr class="windowbg2">
                    <th width="50%" align="right" valign="top">
                        <label for="hide_unhideunlockedtopicgroups_input" onclick="return openAutoUnhideLockedTopicGroupsList();">', $txt['hide_unhideunlockedtopicgroups'], '</lable>:
                    </th>
                    <td valign="top" align="left"><a href="#allowedAutoUnhideLockedTopicGroupsList" onclick="return openAutoUnhideLockedTopicGroupsList();">'.$txt['mboards_groups'].'</a><br />
                        <div id="allowedAutoUnhideLockedTopicGroupsList" style="display:block;">';

        // List all the membergroups so the user can choose who may see the content of locked topics
        foreach ($context['groups'] as $group)
            echo '
                            <label for="groups_', $group['id'], '"><input type="checkbox" name="hide_unhideunlockedtopicgroups[]" value="', $group['id'], '" id="groups_', $group['id'], '"', $group['checked_2'] ? ' checked="checked"' : '', ' /> <span', $group['is_post_group'] ? ' style="border-bottom: 1px dotted;" title="' . $txt['mboards_groups_post_group'] . '"' : '', '>', $group['name'], '</span></label><br />';
        echo '
                  &n
    « Última modificação: 10 de Abril de 2011, 10:57 por candidosa2 »

     


    Facebook Comentários