jacobswell wrote:

something missing in the code of parser.php.

missing code for [*].

    $pattern = array('#\[b\](.*?)\[/b\]#s',
                     '#\[i\](.*?)\[/i\]#s',
                     '#\[u\](.*?)\[/u\]#s',
                     '#\[url\](.*?)\[/url\]#e',
                     '#\[url=(.*?)\](.*?)\[/url\]#e',
               '#\[list\](.*?)\[/list\]#si',
               '#\[\*\]#si',
               '#\[size=(.*?)\](.*?)\[/size\]#si',
               '#\[font=(.*?)\](.*?)\[/font\]#si',
               '#\[align=(.*?)\](.*?)\[/align\]#si',
                     '#\[email\](.*?)\[/email\]#',
                     '#\[email=(.*?)\](.*?)\[/email\]#',
                     '#\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)\[/color\]#s',
                     '#\[----\]#s'
    );

    $replace = array('<strong>$1</strong>',
                     '<em>$1</em>',
                     '<u>$1</u>',
                     'truncate_url(\'$1\')',
                     'truncate_url(\'$1\', \'$2\')',
               '<ul>$1</ul>',
               '<li>',
               '<font size=\'$1\'>$2</font>',
               '<font face=\'$1\'>$2</font>',
               '<p align=\'$1\'>$2</p>',
                     '<a href="mailto:$1">$1</a>',
                     '<a href="mailto:$1">$2</a>',
                     '<span style="color: $1">$2</span>',
               '<hr>'
    );

[----] means horizental line. I added for me. Great Job. thanks.

Here's a PHP programming tip to make the management of the above _much_ nicer:

$patternreplace = array(
  '#\[b\](.*?)\[/b\]#s'     => '<strong>$1</strong>',
  '#\[i\](.*?)\[/i\]#s'       => '<em>$1</em>',
  '#\[u\](.*?)\[/u\]#s'     => '<u>$1</u>',
  // etc
  );

$pattern = array_keys($patternreplace);
$replace = array_values($patternreplace);

Hope this helps.

Paul.

2

(10 replies, posted in Feature requests)

Hi Rickard.

I'm guessing v 1.2 is at least some ways along the dev path...  so do you have any specs or APIs on how you plan on making mods / plugins easier?

This would prove quite useful for both those with mods and wanting to develop them.

Thanks,

Paul.

3

(14 replies, posted in PunBB 1.2 troubleshooting)

Rickard wrote:

What I meant was that why does it matter what the reply-to address is since nobody replies (or should reply) to e-mails sent out by the forum. Why would you ever want to reply to e.g. a notification e-mail?

Oh, you would be surprised...   I run a forum (not punBB wink for a _highly_ technical software company - the kind that has people (techies) like Microsoft, Oracle, Nasa, etc as clients.  The forum sends out notification emails with:

        ******************************************************
           PLEASE DO NOT REPLY TO THIS EMAIL.
           THIS IS AN INFORMATION MESSAGE ONLY AS YOU ASKED
           TO BE INFORMED OF ANY REPLYS TO YOUR POST.
        ******************************************************

I regularly get replies from people thinking they are replying to the original author! roll

Saw this the other day... well funny.

http://r-e.co.il/article/0406251157/

Your call dude... As you can see from that site, there are many regexs available - none of which are proven correct.  From a cost benefit point of view (esp since this is only used during registration or guest posts?) the minor performance difference isn't going to hurt a dot.

Then what about when someone says "I use .@foo.a which is a new alternative TLD from NewNet" are you going to decypher the regex in use to help them?

Path of least resistance....

email val regex are a pita... You might like to use my function version - which has the added benefit of acutally being able to understand it wink  And users will be able to tweak it without too much difficulty.

http://www.pgregg.com/projects/php/code … l.inc.phps

7

(25 replies, posted in PunBB 1.2 troubleshooting)

Guess they have removed sendmail then.  Start reading up on cURL - you will be able to use curl to make a e.g. curlmail() function which creates a POST to your formmail.pl script to send the email.

It's a non-trivial task - not impossible, but beyond the scope and time I have available here.  Good luck.

include/functions.php:
function generate_navlinks(), around line 180 is what you're looking for.

I replaced it with:
$links[] = '<a href="/">pgregg.com</a> | <a href="index.php">Forum '.$lang_common['Home'].'</a> | <a href="userlist.php">'.$lang_common['User list'].'</a>';

9

(25 replies, posted in PunBB 1.2 troubleshooting)

Ludo wrote:

Sorry to have problem to understand but In which file must I ad or modify this code?

PS: please could you edit your last post and modify the email adress you write in order to avoid spam. For example, you can write ludo at free dot fr and ldevergne at free dot fr. I thank you for this.

Just put it in it's own php file and run it - it is a test to see if we can make PHP send an email.

Email changed.

10

(25 replies, posted in PunBB 1.2 troubleshooting)

RNilsson wrote:

Even using a empty 5th arg will give error on win32.

I'm sorry, but that information is incorrect.  PHP will not error, neither will it give a warning if you pass a 5th argument to mail() on Windows.  It will simply ignore it.

11

(25 replies, posted in PunBB 1.2 troubleshooting)

Hmm, ok - this might work:

$email = <<<EOMAIL
From: ludo <ludo at free d0t fr>
To: ludo <ludo at free d0t fr>
Subject: Test

testing

EOMAIL;
$fh = popen('/usr/sbin/sendmail -t -i', 'w');
fwrite($fh, $email);
fclose($fh);

If this works, then there is your method for sending emails...

12

(25 replies, posted in PunBB 1.2 troubleshooting)

Ludo wrote:

sorry but I don't know what shell access is.... so I think I don't have any access unless I would certainly know it.

Second, I had a look at curl but it's very hard for me. I just wanted to have an easy solution for my problem. Am I the only one to have this kind of problem?

I guess you dont have shell access then.

look in phpinfo() and let us know what sendmail_path is set to.  Also ask your host why mail() is broken or disabled.  It is very rare for ISPs to disable mail() since that's perhaps the single most useful feature in PHP (for companies hosting their sites).

RNilsson wrote:

I've had some problems dealing with mail() and the 5:th arg in a win32 dev env.
Just FYI.

Well, I hate to be the one to point this out, but the 5th arg is (as the manual notes) is passed as additional parameters to the sendmail_path program, which by definition is unix only; therefore the 5th arg has no relevance to Win32.

13

(25 replies, posted in PunBB 1.2 troubleshooting)

Ludo wrote:

I've forgotten to tell you that the webserver on which is intalled punbb does not allow mail with php but only with cgi. For example, my provider give this script to send mail :
<FORM METHOD="POST" ACTION="http://perso0.free.fr/cgi-bin/form2mail.pl">

So I think the problem is here but I don't know how to resolve it.

Oh dear!  Well this certainly puts the cat among the pigeons.... sad

Ludo wrote:

Return-Path: <ldevergne ats free dot fr>
...

This probably isn't going to help, but it shows that the local machine runs postfix and that the form2mail.pl injects directly to this.  The machine is not running (or listening) on the SMTP port, so you can't use the SMTP method.


First thing to try: Do you have shell access?  If so, look up some documentation on postfix and find out what program controls the injection of email from the shell.  Even if you don't have shell access, find this out anyway.  Then you're going to have to do some hacking of email.php.  If you aren't good with PHP, then I'd give up now, because this involves a popen() to open a handle to the injection program and then fwrite() to manually enter the email including headers.

The second option, is another hack job sad  It involves reading up on cURL www.php.net/curl and having PHP generate a POST call to your formmail.pl url to send the email.

Good luck.

Ok, $styles isn't defined or initialized _anywhere_ in punBB, so I presume rADo uses that variable in something else he does, which punBB is conflicting with.  That it is set to a string, then pubBB tries to append to is will cause that warning.

I'm afraid the correct fix is just that, to init the variable before punBB uses it since punBB currently assumes it is unset.

15

(25 replies, posted in PunBB 1.2 troubleshooting)

Ok, I there's several different issues at play here, so lets eliminate the red herrings and focus on the problem.

When you try to use SMTP - it doesn't connect.
When you try to use the local mailer it has the wrong email address.

So first, lets ignore the SMTP method.

So, using the local mailer, punBB injects the email via PHPs mail() function via its own pun_mail() wrapper function in includes.email.php

Depending on your PHP install *AND* the mail injection program that is used this MAY result in the SMTP envelope address using the From: address you specify - otherwise it MAY end up as the user@host that the webserver runs as - regardless of any admin options you set in punBB.

So, the question now is - What emailer is running on the punBB webserver?
Also, what is the sendmail_path = line in your php.ini
Finally, can you post as sample header from an email that is delivered via this route?

Given these answers, I am sure I can point you in the right direction.

Paul.

[addition] Rickard: you might like to change the email.php from:
function pun_mail($to, $subject, $message, $from = '')
to
function pun_mail($to, $subject, $message, $from = '', $extra='')

and the call from:
mail($to, $subject, $message, $headers);
to
mail($to, $subject, $message, $headers, $extra);

to prepare the code to be able to pass "-f [adminemail]" in the extra arg for some webservers.

Other MTAs such as QMAIL, you have to use: (iirc)
putenv('QMAILSUSER=sendername');
putenv('QMAILSHOST=senderhost');
before you call the mail();

simmo wrote:

Is there any way to customize the appearance ?

eg: adding background colors to the title etc etc ?

Um, re-read this thread again... cuteseal already posted the CSS that does this.

Mmmm, oh dear Rickard - using variables without declaring them ;-)

Anyway, I looked in my code - which I thought was 1.1.4 but it is totally different!

while (($entry = $d->read()) !== false)
                {
                        if (substr($entry, strlen($entry)-4) == '.css')
                                $styles[] = substr($entry, 0, strlen($entry)-4);
                }

Now I appreciate that the {} are redundant and the css check in this is better than the one rADo posted (more correct) - but why are they different?

My last point (which was why I started a followup in the first place wink is that you can use if(substr($entry, -4) == '.css') and substr($entry,0,-4) here and save a couple of strlen() calls.

Oh, ok... smile

 Make Line 266:
$msg = $db->query('SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.status, u.registered, u.admin_note, p.id, p.poster, p.poster_id, p.poster_ip, p.poster_email, p.message, p.smilies, p.posted, p.edited, p.edited_by FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id WHERE p.topic_id='.$id.' ORDER BY posted LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());

All on one line (if the above code isn't).

19

(24 replies, posted in PunBB 1.2 bug reports)

Or, in all img conversions append a ?image (or &image if the url aready has a ?) to the url. Then in the logout/login script:

if (isset($_GET['image'])) { // some lamer created a logout link in an image

20

(24 replies, posted in PunBB 1.2 bug reports)

XuMiX wrote:
pgregg wrote:

1) Add a list of _permitted_ image file types, jpg/jpeg/gif/png/etc
   then in the post submission look for [ img ] tags that don't match up.

1) is not a solution. a can rename my file so evilcode.jpg
2) --||--
3)  is not a solution, because i can use not only this url, but also smth like this evilcode.js
yeah... rather hard problem, isnt ?
the only solution i see  - is to upload images to server, then check its mime-type... by it will slow down the server greatly.... + it will do MUCH traffick...

Hmm, I don't see how 1 is not a solution.  Sure, if you want to rename your login.php to evilcode.jpg and pass all jpgs through the PHP engine then on your own head be it.  The goal is to prevent regault users from causing another user to logout - not from admins shooting themselves in the foot.

Hi Crissipos,

I found the same thing - see my post at http://punbb.org/forums/viewtopic.php?id=3818&p=2 where you'll find a fix to add to line 266.  Basically you want to add a "ORDER BY posted" to the SQL so that you get the first post in the thread.

Hope this helps.

Paul.

22

(31 replies, posted in Feature requests)

Mmm, multiple cookies might be the best cross-platform solution (from the board operator POV) - however you need to consider 2 additional factors:

a) Cookies - The browser will have to send every cookie back that it received in the past 10 minutes - introduces request latency.

b - and a BIG b) HTTP RFCs state that a HTTP Request size is a maximum of 4KBytes in size.  Now I'm guessing your cookies are small bytewise in value and smallish in name, but remember you have a 15 character overhead for each cookie.

This means that you can quickly overflow the max request size if you are reading posts or flicking through a forum.

Compounding this issue is that users of Checkpoint Firewall 1 (i.e. big business) default HTTP Request size is 1KB.

In summary, it's the easy way to do it, but will introduce big problems for many users.

Hope this helps.

Clarify - this is HTTP Request _HEADER_

Paul.

23

(24 replies, posted in PunBB 1.2 bug reports)

1) Add a list of _permitted_ image file types, jpg/jpeg/gif/png/etc
   then in the post submission look for [ img ] tags that don't match up.

2) Check it during the bbcode->html conversion - though I think 1 is better since it is done once rather than every time a post is viewed.

3) More specific - check the img url for login.php and deny it (assuming login.php is the only place action=out can work).

I'd rather not have a blanket ban on images sent from a .php page since I've several graph generation scripts that use such urls.

24

(4 replies, posted in PunBB 1.2 bug reports)

Ya, I spotted that too: http://punbb.org/forums/viewtopic.php?id=3853

25

(24 replies, posted in PunBB 1.2 bug reports)

Nice... It logged me out.