This is how to get Nifty Corners Cube (i.e. v3) to work on PunBB without dropping the form element focusing. (Nifty Corners Cube is an unobtrusive and flexible application for getting rounded corners on your site)

Open "header.php".

After the lines:

<?php

if (defined('PUN_ADMIN_CONSOLE'))
    echo '<link rel="stylesheet" type="text/css" href="style/imports/base_admin.css" />'."\n";

And before the lines:

if (isset($required_fields))
{
    // Output JavaScript to validate form (make sure required fields are filled out)

?>
<script type="text/javascript">

Add the following:

// Import Nifty Corners Cube for rounded corners
// Import function for handling multiple onload events
// Load such events (form element focusing and Nifty Corners Cube)

?>
<link rel="stylesheet" href="<?php echo PUN_ROOT ?>/...?.../niftyCorners.css" type="text/css" media="screen" />
<script type="text/javascript" src="<?php echo PUN_ROOT ?>/...?.../niftycube.js"></script>
<script type="text/javascript" src="<?php echo PUN_ROOT ?>/...?.../addLoadEvent.js"></script>
<script type="text/javascript">
    addLoadEvent(function(){Nifty("xxx","yyy")});
<?php

if (isset($focus_element))
{

?>
    addLoadEvent(function(){document.getElementById("<?php echo $focus_element[0] ?>").<?php echo $focus_element[1] ?>.focus()});
<?php

}

?>
</script>
<?php

In the code above, there are three instances of "/...?.../" and the two instances of "xxx" and "yyy".

I am not hear to explain Nifty Corners Cube, so users of the application should recognize the "xxx" and "yyy" as the spots where they would insert the parameters for the application.

The first two "/...?.../" will need to be replaced with the sub-directory (folder) path that you have stored the "Nifty Corners Cube" files in (relative to the directory PunBB is installed in). (Only the files loaded above are actually necessary for the Nifty Corners; the other files included in the Nifty Corners zip file are examples and such.)

The third "/...?.../" will need to be replaced with the sub-directory (folder) path that you have stored the "addLoadEvent.js" javascript file in (relative to the directory PunBB is installed in). This file (addLoadEvent.js) should contain the following code:

/*
 * Executing JavaScript on page load
 * Author: Simon Willison
 * Source: http://simonwillison.net/2004/May/26/addLoadEvent/
 */

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(nameOfSomeFunctionToRunOnPageLoad);
addLoadEvent(function() {
  /* more code to run on page load */ 
});

If you would rather include this tiny function directly within header, it is also acceptable to instead replace the line:

<script type="text/javascript" src="<?php echo PUN_ROOT ?>/...?.../addLoadEvent.js"></script>

...with the javascript function it refers to (i.e. the javascript function I printed above).

And very important! Make sure to delete (or comment out) the code that uses the "body" tag to focus on the form element. (This was done at the beginning of this thread with the effect of making the Nifty Corners application work, and is still required to do so.) In case you missed the discussion above, this is the code you must delete (or comment out):

// START SUBST - <body>
if (isset($focus_element))
{
    $tpl_main = str_replace('<body onload="', '<body onload="document.getElementById(\''.$focus_element[0].'\').'.$focus_element[1].'.focus();', $tpl_main);
    $tpl_main = str_replace('<body>', '<body onload="document.getElementById(\''.$focus_element[0].'\').'.$focus_element[1].'.focus()">', $tpl_main);
}
// END SUBST - <body>

I have tested this in The following Mac browsers: Firefox 2, Opera 9, Netscape 7, Safari 2. I repeat, those are for Mac. If some kind soul out there tests this on Windows browsers, please tell me the results big_smile

The author of addLoadEvent(), Simon Willison, on 26th May 2004 regarding his function wrote:

... I?ve tested the above code successfully on IE 5, 5.5 and 6 for Windows; IE 5 and Safari for Mac; Opera 7.5 and FireFox on Mac (which should mean it works with those browsers on Windows as well). Opera 6 for Mac failed the test ...

I've translated the /lang/pms.php to Chinese (simplified). I'm not native, but am studying overseas and confirming lines with natives. I will be having a native (whose English rocks and who is a programmer) to look over it when she has time. I'll come back with an updated version if changes are made.

The Chinese wouldn't show up in the preview of this post, so I've posted it on my site:
http://twalrpg.net/teralis/viewtopic.php?pid=985#p985

That is the most dangerously powerful addition to punBB I have ever seen. I did embrace the add user feature -- great for testing if tweaking the new user process! Sory I couldn't help by tryign out the latest version two posts above -- it's just such a scary feature o.o

Excellent mod. I play three characters in my RP forum and I hate it when I post with the wrong one. This mod saves me the trouble of editting, what is it: 3, 4? database tables. Thank you!

And though unused as of yet, changing one user to another could be very helpful!

5

(2 replies, posted in PunBB 1.2 show off)

Hm. Now that I set my style back to green to look at it, it is a bit intense. Thank you for the comment, I'll get to toning it down or choosing a different default style.

6

(2 replies, posted in PunBB 1.2 show off)

PunBB is pure greatness! Simple, cleanly coded, mod-able, and easy to tweak -- the definition of a versatile message board. No way I could have managed all I've done had I stuck with PhpBB (which I transfered over to PunBB). Modding and tweaking is fun and a great process to learn more advanced PHP with. Thank you PunBB.

Teralis (http://twalrpg.net/teralis/)
Teralis is an ancient world of fantasy, part of Twal RPG. Read and join the tales of warriors and travelers. Every character in this role-play is a unique creation of its user. Teralis was built to encourage creativity and support originality in the realm of fantasy.

? Using PunBB 1.2.11, but I promise I'll update soon!
? Installed the simple private messaging mod. Installed a BBcode buttons mod and tweaked it to look cleaner and work on more browsers.
? Installed languages are each correctly local set and utf8 encoded (had to update the Danish one's special characters to html codes; had to tweak Chinese one's local to accept strftime(%c)).
? Updated all date() uses to strftime() and included time locale setting within each language pack -- i.e. this shows preferred date & time display for the language/locale chosen.
? A sub-forum mod also installed, with fixes found on this board.
? Translated stylesheets of the partner website over to the forums.
? Some invisible editting allows logging into the forums also logs your into its partner website, and vice-versa -- both sharing each others' variables and databases.

Smartys wrote:

I just had the double online issue with PunBB.

I've been having this issue. I've read this post and it's replies, but never saw how to fix it. How does one fix this bug?

Oh oh, it goes to forum/login.php and set's the action to in. If it uses punBB's perfect code to process the data, then I'm stumped as to how it is failing. I am useless. I hope you find the help you need.

What code is the form data sent to ?

10

(7 replies, posted in PunBB 1.2 troubleshooting)

That dev page is a great resource, thanks for the link. Glad everything worked out for ya. A beautiful site layout you have, and makes great use of the punBB integration.

11

(7 replies, posted in PunBB 1.2 troubleshooting)

I've begun to integrate my site with my board also. I think this tidbit I got recently could be a start:

//Path from current location to forum folder
define('PUN_ROOT', './path/to/forum');
//This stops posts getting marked as read when people only view this page
define('PUN_QUIET_VISIT', 1);
//Load PunBBs functions and variables
require PUN_ROOT.'include/common.php';

Gives you access to all the punBB functions and a ton of variables.

12

(12 replies, posted in PunBB 1.2 troubleshooting)

I love you,

Thanks.

13

(12 replies, posted in PunBB 1.2 troubleshooting)

Might work, but I already changed all my files. And I have a new problem, whee! (I still would have this same new problem, I believe, even if a chdir() action had been used instead.)

PunBB seems to be preventing my webpages from using the php variables I pass at the end of URLs. I can see that the URL includes the php variable I pass, but when the page parses, the variable is empty.

I have this code on every page that need have it. (And /path/to/forum has been replaced with the appropiate path on each page.)

//Path from current location to forum folder
define('PUN_ROOT', './path/to/forum');
//This stops posts getting marked as read when people only view this page
define('PUN_QUIET_VISIT', 1);
//Load PunBBs functions and variables
require PUN_ROOT.'include/common.php';

My URLs passed php variables fine before giving my site constant access to punBB like so. What's up? sad

Edit: Also all pages that once succesfully recieved data from forms are no longer recieving that data. Only the code to access punBB has been added to any page.

14

(12 replies, posted in PunBB 1.2 troubleshooting)

Tried a change directory function I found on PHP's site, chdir(), but couldn't get it to be useful. Time to add that punBB access code to every file! Thank you for the help.

15

(12 replies, posted in PunBB 1.2 troubleshooting)

That's much more effecient and actually may open up possibilities I hadn't previously thought of!

I have put this code on my 'create_data.php' that every page includes. And everything works for any page in my root directory that calls 'data.php'. But that's only two pages... Most of my pages (that call 'data.php') are not located in the root directory, so I get the error:

Warning: main(./mboard2/include/common.php): failed to open stream: No such file or directory in /home/twallnet/public_html/login/create_data.php on line 10

Also my server has 'open_basedir' protection enabled, which is screwing up every alternative code I've come up with. I am very sad sad

16

(12 replies, posted in PunBB 1.2 troubleshooting)

I want my website to be able to read and utilize my punBB's cookie so that I can have them logged into my website and punBB simultaneously.

This is the code in 'include/functions.php' of my punBB 1.2.11 that successfully reads my punBB's coookie. I have only added a notice message within.

if (isset($_COOKIE[$cookie_name]))
    list($cookie['user_id'], $cookie['password_hash']) = @unserialize($_COOKIE[$cookie_name]);

// Code I've added to inform members of a dilema.
echo '<strong>Website login is offline.</strong><br>Mboard login is working.<br><small>['.$cookie['user_id'].'] '.$cookie_name.'</small><p>';

if ($cookie['user_id'] > 1)
{

This is the code on the page of my website that fails to read my punBB's cookie (so that a user may be logged in to my website and the message board simultaneously).

    if (isset($_COOKIE[$cookie_name]))
        list($cookie['user_id'], $cookie['password_hash']) = @unserialize($_COOKIE[$cookie_name]);

// Code I've added to inform members of a dilema.
echo '<strong>Website login is offline.</strong><br>Mboard login is working.<br><small>['.$cookie['user_id'].'] '.$cookie_name.'</small><p>';

    if ($cookie['user_id'] > 1)
    {

The variable $cookie['user_id'] never returns any data when called by my website (as in the code above). Besides four extra tabs, the code is identical. Why does this code not work when used on the website? (that the punBB is part of)

Website is located at the main directory. The punBB is within a folder called 'mboard2'.
The cookie is valid, as I can run around logged in to the punBB with no trouble at all.
The value of $cookie_name in both codes is identical.
And aren't isset, list, unserialize all native PHP functions?

Back when I had punBB 1.5.1 (I just recently upgraded to 1.2.11 which is a vast improvement) I was able to do the following:
? Users could login to my website -> this would also simultaneously log them into the message board.
? Users could login to the messageboard -> this would also simultaneously log them into the website.
? ( Logging out worked exactly the same. I even managed to get stylesheet changes on either to update on the other. )
But with punBB 1.2.11, I am having trouble restoring this much-needed ability because of the code mentioned above.

17

(4 replies, posted in PunBB 1.2 troubleshooting)

Tswhat I've decided is the best option. Gonna try it soon. Is there anything absolutely vital from 1.5.1 to 1.2.11 ? I mean what am I really missing ?

18

(4 replies, posted in PunBB 1.2 troubleshooting)

1.1.5 to 1.2.11 ... It's been a while. I know there is a post about 1.2.5 to 1.2.11, but I'm still frightened about this update. My old version is modified (smilie selection, and text colors-style-size-etc mod, and some code tweaks of my own to integrate it with my website's login). What is the best route to take (same as the post about 1.2.5 to 1.2.11) ?

I'm sure. I emptied anythign remotely resemblign interent history. And still it showed the wrong post. I checked the databases : nothing wrong with any of the values that would determien which post is the latest. I posted and the problem was fixed. But this isn't the first time it has happened.

Many times in the "Last post" column on the index page, it will show the second to last post. And everything that shoudl happen for a new post (exclamation icon, "[new posts]" note in subject of thread) won't occur (probably because it's still reading the second to last as the latest).

Why is it reading the second to last post as the latest ?