276

(13 replies, posted in PunBB 1.2 troubleshooting)

http://punbb.org/forums/viewtopic.php?id=2658

277

(12 replies, posted in General discussion)

Change

    if(regExpFile("#install_mod.*#i", './') && ($pun_user['g_id'] == PUN_ADMIN))

to

    if(regExpFile("#install_mod.*#i", './') || regExpFile("#file_2.*#i", './' || regExpFile("#file3.*#i", './')) && ($pun_user['g_id'] == PUN_ADMIN))

Also, it' sad to see that I wrote code so badly ages ago =P

Let's see...

Open functions.php
Replace

function confirm_referrer($script)
{
    global $pun_config, $lang_common;

    if (!preg_match('#^'.preg_quote(str_replace('www.', '', $pun_config['o_base_url']).'/'.$script, '#').'#i', str_replace('www.', '', (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''))))
        message($lang_common['Bad referrer']);
}

With

function confirm_referrer($script)
{
    global $pun_config, $lang_common;
    
    $baseurls = array(
        'url1',
        'url2');
    $bad = true;
    
    foreach($baseurls as $baseurl)
        if (preg_match('#^'.preg_quote(str_replace('www.', '', $baseurl).'/'.$script, '#').'#i', str_replace('www.', '', (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''))))
            $bad = false;
    
    if($bad)
        message($lang_common['Bad referrer']);
}

Note that it's untested and you can't use the admin config setting anymore.

You could also look into setting up multiple base URLs.

280

(2 replies, posted in Programming)

Google Calendar?

281

(12 replies, posted in General discussion)

Oh right, sorry tongue

282

(12 replies, posted in General discussion)

Let's see...

$result = $db->query('
    SELECT p.poster_id AS has_posted, t.* 
    FROM '.$db->prefix.'topics AS t 

LEFT JOIN '.$db->prefix.'posts AS p ON p.id=p.topic_id AND p.poster_id='.$pun_user['id'].' 
    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
    ) 
    GROUP BY p.id
    ORDER BY t.last_post DESC
    LIMIT '.$ak_limit
)

I believe that should do to group by thread.

283

(12 replies, posted in General discussion)

It's slow as crap tho. You're usually better off grouping by the repeating column, alot faster.

Apache is probably much better for balancing such great load. I bet it'd have Lighttpd in tears.

A slow query log could definitely find some bottlenecks.
Another good idea would be to implement FULLTEXT searching, to reduce search load.

There should be an install section in which you can just execute queries. I don't see how exactly this would be useful.

Changing the style shouldn't do that.

287

(51 replies, posted in PunBB 1.2 discussion)

mysql  Ver 14.12 Distrib 5.0.22

5.0.24a-standard-log

288

(3 replies, posted in PunBB 1.2 bug reports)

mt_rand() is about as random as you can get without using much more complex algorithms hmm

A solution would be to generate a few random numbers, look them up and use the first one that isn't taken.

289

(17 replies, posted in Programming)

Looks like annoying syntax when doing joins.

290

(17 replies, posted in Programming)

He's probably using pgSQL.

291

(40 replies, posted in Programming)

When searching for '*????*' it worked.

Indeed. Allowing style directly would be hell.

Ah, righty, thanks.

Hmm, I just installed FeedDemon. It looks nice, except that I haven't seen the option to order posts in a feed by date descending.

295

(9 replies, posted in General discussion)

You'll still save bandwidth.
Especially useful if you're running MediaWiki or so, that CSS is huge.

296

(9 replies, posted in General discussion)

Gzipping it is absolutely no problem.

Yeah, add it yourself wink

Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)

Pretty much.

You might want to look in further optimising stuff like mods etc.
But the best way to see server load is in the Admin panel. If it's a dedicated server, you should be able to see MySQL's slow query log and resource usage too.

Most likely, yes.

300

(40 replies, posted in Programming)

No, it searches the posts/topics itself, no more search index.

It's a MySQL feature.