1

(16 replies, posted in PunBB 1.3 troubleshooting)

MattF wrote:

altering the function which updates prev_url to only ignore certain pages when updating the DB online entry.

Yes, though a whitelist could become long and be laborious to compile.  A simple first sollution could be a preg_match() check for file extension (disallow images, .css, .xml), then give admin settings a data entry for comma-separated directory names.  Pair that with a function which explodes(",") the CSV line to an array of preg_match patterns.

2

(16 replies, posted in PunBB 1.3 troubleshooting)

Similar to this, I have occasionally been redirected by PunBB login to other files on my server.  These are usually the last file loaded as a dependent of the last page I browsed on that server, prior to or during the login sequence.

So that is to say, on the same server:
1. Browse other page with includes/common.php included.
2. Request PunBB Login page.
3. Browse other page with includes/common.php included.
4. Complete Login form.

In this case, you just might have reset the page redirect url in your cookie, thus you are sent there.  Is it possible that Firefox is causing this same event, by pinging for updates to your forum RSS?

KeyDog wrote:

Is there some way to auto insert the actual size of the smiley instead of using the fixed 15x15 all over the place?

I addressed that in my other posts on the subject, in the extensions forum.  My extension & related modifications fixed that for bar.php and parser.php, the same steps would fix help.php

4

(1 replies, posted in PunBB 1.3 additions)

Thanks for that, I hadn't encountered PmWiki yet.  It certainly looks relevant to our interests here. smile

5

(4 replies, posted in Feature requests)

Read more. tongue

6

(4 replies, posted in Feature requests)

Search extensions forum for "bbcode", and follow our examples for adding BBCode tags.  You want to add [spoiler][/spoiler]

I separated the bar.php modification from this thread, to [Release] Smiley Browser (JavaScripted scrolling smilies list).

I also updated this extension to 0.1.4, in opening post.

This is a modification of the PunBB 1.3.2 extension "BBCode Buttons", version 1.2.1 bar.php, thus has no hook to extend.  We wouldn't want a hook anyway, because we need to replace code.

/forum/extensions/pun_bbcode/bar.php
At Line 56 we see:

foreach ($tags as $filename => $tag)
{

...

}

This foreach() will end at Line 79, and continues through building a list of smilies in <img> tags.  After the previously mentioned foreach() loop, we want to replace the remainder of the file beginning at Line 81.

Line 81, to EOF:

/**
 * Smiley Browser.
 * Build a scrolling list of the available smilies.
 *
 * @author whatrevolution - http://www.honestlyillustrated.com
 * @license GPL - http://www.gnu.org/copyleft/gpl.html
 * @package honest_quick_smilies
 */
 
// Setup values for smiley set
$smilies = array_unique($smilies);
$smile_count = count($smilies);
$smile_limit = 5;
$smile_index = 0;
?>
      </div>

      <script type="text/javascript">
        smile_img = new Image();
        smile_img_new = new Image();

        smile_count = <?php echo $smile_count; ?>;

        var smile_index = new Array();
        var i = <?php echo $smile_index; ?>;
        var limit = <?php echo $smile_limit; ?>;
        while (i <= limit) {
          smile_index[i] = i;
          i++;
        }

        var smilies = new Array();
        var smilies_text = new Array();

        smilies_text.push(<?php
foreach ($smilies as $smile_text => $smile_file) {
  echo '"'.$smile_text.'", ';
}
?>"");

        smilies.push(<?php
foreach ($smilies as $smile_text => $smile_file) {
  echo '"'.$smile_file.'", ';
}
?>"");

        function bbCodePreview(i) {
          if (i != 'none') {
            preview = "URL("+document.getElementById('smile-'+i).src+") no-repeat center center";
            txt = 'Click to insert '+document.getElementById('smile-'+i).alt+' at text cursor.';
          }
          else {
            preview = "none";
            txt = '';
          }
          document.getElementById('pun_bbcode_smile_preview').style.background = preview;
          document.getElementById('pun_bbcode_smile_text').innerHTML = txt;
        }

        function bbCodeToggle(change) {
          var c = <?php echo $smile_index; ?>;
          var limit = <?php echo $smile_limit; ?>;
          while (limit) {
            var changed = eval(smile_index[c]+change);
            if (changed < 0) {
              changed = eval(changed+smile_count);
            } else if (changed > eval(smile_count-1)) {
              changed = eval(changed-smile_count);
            }

            smile_index[c] = changed;

            smile_img_new.src = '<?php echo $base_url; ?>/img/smilies/'+smilies[smile_index[c]];

            if ( !smile_img.src || (smile_img_new.src != smile_img.src) ) {
              document.getElementById('smile-'+c).src = smile_img_new.src;
              document.getElementById('smile-'+c).alt = smilies_text[smile_index[c]];
              limit--;
            }
            c++;
          }
          // This will show you the image index
          //document.getElementById('pun_bbcode_smile_text').innerHTML = change+' :: '+smile_index[0]+' : '+smile_index[1]+' : '+smile_index[2]+' : '+smile_index[3]+' : '+smile_index[4]+' : '+smile_index[5]+' : '+smile_index[6]+' : '+smile_index[7]+' : '+smile_index[8]+' : '+smile_index[9];
        }
      </script>

      <div id="pun_bbcode_smile_preview">
        &nbsp;
      </div>

      <div id="pun_bbcode_smilies">
        <h4>Smiley Browser <noscript>(requires JavaScript)</noscript></h4>
        <div id="pun_bbcode_smilies_list">
          <a href="javascript:bbCodeToggle('-1')">&lt;&lt;&lt;</a>
<?php
// Display the smiley set
foreach ($smilies as $smile_text => $smile_file) {
  echo '<a onMouseOver="bbCodePreview(\''.$smile_index.'\')" onMouseOut="bbCodePreview(\'none\')" href="javascript:insert_text(smilies_text[smile_index['.$smile_index.']]+\' \', \'\');" tabindex="'.($tabindex--).'"><img id="smile-'.$smile_index.'" src="'.$base_url.'/img/smilies/'.$smile_file.'" alt="'.$smile_text.'" /></a>'."\n";
  $smile_index++;
  if ($smile_index >= $smile_limit) break;
}
?>          <a href="javascript:bbCodeToggle('+1')">&gt;&gt;&gt;</a>
        </div>
      </div>
      <span id="pun_bbcode_smile_text" style="clear:both;">
        &nbsp;
      </span>
    </div>
  </div>

This change provides a left and right arrow, which scrolls a limited list of images from the $smilies array.  Left is -1, Right is +1 to the indexed list.  The list wraps onto itself in a loop.

The result resembles this:
http://www.honestlyillustrated.com/off-site/screenshots/punbb_smiley_browser_1.png

Now you want to style those new elements by doing something like this in StyleName_cs.css:

.brd #pun_bbcode_smilies {
  position: relative;
  right: 5px; top:5px;
  width:auto; height:auto;
  text-align: center;
}

.brd #pun_bbcode_smilies a > img {
  width:15px; height:15px;
}

.brd #pun_bbcode_smilies > h4 {
  border-bottom: 1px solid #700000;
  margin: 0; padding: .1em .1em .5em .1em;
  font-size: 11pt;
  text-align: center;
}

.brd #pun_bbcode_smilies > h4 > noscript {
  font-size: .6em;
  font-weight: bold;
}

.brd #pun_bbcode_smilies_list {
  background: #280000;
  border: 2px solid #700000;
  border-width: 0 1px 1px 1px;
  margin: 0; padding: .25em .1em;
  text-align: center;
}

.brd #pun_bbcode_smile_preview {
  border:1px solid #911;
  float:right;
  width:75px;height:75px;
}

.brd #pun_bbcode_smile_text {
  display: block;
  float: left;
  height: 1.5em;
  padding: .1em;
}

I get this result:
http://www.honestlyillustrated.com/off-site/screenshots/punbb_smiley_browser_2.png

Now install my Quick Smilies extension, to have all of your smilies added to this interactive list, automagically.

The combined result will be:
http://www.honestlyillustrated.com/off-site/screenshots/honest_quick_smilies_0.1.4.png

9

(18 replies, posted in Feature requests)

An answer to this would be excellent. big_smile

10

(1 replies, posted in Discussions)

http://punbb.informer.com/forums/topic/ … e-threads/

Confirmed on my 1.3.2 board, as well.

To reproduce, simply post topics to a board, then turn Topics Views off.  You will still see the counts listed on board index, and will see mismatched column width in forum indexes.

I did, in PunBB 1.3.2 using Oxygen_WS style.

12

(15 replies, posted in PunBB 1.3 extensions)

Works as advertised.  Thank you, sir.

I built mine from Oxygen_WS.  Most of my changes have been in StyleName_cs.css, and shouldn't have effected that form's container.

Temporarily Fixed:

Line 71:

        while ($cur_set = $forum_db->fetch_assoc($result_active))
        {
           // Start from scratch
            $item_subject = $item_body = $item_status = $item_nav = $item_title = array();
            $item_indicator = ''; 
            unset($item_status);
            unset($item_subject_status);

Very improper use of variables in this script.

Yes, that is caused by crappy CSS.  These things happen all the time in CSS... it seems simple, until you understand it. smile

I haven't encountered that one yet, though.  It looks like the form elements are floating, and the CSS designer didn't use a page element below it to force the blue container to full height.

It's not a problem with this extension, at least.

16

(61 replies, posted in News)

pun_karma is being upgraded and confirmed for 1.3.2 by the Informer PunBB crew.  That was just decided this week, so it isn't even in SVN yet.

http://punbb.informer.com/svn/additions … xtensions/

I've hit a bug in this, and am reporting it before I look at the code to solve it.

http://www.honestlyillustrated.com/off-site/screenshots/punbb_recent_posts_bug_01.png

Looks like a simple need to reset a variable at the end of foreach.  In the screenshot, only the top (most recent) post is actually Sticky or Closed.  You can see that by the row color.

I found the problem, and corrected opening post.

Move the function bbCodePreview() in /extensions/pun_bbcode/scripts.js to /extensions/pun_bbcode/bar.php, I forgot it had an inline bit of PHP for $base_url.

KeyDog wrote:

the box is screwing it up my end [...]
and when i hover over images it doesnt show them in that box.

The above instructions are all the steps I did, but they are only notes, not a manual.  I'll package it more neatly later.

I just confirmed my copy works in: IE 6, Firefox 3, K-Meleon, Opera 9.

KeyDog wrote:

Just followed those instructions on a test forum I have and got the following screenshots...

I'm unable to see your screenshots on dumpt.com; I tried Firefox 3 and K-meleon.

KeyDog wrote:

maybe you could install a test forum standard installation and then implement this "extension" (lot of code changing  ) - if it works; add the changed files to the zip or rar whatever.

I don't want to leap into that with the holiday so near.  I'll do it after a few more extensions and mods.

KeyDog wrote:

what is working great is that it gets the :myname: i ve added to folder img and it even adds it to help - def love that (that part of code should be standard in next release I think)

Agreed.  Now it needs a cache.  I'm still considering options.

KeyDog wrote:

could i use your code

Yes, it's GPL, as stated in the extension data. wink

BTW, you can add more ASCII smiles (typed as big_smile =O $_$ @_@ etc) by placing them in the array like you did before.

22

(6 replies, posted in PunBB 1.3 troubleshooting)

gokiux wrote:

path is '/' and domain is empty. that script is in root, and punbb is in forum/. all includes is good, in that same page i print $forum_user['username'], after login in punbb login form, it print username, but after i set cookies in my page, it print guest

I think that happens because the PunBB cookie is specific that the user/pass login you did in /forum/ is for /forum/ and not /.  I have the same issue with subdomains, and I have your same problem of being rather confused how to use PunBB login externally.

I'm digging through the code right now and will advise as I find solutions.

KeyDog wrote:

animated gifs also work?

A few of the images in the screenshots are animated, it's just that the screenshot itself is not animated.  They work just as well as any other image.

Thanks for your approval.  I didn't mean to compete with your extension you posted yesterday, I already had it nearly finished by that time.

Thanks, esupergood.  I'm going to let this rest for now, and am considering merging it into the pun_bbcode package.

Version 0.1.4: Download

The smilies list on post forms is now generated from the /img/smilies/ directory file list.

http://www.honestlyillustrated.com/off-site/screenshots/honest_quick_smilies_0.1.2.png

All images in that directory are now available in posts.  The ASCII smiles ( smile big_smile ) are unchanged, and all named smiley codes ( cool lol ) are now the image file name, without the filetype extension:  So, filename.png now has BBCode :filename: and otherfile.gif has :otherfile: and so on.

width="15" height="15" is found in PunBB 1.3.2 <img> tags, in /include/parser.php, function do_smilies($text), and can be modified to read:

/include/parser.php Line 767:

global $forum_config, $base_url, $smilies, $smilies_h, $smilies_w;

/include/parser.php Line 774:

$text = preg_replace("#(?<=[>\s])".preg_quote($smiley_text, '#')."(?=\W)#m", '<img src="'.$base_url.'/img/smilies/'.$smiley_img.'" width="'.$smilies_w[$smiley_img].'" height="'.$smilies_h[$smiley_img].'" alt="'.substr($smiley_img, 0, strrpos($smiley_img, '.')).'" />', $text);

Making the above changes to /include/parser.php will allow smilies <img> tags to have the real image width & height inside of posts, but still use 15x15 in the BBCode toolbar, as in the provided screenshot.

I used GD functions to measure the images, so check this page:
forum.domain/admin/index.php?action=phpinfo

For this info:

PHPInfo wrote:

GD Support     enabled
GD Version     2.0 or higher
[...]
GIF Read Support     enabled
GIF Create Support     enabled
JPG Support     enabled
PNG Support     enabled
WBMP Support     enabled

Use the same GD version I have, and only upload images saved in file formats you have GD support enabled for.

Make the following modification in /extensions/pun_bbcode/bar.php:
Edit: Moved to it's own thread.

The combined result will be:
http://www.honestlyillustrated.com/off-site/screenshots/honest_quick_smilies_0.1.4.png