176

(6 replies, posted in PunBB 1.2 troubleshooting)

minis wrote:

I saw this before, but how remove [b]TITLE/b]?

This should take care of it:

#brdtitle span { display: none }

177

(6 replies, posted in PunBB 1.2 troubleshooting)

http://punres.org/doku.php?id=dev:style … go_via_css

As the title suggests, I'm having some absolute positioning woes with IE.

To explain what I'm trying to do, consider the following two screens from a PunBB style/theme I'm working on:

In Opera (and FF, Safari etc.):
http://img54.imageshack.us/img54/3707/correct5lq.th.jpg

Notice how the absolute positioned menu at the top goes all the way from left -> right?

Well, then look at a IE6 screenshot:
http://img57.imageshack.us/img57/7352/ie1sf.th.jpg

Then, here's an extract of the CSS relevant to the positioning:

#punwrap { margin: 158px 20px 20px 20px }
.pun #brdmenu {
    position: absolute;
    left:0;
    top:0;
    right:0;
}

See, this would work in any *real* browser, but of course, IE doesn't play along (and don't even get me started on the IE7 beta!). Adding width:100% to the .pun #brdmenu block improves thing a bit, but not entirely (IE still positions it relative to #punwrap, something it shouldn't). Of course, removing the margins from #punwrap would solve it, but that's not what I'm looking for. Surely, using absolute positioning on a element should remove it from the "regular" flow of the document?

Anyone have any good suggestions on how to solve this, without having to move the menu block outside #punwrap in the .tpl (something which would kinda mess up the structure for non-css browsers)?

Any input would be greatly appreciated smile

179

(4 replies, posted in PunBB 1.2 discussion)

This should take care of the offline/online text

div.postfootleft { text-align:center }

180

(2 replies, posted in PunBB 1.2 discussion)

You're not importing the .css with colours in it. Change this line in ArmyGreen.css, from:

/* Import the colour scheme */
@import url(imports/spinkbb_cs.css)

to:

/* Import the colour scheme */
@import url(imports/ArmyGreen_cs.css)

I usually prefer the .patch files. It makes life a lot easier, and the upgrade can usually be done if a minute or two, even if the forum is heavily modified smile

182

(9 replies, posted in Programming)

Loved this script so much that I integrated it into PunBB's BBCode.. Works really well smile

Example: http://www.thesecondscreen.com/viewtopic.php?pid=23#p23

183

(2 replies, posted in PunBB 1.2 troubleshooting)

What you *could* do, is cache the images locally, and resize them using PHP. It's quite easy to do, and would kinda solve the problem, but it does have some drawbacks.

starshiner wrote:

I have the same question as dss....  has it been answered that anyone knows of?

I haven't implemented that function (yet?). I started working on it at one point, but due to lack of time, I never completed it... Should be fairly easy to do though, if someone wanted to.

Here's a fix for the broken smiley images...

Instead of adding the code listed in the read_me.txt file, use the following:

REPLACEMENT TEXT FOR STEP 10 & 13:

<?php endif; ?>                        <label for="req_message"><strong><?php echo $lang_common['Message'] ?></strong></label>
                        <textarea name="req_message" id="req_message" rows="20" cols="95" tabindex="<?php echo $cur_index++ ?>"><?php echo isset($_POST['req_message']) ? pun_htmlspecialchars($message) : (isset($quote) ? $quote : ''); ?></textarea>

<?php
// Display the smiley set
@include_once PUN_ROOT.'cache/cache_smilies.php';
if (!defined('PUN_CACHE_SMILEY'))
{
    require_once PUN_ROOT.'include/cache_smilies.php';
    generate_smiley_cache();
    require PUN_ROOT.'cache/cache_smilies.php';
}

// Most of the loop was taken from Rickards mod_easy_bbcode.php
$smiley_dups = array();
$num_smilies = count($smiley_text);

for ($i = 0; $i < $num_smilies; ++$i)
{
    // Is there a smiley at the current index?
    if (!isset($smiley_text[$i]))
        continue;

    if (in_array($smiley_img[$i], $smiley_dups)) {
            // Unset duplicate entries
            unset($smiley_text[$i]);
            unset($smiley_img[$i]);
    }

    $smiley_dups[] = $smiley_img[$i];
}

// Re-index the arrays
$smiley_text = array_values($smiley_text);
$smiley_img = array_values($smiley_img);
?>
<script type="text/javascript" src="js/toolbar.js"></script>
<noscript><div><strong>Please enable javascript to activate the text formatting tools</strong></div></noscript>
<script type="text/javascript">

    function popup_color_picker()
    {
        document.getElementById('req_message').focus();
        var width = 400;
        var height = 230;
        window.open('color_picker.php', 'cp', 'alwaysRaised=yes, dependent=yes, resizable=no, location=no, width='
                    +width+', height='+height+', menubar=no, status=yes, scrollbars=no, menubar=no');
    }

    function popup_smilies()
    {
        document.getElementById('req_message').focus();
        var width = 120;
        var height = 150;
        window.open('smilies.php', 'smilies', 'alwaysRaised=yes, dependent=yes, resizable=yes, location=no, width='
                    +width+', height='+height+', menubar=no, status=yes, scrollbars=yes, menubar=no');
    }

    var smiliesTxt = new Array();
    var smiliesImg = new Array();
<?php
$stop = count($smiley_text);
for ($i = 0; $i < $stop; ++$i)
{
    if($i < 10) {
        echo "\t".'smiliesTxt['.$i.'] = "'.$smiley_text[$i].'";'."\n";
        echo "\t".'smiliesImg['.$i.'] = "'.$smiley_img[$i].'";'."\n";
    } else {
        $more_smilies = 1;
    }
}
?>
    if (document.getElementById)
    {
        var tb = new toolBar(document.getElementById('req_message'),'img/bt/','img/smilies/');

        tb.btStrong('<?php echo str_replace("'","\'",$lang_common['btStrong']); ?>');
        tb.btEm('<?php echo str_replace("'","\'",$lang_common['btEm']); ?>');
        tb.btIns('<?php echo str_replace("'","\'",$lang_common['btIns']); ?>');
        tb.btDel('<?php echo str_replace("'","\'",$lang_common['btDel']); ?>');
        tb.btQ('<?php echo str_replace("'","\'",$lang_common['btQ']); ?>');
        tb.btCode('<?php echo str_replace("'","\'",$lang_common['btCode']); ?>');
        tb.btAcronym(
            '<?php echo str_replace("'","\'",$lang_common['btAcronym']); ?>',
            '<?php echo str_replace("'","\'",$lang_common['btAcronymMsg']); ?>',
            '<?php echo str_replace("'","\'",$lang_common['btAcronymAcr']); ?>'
            );
        tb.btColor('<?php echo str_replace("'","\'",$lang_common['btColor']); ?>');
        tb.addSpace(10);
        tb.btBquote('<?php echo str_replace("'","\'",$lang_common['btBquote']); ?>');
        tb.btPre('<?php echo str_replace("'","\'",$lang_common['btPre']); ?>');
        tb.btHr('<?php echo str_replace("'","\'",$lang_common['btHr']); ?>');
        tb.addSpace(10);
        tb.btLink(
            '<?php echo str_replace("'","\'",$lang_common['btLink']); ?>',
            '<?php echo str_replace("'","\'",$lang_common['btLinkUrl']); ?>',
            '<?php echo str_replace("'","\'",$lang_common['btLinkText']); ?>'
            );
        tb.btImgLink(
            '<?php echo str_replace("'","\'",$lang_common['btImgLink']); ?>',
            '<?php echo str_replace("'","\'",$lang_common['btImgLinkUrl']); ?>');
        tb.addSpace(10);
        tb.btEmail(
            '<?php echo str_replace("'","\'",$lang_common['btEmail']); ?>',
            '<?php echo str_replace("'","\'",$lang_common['btEmailAdr']); ?>',
            '<?php echo str_replace("'","\'",$lang_common['btEmailText']); ?>'
            );
        tb.btNospam(
            '<?php echo str_replace("'","\'",$lang_common['btNospam']); ?>',
            '<?php echo str_replace("'","\'",$lang_common['btNospamAdr']); ?>',
            '<?php echo str_replace("'","\'",$lang_common['btNospamText']); ?>'
            );
        tb.addSpace(10);
        tb.btSmilies('<?php echo str_replace("'","\'",$lang_common['btSmilies']); ?>');
        tb.barSmilies(smiliesTxt,smiliesImg);
        tb.draw();
        <?php if ($more_smilies) echo 'tb.moreSmilies(\''.
        str_replace("'","\'",$lang_common['moreSmilies']).
        '\');'; ?>
    }
</script>

EDIT:

You may want to replace the your smilies.php, with this one: [Download]

Been looking through the mod a little, and made a few changes (none important ones though). Here's a couple I thought could be useful for some:

- A minor change to the toolbar.js, enabling you to highlight an url or image in the text area, and get that value as default (same way as the acronym function) for the img & url button.
Changed file here: download

- Also, I rewrote some of the common.php language additions, to be a little more descriptive etc.: Changes here

thesaint wrote:

jups a BBcode would be great...

See this post: link...

188

(9 replies, posted in PunBB 1.2 discussion)

p314 wrote:

Hi CodexXP !

I don't understand why there is a code block MD5 hash in common.php and functions.php ???
How do I know if this mod works on my forum, there is nothing in my footer ?

Do this mod blocks the ip's proxy ?

thanks smile

That's because I never posted the footer part, as I didn't see the need at the time wink

If you want it, here's how to add it.

1. Open functions.php, and add at the bottom:

function spam_stat()
{
  global $db;

  $result = $db->query('SELECT COUNT(ip) AS numrows FROM '.$db->prefix.'spam_protect WHERE blocked=\'1\'')  or error('Unable to get spam protection', __FILE__, __LINE__, $db->error());
    list($count) = $db->fetch_row($result);

    if(!$count)
            $count = 0;

  echo '<br />SPAM Protection » Currently blocked IPs: <strong>'.$count.'</strong>';
}

2. Open footer.php, and replace (line 109):

            <p class="conr">Powered by <a href="http://punbb.org/">PunBB</a><?php if ($pun_config['o_show_version'] == '1') echo ' '.$pun_config['o_cur_version']; ?><br />© Copyright 2002–2005 Rickard Andersson</p>

with:

            <p class="conr">Powered by <a href="http://punbb.org/">PunBB</a><?php if ($pun_config['o_show_version'] == '1') echo ' '.$pun_config['o_cur_version']; ?><br />© Copyright 2002–2005 Rickard Andersson<?php spam_stat(); ?></p>

That's it smile

Also, yes, it should and will block the proxy server, if it's listed in the spamhaus database.

Oh, about the MD5 blocks... Well, they're not really needed, I just added them as a quick way to verify if people had modified the files correctly. Let's say someone had problems after installing it, I could just ask them to check the MD5 of the code block, using the plugin in the admin CP. If that check failed, I'd know they did something wrong wink

Looking really good!

There are some fixes needed though.. First, in the english smilies.php lang file, line 51 & 52 are incorrect. Change them from:

'Must int'                    =>    'Position must be an integer.'
'Positions changed'            =>    'Positions successfully changed. Redirecting ...',

to

'Must int'                    =>    'Position must be an integer.',
'Positions changed'            =>    'Positions successfully changed. Redirecting ...'

I'm still testing, so I'll let you know if I encounter any more errors. Great work so far though! smile

EDIT:
Also, the clickable smiley row doesn't work as expected. It returns 10 smileys, no matter how many are added. What I mean is, if you don't add any trough the plugin, it'll return 10 missing images, pointing to your img folder.

Another thing, though it's not really an error as much as an overlook. The [---] (<hr />) tag should be changed so that it returns </p><hr /><p>. The reason is that otherwise, the document won't validate.

190

(13 replies, posted in PunBB 1.2 bug reports)

Odis wrote:

works nicely.  How can I do a wildcard in it though?  something like

regexp:/f*u*c*k/i

You could do it like this:

regexp:/f.*u.*c.*k/i

(dot matches any chars that is not a line-break, followed by a * which indicates that it's continue searching until a match for the next char is found.)

Although, that would create problems...as it will continue searching *all* the text until a match is found. A better solution would be:

regexp:/f.{0,7}u.{0,7}c.{0,7}k/i

This wil make sure that when the letter F is found, it'll look from 0 to 7 chars forward for the next letter C, and so on. Just replace the number 7 with whatever you want the maximum to be. Don't set it to high though smile

191

(13 replies, posted in PunBB 1.2 bug reports)

Yes, although, you don't want to add *just* regexp: wink

Here's a very simplistic example, that you could add in the censor word box, to do an case-insensitive search for PunBB:

regexp:/PunBB/i

Easy, yet quite effective.


EDIT: A better example would be how to solve the problem described in this topic.

Censored word:

regexp:/\s([\?:;!])/

EDIT 2: Damnit, this forum messed up the replacement text when in a code tag, but ok, as the replacement text, enter the following, without the spaces: & # 160;$1

What's your base url set to in admin_options.php?

193

(13 replies, posted in PunBB 1.2 bug reports)

I've been playing around with this a little bit lately, and I found the following to be a good solution:

In functions.php, replace:

            $search_for[$i] = '/\b('.str_replace('\*', '\w*?', preg_quote($search_for[$i], '/')).')\b/i';

with:

            $search_for[$i] = ( substr($search_for[$i], 0, 7) == 'regexp:' ) ? substr($search_for[$i], 7) : '/\b('.str_replace('\*', '\w*?', preg_quote($search_for[$i], '/')).')\b/i';

This would allow you to use both the regular PunBB word replacement, and regular expressions. Simply add regexp: before the word to censor, and the exact regexp you enter after the : will be executed smile

194

(7 replies, posted in PunBB 1.2 bug reports)

It does work, but make sure that you actually enable "censor words" in admin_options.php. Also, the word filter in PunBB is case-sensitive.

If you downloaded this version before 19.54 GMT+1 (or before the "last edited" timestamp on this post), I'd advice you to re-download, as I've fixed a bug related to changing the default working directory. The archive have been updated.

Updated version 1.1.2 available here:
http://www.thesecondscreen.com/files/ap … _1.1.2.zip


New in this release:
- Several bug-fixes.
- Some code optimization

196

(9 replies, posted in PunBB 1.2 discussion)

p314 wrote:

thank you smile

@CodecXP: what means "Currently blocked IPs: 18" in the footer in your forum ? it's a mod ?

Yeah, it's related to the spam protection mod that pogenwurst linked to smile

197

(9 replies, posted in PunBB 1.2 discussion)

There's no need for a mod, or moving the files to a specific directory. Just add the following to a .htaccess file in the PunBB root directory:

<Filesmatch "^admin_.*\.php$">
    AuthType Basic
    AuthName "PunBB's admin section requires a valid username and password"
    AuthUserFile /enter/path/to/your/.htpasswd
    require valid-user
</Filesmatch>

Remember to change the path for AuthUserFile smile

This would probably help you out a bit: http://punbb.org/docs/faq.html#faq2_7

Didn't want to post this in the feature requests, as it's not really a feature as such. Still, I think it would be a good idea to change the dump() function a little. I use it quite extensively when modding, and the results may often include HTML code. This of course makes it a little hard to read, as the results ends up being parsed by the browser.

What I'm suggesting is a change from:

//
// Dump contents of variable(s)
//
function dump()
{
    echo '<pre>';

    $num_args = func_num_args();

    for ($i = 0; $i < $num_args; ++$i)
    {
        print_r(func_get_arg($i));
        echo "\n\n";
    }

    echo '</pre>';
    exit;
}

to something like this:

//
// Dump contents of a variable
//

function dump() {

    @ob_end_flush();

    echo '<pre>';

    ob_start();

    $num_args = func_num_args();

    for ($i = 0; $i < $num_args; ++$i)
    {
        print_r(func_get_arg($i));
        echo "\n\n";
    }

    $todump = ob_get_contents();
    ob_end_clean();

    echo pun_htmlspecialchars($todump).'</pre>';

    exit;
}

200

(4 replies, posted in Feature requests)

Perhaps a "search BBCode" could be a viable alternative?