Hello,

I would like to display a specific post on my index. I have tried to do it myself and it works on forums pages.
Outside the forum, in the gallery, or a custom php page, it show an error : all to undefined function: parse_message()

Someone can help me to fix that problem ? I want to keep the parsing


Here is the code :

<?php

define('PUN_ROOT', './');

$result = $db->query('SELECT id, message FROM '.$db->prefix.'posts WHERE id=4735') or error('Unable to fetch user data', __FILE__, __LINE__, $db->error());
while ($data = $db->fetch_assoc($result))
{
$data['message'] = parse_message($data['message'], $data['hide_smilies']);
echo $data['message']."\n"    ;
}

 ?>

Thanks a lot !

I have some problem with this chatbox, sometimes an error appear a few seconds in chat window :

HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
Internal server Error
Please contact your admin at ...

I don't know what it is sad

It seems to be a problem with the refresh function if the server can't answer quickly.. but maybe i'm wrong

3

(2 replies, posted in PunBB 1.2 show off)

Shame on me yikes

fixed smile

Should be ok now

4

(2 replies, posted in PunBB 1.2 show off)

that's a french one.

Not very hard modded ^^

www.inestima.net

Enjoy smile

Ok I got the point smile

If I would like to show more than that based of forums perm ?

Alex king made it, but it show too many informations...


I have seen that on extern :

$result = $db->query('SELECT g_read_board FROM '.$db->prefix.'groups WHERE g_id=3') or error('Unable to fetch group info', __FILE__, __LINE__, $db->error());
if ($db->result($result) == '0')
    exit('No permission');

Alex king made :

$result = $db->query('
    SELECT t.* 
    FROM '.$db->prefix.'topics AS t 
    INNER JOIN '.$db->prefix.'forums AS f 
    ON f.id=t.forum_id 
    LEFT JOIN '.$db->prefix.'forum_perms AS fp 
    ON (
        fp.forum_id=f.id 
        AND fp.group_id='.$pun_user['g_id'].'
    ) 
    WHERE (
        fp.read_forum IS NULL 
        OR fp.read_forum=1
    ) 
    ORDER BY t.last_post DESC
    LIMIT '.$ak_limit

Is it an easy way to keep interresting param from extern (show last topics from x, y, z forums only) and consider forums perm to show more than "guest can view" ?

Sorry for my english sad

Frank H wrote:

if it will show in active, it won't be a private message...

But someone who has acces to this forum can't see it in active topics box sad

Is there any possibilities to correct that ?

I mean someone who's posting in a private section, can never see his topic in active topics.

Strange no ?

I use extern.php on my site to display last active topics.

I'm log as Admin,
But it show only topics who are visible to guest, is it normal ?

It's work with a table.

Is it any possibility to exclude a specific forum from last topics, and include it to the second ?

<?php
 
define('PUN_ROOT', './');
define('PUN_QUIET_VISIT', 1);
require PUN_ROOT.'include/common.php';
 
$page_title = pun_htmlspecialchars($pun_config['o_board_title']);
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';

require PUN_ROOT.'include/parser.php';
?>

<table>
<tr>
<th><?include('mod_active_topics_1.2.php');?></th>
<th><?include('mod_active_topics_1.2.php');?></th>
</tr>
</table>
<?
 
function pun_news($fid='', $show=15, $truncate=1)
{
    global $lang_common, $db, $pun_config, $db_prefix;
    $max_subject_length = 30;
    $show_max_topics = 50;
    $fid = intval($fid);
    $order_by = 't.posted';
    $forum_sql = '';
    // Was a forum ID supplied?
    if ( $fid ) $forum_sql = 'f.id='.$fid.' AND ';
    $show = intval($show);
    if ($show < 1 || $show > $show_max_topics)
    $show = 15;
    $saveddate="";
    // Fetch $show topics
    $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, f.id AS fid, f.forum_name FROM '.$db_prefix.'topics AS t INNER JOIN '.$db_prefix.'forums AS f ON t.forum_id=f.id WHERE f.id='.$fid.' AND t.moved_to IS NULL ORDER BY '.$order_by.' DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
    $show_count = 0;
    if ( !$db->num_rows($result) ) return $output;
    while ( ($show_count < $show) && ($cur_topic = $db->fetch_assoc($result)) ) {
        $temp = '';
        if ($pun_config['o_censoring'] == '1')
            $cur_topic['subject'] = censor_words($cur_topic['subject']);
        if (pun_strlen($cur_topic['subject']) > $max_subject_length)
            $subject_truncated = trim(substr($cur_topic['subject'], 0, ($max_subject_length-5))).' ...';
        else
            $subject_truncated = $cur_topic['subject'];
        $newsheading = '<a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_topic['id'].'&action=new" title="'.pun_htmlspecialchars($cur_topic['subject']).'">'.pun_htmlspecialchars($subject_truncated).'</a> - <em>Posted by '.$cur_topic['poster'].' at '.date('h:i A', $cur_topic['posted']).'</em><br>';
        // Group posts by date    
        $thisdate = date('l, d F Y', $cur_topic['posted']);
        if ($thisdate != $saveddate) 
 
        {
            if ($saveddate)
            {
                $temp .= "</div></div>";
            }
            $temp .= '<div class="block"><h2><span>'.$thisdate.'</span></h2><div class="box"><div class="inbox"><p>';
            $saveddate = $thisdate;
        }
        else {
            $temp .= '<div class="inbox"><p>';
        }
        $temp .= $newsheading.'</p><p>';
        $id = $cur_topic['id'];
        $msg = $db->query('SELECT id, poster, poster_id, poster_ip, poster_email, message, posted, edited, edited_by FROM '.$db_prefix.'posts WHERE topic_id='.$id.' LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
            if ( !$db->num_rows($msg) ) continue;
        $cur_post = $db->fetch_assoc($msg);
        // Display first paragraph only (comment out next four lines to turn off)
        if ($truncate == 1)
        {
        $paragraph = preg_split("/s*n+/", $cur_post['message']);
            if (isset($paragraph[1])) {
                $cur_post['message'] = $paragraph[0] . "...";
            }
        }
        $cur_post['message'] = parse_message($cur_post['message'], 0);
        $temp .= $cur_post['message'];
        $temp .= "</p></div>";
        if (isset($output)) {
            $output .= $temp;
        }
        else {
            $output = $temp;
        }
        ++$show_count;
    } // end of while
    $output .= "</div></div>";
    return $output;
}
echo pun_news(1, 5, 0);
 
require PUN_ROOT.'footer.php';

Nobody can give me a hint to do that ? sad

Hello,

I'm looking for some help to solve my problem :s

I'm using mod_active_topics by Alexking to display lastest active topics.

But I want to show two small tables displaying differents latests topics, and I don't know how to do it.

I've tried some mods but I don't know very well about programming.


Let me show what I have and what I would like to have :

by default
finaly should be sound like that

Source code latest active topics :

<?php
/*

PunBB Active Topics

Copyright 2004-2005 Alex King, http://www.alexking.org/

This is a mod for PunBB, http://punbb.org/
PunBB is Copyright (C) 2002, 2003, 2004  Rickard Andersson (rickard@punbb.org)

This file is based on the viewtopic.php file in PunBB.

-------------------------------

You can see this in action at the Use Tasks forums:

  http://www.usetasks.com/forums/


To install, include this file below the forums list in your index.php file:

  include('mod_active_topics_1.2.php');

*/

$ak_limit = 7; // change this to the number of active topics you want to display.

$result = $db->query('
    SELECT t.* 
    FROM '.$db->prefix.'topics AS t 
    INNER JOIN '.$db->prefix.'forums AS f 
    ON f.id=t.forum_id 
    LEFT JOIN '.$db->prefix.'forum_perms AS fp 
    ON (
        fp.forum_id=f.id 
        AND fp.group_id='.$pun_user['g_id'].'
    ) 
    WHERE (
        fp.read_forum IS NULL 
        OR fp.read_forum=1
    ) 
    ORDER BY t.last_post DESC
    LIMIT '.$ak_limit
) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());

require PUN_ROOT.'lang/'.$pun_user['language'].'/forum.php';

?>
<div id="vf" class="blocktable">
    <h2><span>Discussions récentes</span></h2>
    <div class="box">
        <div class="inbox">
            <table cellspacing="0">
            <thead>
                <tr>
                    <th class="tcl" scope="col"><?php echo $lang_common['Topic'] ?></th>
                    <th class="tcr" scope="col"><?php echo $lang_common['Last post'] ?></th>
                </tr>
            </thead>
            <tbody>
            
<?php
// If there are topics in this forum.
if ($db->num_rows($result))
{
    while ($cur_topic = $db->fetch_assoc($result))
    {
        $icon_text = $lang_common['Normal icon'];
        $item_status = '';
        $icon_type = 'icon';

        if ($cur_topic['moved_to'] == null)
            $last_post = '<a href="viewtopic.php?pid='.$cur_topic['last_post_id'].'#p'.$cur_topic['last_post_id'].'">'.format_time($cur_topic['last_post']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['last_poster']).'</span>';
        else
            $last_post = ' ';

        if ($pun_config['o_censoring'] == '1')
            $cur_topic['subject'] = censor_words($cur_topic['subject']);

        if ($cur_topic['moved_to'] != 0)
            $subject = $lang_forum['Moved'].': <a href="viewtopic.php?id='.$cur_topic['moved_to'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['poster']).'</span>';
        else if ($cur_topic['closed'] == '0')
            $subject = '<a href="viewtopic.php?id='.$cur_topic['id'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> </br><span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['poster']).'</span>';
        else
        {
            $subject = '<a href="viewtopic.php?id='.$cur_topic['id'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> </br><span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['poster']).'</span>';
            $icon_text = $lang_common['Closed icon'];
            $item_status = 'iclosed';
        }

        if (!$pun_user['is_guest'] && $cur_topic['last_post'] > $pun_user['last_visit'] && $cur_topic['moved_to'] == null)
        {
            $icon_text .= ' '.$lang_common['New icon'];
            $item_status .= ' inew';
            $icon_type = 'icon inew';
            $subject = '<strong>'.$subject.'</strong>';
            $subject_new_posts = '<span class="newtext">[ <a href="viewtopic.php?id='.$cur_topic['id'].'&action=new" title="'.$lang_common['New posts info'].'">'.$lang_common['New posts'].'</a> ]</span>';
        }
        else
            $subject_new_posts = null;

        // Should we display the dot or not? :)
        if (1 == 0 && !$pun_user['is_guest'] && $pun_config['o_show_dot'] == '1')
        {
            if ($cur_topic['has_posted'] == $pun_user['id'])
                $subject = '<strong>·</strong> '.$subject;
            else
                $subject = '  '.$subject;
        }

        if ($cur_topic['sticky'] == '1')
        {
            $subject = '<span class="stickytext">'.$lang_forum['Sticky'].': </span>'.$subject;
            $item_status .= ' isticky';
            $icon_text .= ' '.$lang_forum['Sticky'];
        }

        $num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / $pun_user['disp_posts']);

        if ($num_pages_topic > 1)
            $subject_multipage = '[ '.paginate($num_pages_topic, -1, 'viewtopic.php?id='.$cur_topic['id']).' ]';
        else
            $subject_multipage = null;

        // Should we show the "New posts" and/or the multipage links?
        if (!empty($subject_new_posts) || !empty($subject_multipage))
        {
            $subject .= '  '.(!empty($subject_new_posts) ? $subject_new_posts : '');
            $subject .= !empty($subject_multipage) ? ' '.$subject_multipage : '';
        }

?>
                <tr<?php if ($item_status != '') echo ' class="'.trim($item_status).'"'; ?>>
                    <td class="tcl">
                        <div class="intd">
                            <div class="<?php echo $icon_type ?>"><div class="nosize"><?php echo trim($icon_text) ?></div></div>
                            <div class="tclcon">
                                <?php echo $subject."\n" ?>
                            </div>
                        </div>
                    </td>
                    <td class="tcr"><?php echo $last_post ?></td>
                </tr>
                

<?php

    }
}
else
{

?>
                <tr>
                    <td class="tcl" colspan="4"><?php echo $lang_forum['Empty forum'] ?></td>
                </tr>
<?php

}

?>
            </tbody>
            </table>
        </div>
    </div>
</div>

Thanks a lot !

12

(0 replies, posted in Feature requests)

Hello,

My request appear to be strange but, I think it should be very useful for the community.

I have made a lot of modification in my punbb forum. I have seen the new plug-in function for punbb 1.3 and it's look very impressive. I want to clean up all my manuals modifications before punbb 1.3 coming, to have a very clean database for future plug-ins 1.3 compliant.

Sorry for my english and I hope that my request is understanble.

Rhan

Gizzmo, is it possible to include a function to display a list of events not yet passed of the week, to see it directly from forum's (portal?) main page ?

14

(4 replies, posted in PunBB 1.2 troubleshooting)

The forum works fine without gzip and doesn't show any error (debug mode enabled)

15

(4 replies, posted in PunBB 1.2 troubleshooting)

I have install a new punbb forum to test gzip ... and it works lol

So I have made a misstake with my modifications.. how can I see what's wrong without seeing any error message ? sad

I can't have acces to apache log hmm

Hello,

I have a problem with gzip output. I 've tried to enable this feature but it display blank page! I have mailed my hosting manager and he said to me that gzip is perfectly compiled on the server... So what's the problem ? I don't really know and don't have found any topic about that.

I have install a phpbb forum to test gzip mod and it work.

Thanks a lot for responding!

17

(1 replies, posted in Feature requests)

hello,

I would like to know something big_smile

Is it possible ton include a function who's writing moderators actions, guest connections in a file or in db to have a history log ?

Maybe it's too difficult, or make it the board too slow ? I don't really know.

Thanks a lot for answering and sorry for my english tongue

nobody ? sad

Hello all,

I would like to make a special userlist. I've made some modification to include more field in profile and to display it in userlist and it works, but ... I want to display not all groups in the list, only group_id 1,2,5,6 (so excluding visitors and regular members) and I don't want to let the choice of display ( removing selection groups ).

I don't really understand how the script works to fix that.

Anyone can help me ? smile

Thanks a lot and sorry for my english tongue