smile cuteseal - also see my reply on your news/blog script
http://punbb.org/forums/viewtopic.php?id=3818&p=2
which will allow you to include the script without having the make a http call.

Cool beans - thanks Paul for the pointer to this thread...

All in - not too difficult to install.

For the Postgres users out there, you'll need to use:

ALTER TABLE [forum-prefix]forums ADD reply_only SMALLINT;
update [forum-prefix]forums SET reply_only = 0;


Finally, cuteseal - couple of things:

In your viewforum diff, the logic gets a little hairy I prefer making it a little more explicit - You have:
79     if ($pun_config['p_guests_post_topic'] == '0' && $cookie['is_guest'] || $pun_config['p_users_post_topic'] == '0' && $cur_user['status'] < PUN_MOD || $reply_only == 1 && $cur_user['status'] < PUN_MOD)

It should be:
if ( ($pun_config['p_guests_post_topic'] == '0' && $cookie['is_guest']) || (($pun_config['p_users_post_topic'] == '0' || $reply_only == 1) && $cur_user['status'] < PUN_MOD))


Also in admin_forums (line 146) you need to add:
if ($cur_reply_only != '1') $cur_reply_only = '0';
or postgres will b0rk.

Now it works lovely smile

I only dread when punBB 1.2 is released - all this updating will make us not want to have to go through this again. sad

Cheers,

Paul.

28

(72 replies, posted in General discussion)

Paul and Cuteseal,

Thanks for the pointers.

Paul - I couldn't find a Reply Only forum mod - only a general Admin Options to prevent guests/users from starting topics - which has the same effect on an install wide basis.

cuteseal - very nice. I presume you wrote this?  If so, congrats.

I had a few issues with it though - by default, I was getting each topic in the correct (reverse) order, however I was getting the last comment instead of the first post in the thread (if I had followed up to a comment).  I solved this by adding a ORDER BY posted in your query on line 266.

Next, line 269 is missing a comment 'Display first paragraph only'

I also wanted to display more than the arbitrary first paragraph, so I changed your preg_split to an explode on 3 new lines (i.e. posts have 2 blank lines between 'summary' and 'body'):

        #Display first paragraph only (comment out next four lines to turn off)
        #$paragraph = preg_split("/\s*\n+/", $cur_post['message']);
        $cur_post['message'] = str_replace("\r", '', $cur_post['message']); // get rid of any CR in a \r\n style newline
        $paragraph = explode("\n\n\n", $cur_post['message']);
        if (isset($paragraph[1])) {


You can see my first working draft at http://www.pgregg.com

Thanks, I'll prob tweak it more...

Oh, and I didn't want to call it via http:// as that makes an extra hit in the logs, so I ran it by:

$_GET['action']='new';
$_GET['show']=10;
$_GET['fid']=1;

ob_start();
chdir($_SERVER['DOCUMENT_ROOT'] . '/forums');
include("forums/externnews.php");
$blog = ob_get_contents();
ob_end_clean();

$blog = str_replace('img/smilies', 'forums/img/smilies', $blog);

print '<br>'.$blog;

And removed all the calls to exit; in your code (which I think are redundant with the if/else structure you have used).

Again, thanks.

Cheers

29

(72 replies, posted in General discussion)

Cool, Cheers guys.  I had actually seen the shuttertalk link before - very nice... I'll have a play over the weekend - Reply only is def the way to go.

30

(72 replies, posted in General discussion)

I'm moving my website from one machine to another - in the process I want to replace mysql with postgres/pgsql.  Part of this is looking for a replacement for S9Y (www.s9y.org) PHP blog software (it's large, unweildy, a feck to customise, etc) so started looking for alternatives...

Not using mysql pretty much removes everything out there...

Then it hit me...   What is a blog anyway?

I write an article and it gets saved in a db.
My home page pulls it from the db and displays it.
Others comment on that article.

mmm, sounds like a forum to me - surely it would be trivial to extend PunBB to blogging?  Built in searching, archiving, etc - those who like the forum interface can read that way.

?

31

(54 replies, posted in Feature requests)

Now now mindplay, you didn't look at it too deeply now did you? wink

You just described the non-default non-javascript option of that page.  The default javascript one creates a javascript function where the data has every alternate character transposed and then the whole thing is escaped. smile

Paul.

nice smile

33

(54 replies, posted in Feature requests)

General comments (from a little experience).

1. Percentage of browsers with javascript disabled is nowhere near 8%.  Maybe in years gone by - but not now.  Probably in the 1-3% range.  The web (commercial websites) is pretty much useless without javascript.  *Most* users are not techies like us and, unfortunately, we make up much less of a percentage than we used to wink

2. Graphic versions - no way - I agree with most - this is such oerkill.

3. I'm seeing a definate tendancy to want to ignore this.  I can see mindplay's argument - spam is a problem.  I can also see Rickard's desire to keep things simple (tho I think you're pushing the credibility by the 'read html source' angle).

4. As has been commented - it is only a matter of time before spammers look to decode javascript emails, however there is a cost/benefit argument.   They are not doing it now, and it doesn't pay them to do it.  Maybe when more people start obfuscating their address (be honest, this one is still pretty much a 'techie who is aware' area) then spammers might take notice.   When they do, the first one to fall will be the 'mailto;' + '....  simple javascript method.

5. This isn't such a big hit on performance (or in php code) to do. See: http://www.pgregg.com/projects/encode/htmlemail.php  Source code available on that page.   If Rickard wants to use the code there, please do.

Paul.

I came across this when I found PunPoll doesn't check what it is entering into the database [Security alert!!!], so looked at the punbb code to see if you had a standard way of doing it...  So before getting chacmool to fix punpoll it would be better to have a db independent method for him (and other mod devs) to use.

I would suggest adding a db_quote() function to common/db_layer.php which contains a switch on $db_type and returns the argument properly quoted for the database type.  [Edit: or a db_quote() placed into the include/dblayer/dbname.php per database include]

addslashes() will only go so far - and will definately not work for DBs such as Oracle and sqlite (which I believe you are adding).

mysql: mysql_escape_string ()
pgsql: pg_escape_string()
sqlite: sqlite_escape_string()

Thoughts?

Patch available to add pgsql to PunPoll.

http://punres.cactuz.nu/projects/forum/ … .php?id=44

http://php.pgregg.com/PunPoll-v1.2.3_2- … h.diff.txt

36

(1 replies, posted in PunBB 1.2 bug reports)

Email headers should use \r\n instead of \n

Here is a patch to email.php to fix:

diff -r ./include/email.php ../../../../web/php.pgregg.com/forums/include/email.
php
74c74,76
<       $headers = 'From: '.$from."\n".'Date: '.date('r')."\n".'MIME-Version: 1.0'."\n".'Content-transfer-encoding: 8bit'."\n".'Content-type: text/plain; charset='.$lang_common['lang_encoding']."\n".'X-Mailer: PunBB Mailer';
---
>       $message = str_replace("\n", "\r\n", $message);
>       $crlf = chr(13).chr(10);
>       $headers = 'From: '.$from.$crlf.'Date: '.date('r').$crlf.'MIME-Version: 1.0'.$crlf.'Content-transfer-encoding: 8bit'.$crlf.'Content-type: text/plain; charset='.$lang_common['lang_encoding'].$crlf.'X-Mailer: PunBB Mailer';


Hope this helps.... Nice board (just d/l yesterday).

Oh (reason I found it) - Qmail MTA b0rks if you don't do it right.

Quick note - punpoll only works with mysql.  Don't use this is you are using postgres.    I'm looking forward to this being DB independent as I'll install it right away. smile

Hi,

The install.php script doesn't let you install without a hostname entry.  This means you can't use the "default" postgres access and have to turn on tcp sockets and expose the database to a socket.

Anyway this can be fixed to allow the more "normal" socket file access that is used to access databases (both pgsql and mysql) running on the same host?

Thanks,

Paul.

PS. I should add, this is the latest code - downloaded today.