1

(3 replies, posted in PunBB 1.3 troubleshooting)

Found it: The language used for the UI is user-dependent (Profile > Settings).

Is it possible to always display the UI in French, and ideally, removing this option in users' profile?

Thanks.

Hello

I installed support for French and set this accordingly in Administration » Settings » Setup : Default language.

Problem is, this works fine for guests, but after logging on, the UI goes back to using English.

I went through the different options, but didn't see any setting that would explain the issue.

For those of you using PunBB in a language other than English: Did you see this? How to solve it?

Thank you.

Hello

I need to add a submit button in the viewtopic.php page so that I perform some tasks and then redirect the user to the current topic, eg. "/punbb/viewtopic.php?id=5"

I checked the $forum_url array, but the closest I found are not usable as-is:

[post] => viewtopic.php?pid=$1#p$1 
[topic] => viewtopic.php?id=$1

I know I can use $_SERVER[REQUEST_URI], but I was wondering if PunBB provided this information itself.

Thank you.

4

(0 replies, posted in Feature requests)

Hello

I'd like to add an Events section in the forum that would contain invitations to events, ie. my little MeetUp smile

http://img517.imageshack.us/img517/8927 … scribe.jpg

To make it easier to know who's (no longer) coming, I need to add a link/button that registered users on the forum can use to sign up/cancel.

It appears that the whole logic to display posts is contained in viewtopic.php

For those of you experienced PunBB admins, what would you recommend I do to add this feature?

Thank you.

5

(1 replies, posted in PunBB 1.3 troubleshooting)

For those also wanting to use PunBB to 1) publish on the homepage all the posts in a given forum and 2) simplify the homepage so that it looks like a blog instead of a forum... I found a simple way to tell whether we're in the homepage or elsewhere in the site: Just edit header.php thusly:

if("index.php" == $_SERVER["REQUEST_URI"] || "/" == $_SERVER["REQUEST_URI"]) {
    define('IS_HOMEPAGE', True);
} else {
    define('IS_HOMEPAGE', False);
}

// START SUBST OF COMMON ELEMENTS
[...]
// Main Navigation
// Don't display in homepage
if (!IS_HOMEPAGE) {
        $gen_elements['<!-- forum_navlinks -->'] = '<ul>'."\n\t\t".generate_navlinks()."\n\t".'<$
}

[...]

// START SUBST VISIT ELEMENTS
// Don't display in homepage
if (!IS_HOMEPAGE) {
        if ($forum_user['is_guest'])
                $visit_elements['<!-- forum_welcome -->'] = '<p id="welcome"><span>'.$lang_commo$
        else
                $visit_elements['<!-- forum_welcome -->'] = '<p id="welcome"><span>'.sprintf($la$

        if ($forum_user['g_read_board'] == '1' && $forum_user['g_search'] == '1')
        {
                $visit_links = array();

                if (!$forum_user['is_guest'])
                        $visit_links['newposts'] = '<span id="visit-new"'.(empty($visit_links) ?$

                $visit_links['recent'] = '<span id="visit-recent"'.(empty($visit_links) ? ' clas$
                $visit_links['unanswered'] = '<span id="visit-unanswered"'.(empty($visit_links) $
        }
}

HTH,

6

(2 replies, posted in PunBB 1.3 troubleshooting)

All I'd have to do to customize the homepage, is to be able to tell if we are currently in the homepage or in the forum page, and then, I could simply edit header.php like this:

if (substr(FORUM_PAGE, 0, 5) == 'admin')
...
} else //homepage + forum
    if (homepage)
        //don't include navlink
    else if (forum):
        // Main Navigation
        $gen_elements['<!-- forum_navlinks -->'] = '<ul>'."\n\t\t".generate_navlinks()."\n\t".'</ul>';
// START SUBST OF COMMON ELEMENTS
// Main Navigation
// How to exclude in homepage?
$gen_elements['<!-- forum_navlinks -->'] = '<ul>'."\n\t\t".generate_navlinks()."\n\t".'</ul>';
// START SUBST VISIT ELEMENTS
// How to exclude this line in homepage?
if ($forum_user['is_guest'])
        $visit_elements['<!-- forum_welcome -->'] = '<p id="welcome"><span>'.$lang_common['Not l$
else
        $visit_elements['<!-- forum_welcome -->'] = '<p id="welcome"><span>'.sprintf($lang_commo$

etc.

Unfortunately...
1. the homepage and forum page are lumped together as "FORUM_PAGE='index'", so I can't use this
2. $forum_user[] only includes the referer/previous URL
3. $forum_page[] doesn't include this relevant information

Any idea how to know whether we're on the homepage or forum page?

Thank you.

7

(2 replies, posted in PunBB 1.3 troubleshooting)

It looks like to change the upper and lower parts, I only need to modify /header.php and /footer.php, respectively.

But first, I need to know if I'm in the homepage or the forum itself.

Does someone know if PunBB provides a way to know this?

/header.php

// Load the main template
if (substr(FORUM_PAGE, 0, 5) == 'admin')
{
[...]
}
else if (FORUM_PAGE == 'help')
{
[...]
}
else
{
    if (file_exists(FORUM_ROOT.'style/'.$forum_user['style'].'/main.tpl'))
      $tpl_path = FORUM_ROOT.'style/'.$forum_user['style'].'/main.tpl';
    else
        //How to display a simpler UI for homepage, and full UI for the other pages?
    $tpl_path = FORUM_ROOT.'include/template/main.tpl';
}

Thanks.

8

(2 replies, posted in PunBB 1.3 troubleshooting)

Hello

(Since my other thread of customizing the homepage is being read but people don't seem to have the answer, I'll make it more general to increase the odds, so tet's forget about the Daris Portal extension smile)

There is little documentation in the wiki about how to customize the way PunBB displays pages.

It seems like pages are displayed based on templates (*.tpl) located in ./include/template).

My goal is to have a simpler layout in the homepage than in the forum proper: Should I just modify main.tpl somehow with "if homepage/else" blocks, or is there a better way?

Thank you.

9

(1 replies, posted in PunBB 1.3 troubleshooting)

Hello

(I already asked in the relevant thread, but didn't get a reply, and since my question is partly general, I figured I might get a reply by asking again, in a more active part of the forum)

1. With PunBB installed in /punbb/, I'd like the homepage to display articles from an admin-restricted part of the forum, so that I can use PunBB both as a forum and as a blog to publish articles on the homepage.

However, I'd like to simplify the homepage, and only keep the bare minimum, while the forum page should remain as-is with all the bells and whistles:

http://img228.imageshack.us/img228/6003/punbbportal.jpg

Incidently, this is how the PunBB Resource homepage works.

Can this be achieved entirely by tweaking Administration » Start » Panels, or must I edit some templates somewhere? Is it possible to display some panels in some pages and no others?

2. This is a Daris Portal-specific question: Since Panels are part of PunBB, I'm not sure I understand why Administration » Settings » Portal contains "Panels on all pages". What does this do?


Thank you.

-----------

Edit:

3. To avoid reading the same articles from MySQL again and again each time a user requests the homepage, I'd like the whole homepage to be regenerated as a static file every time an admin publishes a new article in the News section of the forum.

10

(170 replies, posted in PunBB 1.3 extensions)

Thanks for the tip.

Since Panels are part of PunBB, I'm not sure I understand why Administration » Settings » Portal contains "Panels on all pages". What does this do?

Also, I'd like to make the homepage really bare so that it looks like a blog with whatever articles posted to eg. the Test forum:

http://img228.imageshack.us/img228/6003/punbbportal.jpg

Can this be achieved entirely by tweaking Administration » Start » Panels, or must I edit some templates somewhere?

Thank you.

11

(170 replies, posted in PunBB 1.3 extensions)

I just installed Daris Portal 2.4.3 on PunBB 1.3.4... and don't know what to do next smile

FWIW, PunBB is curently installed in http://srv/punb/, but I can move it to the root if it's a better idea.

How do I use Daris Portal to publish forum posts on the home page and have a portal?


BTW, when installing, I get this warning

This extension has not been explicitly tested on your PunBB version and might therefore not be compatible with your current setup.

Thank you.

12

(6 replies, posted in Feature requests)

Cool smile I didn't know PunBB would add the tags automatically. Problem solved then. Thank you.

13

(2 replies, posted in Discussions)

Thanks for the tip. I'll check out Daris Portal.

So it looks like "portal" was the magic word I should look for to use a forum to also publish webmaster-originating articles on the homepage.

14

(6 replies, posted in Feature requests)

Sorry, I wasn't clear enough: I did read about WYSIWYG not necessarily being such a good idea (slower, with security risks since people can post HTML), but I think asking non-techies to type BBCode to type URL's is an issue. I think it'd be better to prompt them for the URL, and turn this into BBCode, so they won't butch it.

15

(2 replies, posted in Discussions)

Hello

I'd actually like to use PunBB just like it's done here at punbb.informer.com, ie. the home page should contain articles to which users can post comments, and comments should live in a thread in the forum.

That way, no need to integrate some blogging software with PunBB  smile

Is PunBB used to do this, or did the webmasters combine a blog application with PunBB for the forum?

If the former, is there some documentation on how to configure PunBB that way?

Thank you.

16

(6 replies, posted in Feature requests)

Thanks. Too bad it's not already part of PunBB.

17

(6 replies, posted in Feature requests)

Hello

I don't know how this feature is called, but the URL icon in the toolbar simply adds the

[url]...[/url]

which is OK for geeks but not for non-techies.

Is there a way/add-on to display a pop-up dialog to prompt the user for the URL to which the highlighted text should point?

Thank you.

18

(12 replies, posted in PunBB 1.3 troubleshooting)

Grez wrote:

Well, actually it seems like PunBB doesn't use sessions at all *.*

Really? If there's a PHP expert in the audience, I'd like to know why they didn't. Since PunBB uses its own cookie instead of PHPSESSID, I assume it's a safe-guard against some other application also putting its data in $_SESSION[], which would make sense.

19

(12 replies, posted in PunBB 1.3 troubleshooting)

Thanks. I was about to paste the same solution, but you beat me to it smile

index.php

<?php
//http://phpro.org/examples/Get-Full-URL.html
function getURLBaseName()
{
  $protocol = $_SERVER['HTTPS'] == 'on' ? 'https' : 'http';
  //return $protocol.'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
  $fullpath = $protocol.'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
  //return basename($fullpath);
  return $fullpath;
}
     
[...]
//Authenticated
if(!$forum_user['is_guest']) {
    //Strip filename from full URL
    $path_parts = pathinfo(getURLBaseName());
    $fullpath = $path_parts['dirname']. "/action.php";
    $csrf = generate_form_token($fullpath);
    ?>
    <form method="post" action="action.php">
            <input type="hidden" name="csrf_token" value="<?php echo $csrf; ?>">
            <input type="hidden" name="event" value="<?php echo $var_url['idpost']; ?>" />
            <input type="submit" name="subscribe" value="<?php echo $value; ?>" />
    </form>
    <?php
} else {
    ?>
    Authentication required<p>
  <form method="post" action="<?php echo $forum_page['form_action'] ?>">
            <?php echo implode("\n\t\t", $forum_page['hidden_fields'])."\n" ?>

            User: <input type="text" id="fld1" name="req_username" value="" /> <br />

            Password: <input type="password" id="fld2" name="req_password" value="" /> <br />

          <input type="submit" name="login" id="login" value="Login" />
     </form>
    <?php
}
?>

action.php

<?php

define('FORUM_ROOT', '/var/www/nginx-default/punbb/');
require FORUM_ROOT.'include/common.php';

print $forum_user['username'] . "<p>";

//Why is nothing printed on screen?
foreach ($_SESSION as $key => $value){
  print sprintf("%s = %s<p>\n",$key,$value);
}
?>

A couple of questions:

  • Do I really need to include "implode("\n\t\t", $forum_page['hidden_fields)" in the form once the user is authenticated? I didn't use it, and it seems to work OK

  • In action.php, why is $_SESSION[] empty?

Thank you.

20

(12 replies, posted in PunBB 1.3 troubleshooting)

Would it be a big security risk if I just tell PunBB to ignore this, and use:

define('FORUM_SKIP_CSRF_CONFIRM');

?

21

(12 replies, posted in PunBB 1.3 troubleshooting)

Next, I tried hashing URLs myself through generate_form_token(), but I still get the "Unable to confirm security token" error message:

//Authenticated
if(!$forum_user['is_guest']) {

        //$csrf = generate_form_token(get_current_url());
        //BAD $csrf = generate_form_token("/blog/test2/index.php");
        //BAD $csrf = generate_form_token("/nlog/test2/action.php");
        ?>

    <form method="post" action="action.php">
      <input type="hidden" name="csrf_token" value="<?php echo $csrf; ?>">
      <input type="hidden" name="event" value="<?php echo $var_url['idpost']; ?>" />
      <input type="submit" name="subscribe" value="<?php echo $value; ?>" />
        </form>
        <?php

22

(12 replies, posted in PunBB 1.3 troubleshooting)

Grez wrote:

Ok, I checked PunBB code and your code and finally found the error

Thanks for the tip, but changing that line isn't the solution since PunBB uses this link to direct the user to login.php for the initial authentication. If I change it like shown, I can no longer authenticate and I get the same error message that I get when calling action.php

Grez wrote:

Each time, when you send $_POST punBB will check, whether you send right CSFR token, which is sha1 hash of target url address. (./includes/common.php: line 124-6)

Mmm... In that case, could index.php or action.php simply hash a new CSRF variable so that PunBB is OK?

Work-arounds I checked but don't work:

  • Read "online" table from MySQL, but the "logged" column just shows the last time (Epoch)  the user sent a query. Even after a user logs out, the "logged" column isn't cleared

  • Switch to the session.name used by PunBB ("forum_cookie_baf83f"), and read the contents of $_SESSION[], but it's empty:

<?php

//Called after loggin on through PunBB

//default = PHPSESSID, while PunBB uses forum_cookie_baf83f
$previous_name = session_name("forum_cookie_baf83f");

session_start();

echo "Previous name was $previous_name<br />";
print sprintf("Current name is %s<p>",session_name());

//Expected $_SESSION[] to contain user data, but empty
foreach ($_SESSION as $key => $value){
  print sprintf("%s = %s<p>\n",$key,$value);
}
?>

Integrating unrelated web apps is a PITA ;-)

23

(12 replies, posted in PunBB 1.3 troubleshooting)

If we can't find the cause for this error, as a work-around, is there a way for my script to somehow check...

1) that the user has been authenticated

2) read his username?

What about either reading some infos from $_SESSION[] or directly in the PunBB database?

24

(12 replies, posted in PunBB 1.3 troubleshooting)

Grez wrote:

You have to include common.php before you send any input to browser

Thanks for the tip, but I just tried and no go :-/

The first step (authentication) works fine, but I still the error message in the second step where I click on a form button to call action.php in the same directory (calling action.php manually by typing its URL works OK):

index.php

<?php

define('FORUM_ROOT', '/var/www/punbb/');
require FORUM_ROOT . 'include/common.php';

$forum_page['redirect_url'] = "/blog/test/index.php";
$forum_page['form_action'] = forum_link($forum_url['login']);
$forum_page['hidden_fields'] = array(
    'form_sent'    => '<input type="hidden" name="form_sent" value="1" />',
    'redirect_url'    => '<input type="hidden" name="redirect_url" value="'.forum_htmlencode($forum_page['redirect_url']).'" />',
    'csrf_token'    => '<input type="hidden" name="csrf_token" value="'.generate_form_token($forum_page['form_action']).'" />'
);

//!guest = authenticated
if(!$forum_user['is_guest']) {
    ?>
      <form method="post" action="action.php">
        <input type="submit" name="subscribe" value="Subscribe" />
        </form>
    <?php

} else {
      ?>
      <form method="post" action="<?php echo $forum_page['form_action'] ?>">
                <?php echo implode("\n\t\t", $forum_page['hidden_fields'])."\n" ?>
    
                User: <input type="text" id="fld1" name="req_username" value="" /> <br />
    
                Password: <input type="password" id="fld2" name="req_password" value="" /> <br />
    
              <input type="submit" name="login" id="login" value="Login" />
      </form>
      <?php
}

?>

action.php:

<?php
/*
Unable to confirm security token. A likely cause for this is that some time passed between when you first entered the page and when you submitted a form or clicked a link. If that is the case and you would like to continue with your action, please click the Confirm button. Otherwise, you should click the Cancel button to return to where you were.
*/

define('FORUM_ROOT', '/var/www/nginx-default/punbb/');
require FORUM_ROOT . 'include/common.php';

if(!$forum_user['is_guest']) {
    print $forum_user['username'] . "<p>";
} else {
    print "Not logged on!<p>";
}
?>
Grez wrote:

BTW what program did you use for this image?

It's a neat little application called Balsamiq Mockups. There are others, including the open-source Pencil, but it doesn't seem to have much traction (not enough icons).

Thank you.

25

(12 replies, posted in PunBB 1.3 troubleshooting)

Found something: After the user is logged on, calling /blog/action.php directly works fine. So the problem is when /blog/index.php calls action.php through the button in the form. No idea what it makes a difference hmm