51

(4 replies, posted in Feature requests)

See the mentioned mod here: http://www.punres.org/viewtopic.php?id=2605

I hope I can say in a few months if it is a good or a bad idea... smile

52

(10 replies, posted in PunBB 1.2 troubleshooting)

Thanks. wink
You're damn fast... smile

Just tried it. It works (I'm guessing you're not surprised). big_smile

Why would you change from vB to punbb (except for the license problem)?
I know it's offtopic, but I'm curious.

54

(10 replies, posted in PunBB 1.2 troubleshooting)

I'm having this same problem with my punbb installation. But I found the problem. smile

My site accepts http://www.mysite.com and http://mysite.com.
If your last logout was on http://www.mysite.com you can't login in http://mysite.com.
You should try to login with either one or the other.

Try it yourself:
1 - login using http://www.mysite.com
2 - logout
3 - login using http://mysite.com
4 - you get the login successful message, but after that you get index.php as guest

smile

55

(3 replies, posted in PunBB 1.2 show off)

Thanks for the heads up. smile I'm going to check what's wrong... neutral

Very nice.

You've made the HYI style look very good: you did the right changes, width, background, forum icons and header.
That's how it is supposed to be. wink

57

(3 replies, posted in PunBB 1.2 show off)

Hi,

Thanks to all the developers and supporters. Nice piece of *free* software. Might donate later. wink

My site: http://.com

Mod released: http://www.punres.org/desc.php?pid=331
Download it here: http://www.punres.org/download.php?id=1164

smile

You guys rock... smile

Original viewtopic.php (plain standard file not changed):
http://69.73.152.118/punbb_standard/viewtopic.php?id=7
Generated in 0.049 seconds, 8 queries executed

With guardian34 "old" code:
http://69.73.152.118/punbb_standard/vie … n.php?id=7
Generated in 0.024 seconds, 15 queries executed

With guardian34 new code:
http://69.73.152.118/punbb_standard/vie … n.php?id=7
It halts at the reported post not showing the rest.

With Smartys code:
http://69.73.152.118/punbb_standard/vie … s.php?id=7
Generated in 0.026 seconds, 9 queries executed

Thank you all for your help! I think it is excellent!

I will release it as a mod, crediting all the work to guardian34, elbekko and Smartys. smile

Once more: THANKS, and a happy new year (if you're on a gregorian calendar wink)!

After some testing, I'm having a small minor concern.

With the code I get 40 queries in a full page, without the code I get 15 queries.

To my understanding this affects the perfomance, right?

How can we optimize the working code above? smile

cool

Many thanks.
As far as I can see IT WORKS! Clap, clap, clap.

Best wishes to you and yours. smile
Thank you too elbekko! smile

Should it be released as a mod?

First post in topic is #8.
Reported post is #12.

With your alteration:

$result = $db->query('SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id LEFT JOIN '.$db->prefix.'online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id='.$id.' ORDER BY p.id LIMIT '.$start_from.','.$pun_user['disp_posts'], false) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());

Debug:

Debug information
Time (s) Query 
0.00110 SELECT u.*, g.*, o.logged, o.idle FROM users AS u INNER JOIN groups AS g ON u.group_id=g.g_id LEFT JOIN online AS o ON o.user_id=u.id WHERE u.id=3 
0.00012 UPDATE online SET logged=1166725662 WHERE user_id=3 
0.00010 UPDATE online SET current_page='/punbb_standard/viewtopic.php', current_ip='213.22.18.126', current_page_id='7' WHERE user_id='3' 
0.00013 SELECT * FROM online WHERE logged<1166725362 
0.00077 SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, s.user_id AS is_subscribed FROM topics AS t INNER JOIN forums AS f ON f.id=t.forum_id LEFT JOIN subscriptions AS s ON (t.id=s.topic_id AND s.user_id=3) LEFT JOIN forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=4) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id=7 AND t.moved_to IS NULL 
0.00021 SELECT search_for, replace_with FROM censoring 
0.00078 SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM posts AS p INNER JOIN users AS u ON u.id=p.poster_id INNER JOIN groups AS g ON g.g_id=u.group_id LEFT JOIN online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id=7 ORDER BY p.id LIMIT 0,25 
0.00033 SELECT DISTINCT reported_by FROM reports WHERE post_id = 8 AND zapped IS NULL 
0.00022 UPDATE LOW_PRIORITY topics SET num_views=num_views+1 WHERE id=7 
Total query time: 0.00376 s

Result: first post (not reported #8) shows with "This post has been marked as objectionable and is awaiting staff review."
Second and third post (reported #12) don't even show.

Tricky. smile
Keep it coming big_smile
Thanks. smile

See it in action:
Modified viewtopic.php http://69.73.152.118/punbb_standard/viewtopic.php?id=7
Original viewtopic.php http://69.73.152.118/punbb_standard/viewtopic1.php?id=7

Thanks for your support elbekko! smile

As you've suggested I'm trying this:

$result = $db->query('SELECT DISTINCT reported_by FROM '.$db->prefix.'reports WHERE post_id = '.$cur_post['id'].' AND zapped IS NULL', false) or error('Unable to fetch report info', __FILE__, __LINE__, $db->error());

And it still only shows the first post out of three. hmm

Debug information
Time (s) Query 
0.00108 SELECT u.*, g.*, o.logged, o.idle FROM users AS u INNER JOIN groups AS g ON u.group_id=g.g_id LEFT JOIN online AS o ON o.user_id=u.id WHERE u.id=3 
0.00012 UPDATE online SET logged=1166725156 WHERE user_id=3 
0.00010 UPDATE online SET current_page='/punbb_standard/viewtopic.php', current_ip='213.22.18.126', current_page_id='7' WHERE user_id='3' 
0.00013 SELECT * FROM online WHERE logged<1166724856 
0.00075 SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, s.user_id AS is_subscribed FROM topics AS t INNER JOIN forums AS f ON f.id=t.forum_id LEFT JOIN subscriptions AS s ON (t.id=s.topic_id AND s.user_id=3) LEFT JOIN forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=4) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id=7 AND t.moved_to IS NULL 
0.00025 SELECT search_for, replace_with FROM censoring 
0.00076 SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM posts AS p INNER JOIN users AS u ON u.id=p.poster_id INNER JOIN groups AS g ON g.g_id=u.group_id LEFT JOIN online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id=7 ORDER BY p.id LIMIT 0,25 
0.00038 SELECT DISTINCT reported_by FROM reports WHERE post_id = 8 AND zapped IS NULL 
0.00022 UPDATE LOW_PRIORITY topics SET num_views=num_views+1 WHERE id=7 
Total query time: 0.00379 s

Thanks.

Hi,

Thanks for your time with this. I really appreciate it! smile
Happy holidays if it's the case! wink

I've already tried something like that but it only displays the 1st post of the topic not parsing the rest.

With original viewtopic.php, showing 3 posts:

Debug information
Time (s) Query 
0.00131 SELECT u.*, g.*, o.logged, o.idle FROM users AS u INNER JOIN groups AS g ON u.group_id=g.g_id LEFT JOIN online AS o ON o.user_id=u.id WHERE u.id=3 
0.00014 UPDATE online SET logged=1166722642 WHERE user_id=3 
0.00011 UPDATE online SET current_page='/punbb_standard/viewtopic.php', current_ip='213.22.18.126', current_page_id='7' WHERE user_id='3' 
0.00015 SELECT * FROM online WHERE logged<1166722342 
0.00083 SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, s.user_id AS is_subscribed FROM topics AS t INNER JOIN forums AS f ON f.id=t.forum_id LEFT JOIN subscriptions AS s ON (t.id=s.topic_id AND s.user_id=3) LEFT JOIN forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=4) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id=7 AND t.moved_to IS NULL 
0.00022 SELECT search_for, replace_with FROM censoring 
0.00088 SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM posts AS p INNER JOIN users AS u ON u.id=p.poster_id INNER JOIN groups AS g ON g.g_id=u.group_id LEFT JOIN online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id=7 ORDER BY p.id LIMIT 0,25 
0.00028 UPDATE LOW_PRIORITY topics SET num_views=num_views+1 WHERE id=7 
Total query time: 0.00392 s

This is viewtopic.php with the above code and with the result of only showing the first post of a topic:

Debug information
Time (s) Query 
0.00112 SELECT u.*, g.*, o.logged, o.idle FROM users AS u INNER JOIN groups AS g ON u.group_id=g.g_id LEFT JOIN online AS o ON o.user_id=u.id WHERE u.id=3 
0.00012 UPDATE online SET logged=1166722500 WHERE user_id=3 
0.00010 UPDATE online SET current_page='/punbb_standard/viewtopic.php', current_ip='213.22.18.126', current_page_id='7' WHERE user_id='3' 
0.00013 SELECT * FROM online WHERE logged<1166722200 
0.00081 SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, s.user_id AS is_subscribed FROM topics AS t INNER JOIN forums AS f ON f.id=t.forum_id LEFT JOIN subscriptions AS s ON (t.id=s.topic_id AND s.user_id=3) LEFT JOIN forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=4) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id=7 AND t.moved_to IS NULL 
0.00024 SELECT search_for, replace_with FROM censoring 
0.00074 SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM posts AS p INNER JOIN users AS u ON u.id=p.poster_id INNER JOIN groups AS g ON g.g_id=u.group_id LEFT JOIN online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id=7 ORDER BY p.id LIMIT 0,25 
0.00036 SELECT DISTINCT reported_by FROM reports WHERE post_id = 8 AND zapped IS NULL 
0.00022 UPDATE LOW_PRIORITY topics SET num_views=num_views+1 WHERE id=7 
Total query time: 0.00384 s

As I can see it, the sugested code breaks this loop:

while ($cur_post = $db->fetch_assoc($result))
{
    $post_count++;
    $user_avatar = '';
    $user_info = array();
    $user_contacts = array();
    $post_actions = array();
    $is_online = '';
    $signature = '';

By adding one variable that isn't reset.

But I don't have any experience or whatever with PHP or programming. I'm just a curious.

Thanks in advance. smile

Hi,

As this is my first message here I would like to say this: nice software and thanks. smile

I found this code to hide reported content here.

if ($pun_user['g_id'] > 2)
{
    $result = $db->query('SELECT DISTINCT reported_by FROM '.$db->prefix.'reports WHERE topic_id = '.$id.' AND zapped IS NULL') or error('Unable to fetch report info', __FILE__, __LINE__, $db->error());
    if ($db->num_rows($result) >= 3)
    {
        message('Content contained in this topic has been marked as objectionable and is awaiting staff review. Please try again later.');
    }
}

Now, I want this but applied to posts, not topics. I found that around line 328 in viewtopic.php the message is displayed.

The code is:

<?php echo $cur_post['message']."\n" ?>

Any ideas how to do it?

Thanks in advance. wink