Isn't the idea of this mod to install it before the spammers come around your forums? tongue

202

(12 replies, posted in Programming)

Ah. That was the other interpretation that I hoped wasn't it smile

An easier way to solve this would be:
Forget about the auto-increment.
Get the highest ID before insertion, add 1 and give this id to the new entry for the ID field and the parent field if it's the first in thread. The replies will get that id as parent as well. So all comments in one threads have the same parent ID. Clear?

Now you can use one query, sort by parent and id.
For each row, keep the last id and parent for comparison.
Then create a variable for the padding space.
Now, if in one row the new parent is the ID of the last row then you know you have to add another padding divs to your output.
As long as the parents stay identical keep the number of padding divs.
If the next parent is different without being the id of the previous row then substract one padding div.

Now, ain't that easy? smile

OK OK, I'll try to write it down but don't blame me if it doesn't work 100%, it's just a sample for what I mean

//Get the highest id
$highest= $db->query("SELECT max(id) as MAXID FROM comments");
$mm = $db->fetch_assoc($highest);
$max = ($mm['MAXID'] + 1);
// Insert one row with a thread starter
$newrow = $db->query("insert into comments (id, parent, text) values (" . $max .", " . $max . ", '" . $text . "'");

//Now get the threads
$all = $db->query("select * from comments order by parent, id");
$padwidth = 8;
while ($sb = $db->fetch_assoc($all)){
  if($all['parent'] == $oldid)  {
    $padwidth += 8;
    $oldparent = $all['parent'];
    }
  elseif($all['parent'] != $oldparent)  {
    $padwidth -= 8;
    }
  echo '<div style="padding-left:' . $padwidth . 'px;">' . $text;
  $oldid = $all['id'];

  
}

Something like this. No warranty. Just a rough sketch... smile

203

(48 replies, posted in General discussion)

dmz wrote:

I merely stated a fact: the overwhelming cost to change 300 million people over to the metric system would not be a trivial task and would cost billions.

And in the long run, seeing all this globalization thingy going on, it would save billions....

dmz wrote:

Suck it up.  It is what it is and likely won't change until China takes over the world.

Well then - I'll lean back and wait. Can't be too long.
And you know why? Because they are so bloody flexible wink

204

(12 replies, posted in Programming)

I am not sure what exactly you mean.

Do you mean you have a table with, say, articles and another table with comments on articles?
In this case you will have a field article_id in your article table and one article_id in your comments table.
So all you do is make a query like this

select * from articles, comments where articles.article_id=comments.article_id

205

(15 replies, posted in PunBB 1.2 discussion)

That brings up another topic:
How do you want to authenticate posts sent by email or by a form sent through an email program?
Every time you send a post this way you would end up on the website tat will ask for your username/password....

Or you allow posts by unauthenticated users. in this case your board will have 10.000 posts within a day I'm sure wink

206

(48 replies, posted in General discussion)

dmz wrote:

You guys keep insisting that our systems of measure are "non-trivial" to "figure out" and that's only because we're "Americans" and "used to it".  Does the reverse not apply?

Well, I don't say that anything is non-trivial or bad just because it's used by Americans. That would be slightly stupid.
However, when it comes to integration and world wide standards you always have two options: Either you leave it or one party has to adjust to the other.
If you go for the latter option then who should adjust? The ones with the easier system? (And please don't tell me that by logic and rational argumentation a decimal system is not easier to understand, use, compute...) Or the ones who want to keep their system because... well, because what? They are used to it? wink Even though they only make up for 5% of the world population?

dmz wrote:

Then consider the cost and ask yourself why we haven't made the switch.

OK, then go and consider the cost for the other 95% of this planet. How do you call that in football if somebody hits their own goal by accident? wink

But as I mentioned, I think exactly this kind of argumentation without real arguments lead to the world being a difficult place and things will just stay as they are...

Well, I don't see anything. Which can be a good or a bad sign... smile
At least there is no error appearing so I figure it works OK.

Now, that is one useful mod!

Thanks, I will definitely give it  a try.

209

(48 replies, posted in General discussion)

Ethan wrote:

I'm American so I am very use to the Imperial system and I will never ever support moving away from it.

Which, as an attitude, is exactly what makes this planet a very cumbersome place at times.
If everybody thought like that you'd have 6 billion people who refuse to speak a second language because their own is just perfect. wink

Ethan wrote:

US dates aren't hard to figure out.

No, not if you're American. You should spend some time thinking yourself into somebody's brain who is not from America. Which is still 95% of the world population wink

I agree with Rickard that a unified date system would really help understanding each other.
If you want to be a worldwide community it does not help if everybody refuses to give up old habits.
I remember the big laments of the British when they had to introduce the decimal system to their currency 20 years ago.
Today nobody talks about it anymore...

Heheh... that'll teach them... smile

211

(6 replies, posted in PunBB 1.2 discussion)

Needs some tweaking but why not?

If you want to show the user's real name you open viewtopic.php, go for line 186 (or around there) and change this:

$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'], true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());

To this

$result = $db->query('SELECT u.email, u.title, u.realname, 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'], true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());

and then go for line 200 or around and change

$username = '<a href="profile.php?id='.$cur_post['poster_id'].'">'.pun_htmlspecialchars($cur_post['username']).'</a>';

to

$username = '<a href="profile.php?id='.$cur_post['poster_id'].'">'.pun_htmlspecialchars($cur_post['realname']).'</a>';

That should do the trick.

Forcing people to enter their real name, however, is a lot more difficult because it involves forcing them to enter another profile page and enter something there.....

That sounds tricky.
I found this in login.php

    if (!$authorized)
        message($lang_login['Wrong user/pass'].' <a href="login.php?action=forget">'.$lang_login['Forgotten pass'].'</a>');

The function message calls header.php which includes main.tpl, and I think you shouldn't change that.
So you will have to make an extra function like message() but with your own template instead of main.tpl or you have to tweak the message function itself.

213

(13 replies, posted in Feature requests)

Yeah, that looks like the one I suggested, more complex of course.
Anyway, I'd love to see the result, just to convince me that machine translations are of any use. wink
The ones I've seen so far were pretty worthless without lots of manual corrections

214

(13 replies, posted in Feature requests)

translatumgr wrote:

Connorhd,

I know ):

This is not my first project of this type. However, this is not what I was asking.
I'll find a way to do it myself using regular expressions to hide the untranslatable bit.

I also don't get this completely.
There is nothing but the lang files and the only untranslatable stuff there are the array keys.
Why do you have to hide them?
Well, a good guess anyway would be to apply a regex on each line that goes like

/([^=]+)/

which would collect all the array keys.

Or, make a small script that read the lang files and prints only the values. wink

215

(1 replies, posted in PunBB 1.2 show off)

I had a very happy day translating the complete documentation to German (well, it was time to read it once anyway.. smile )
so for those of you who are more comfortable with german you can find it here:
PunBB Dokumentation auf Deutsch

216

(1 replies, posted in PunBB 1.2 show off)

I decided the other day to set up a PunBB site in German. After all ther are quite a few native German speakers out there and not all of them speak English. And why leave it all to phpBB who have an active German community? wink
I'll try to add a bit of localization to PunBB and I hope that there will be others who will contribute one way or the other.

The older ones of you know and fear my styling, so this time I tried to keep the colour scheme moderate wink

The URL is listed on the forum start page here but otherwise:
http://punbb.disorder.de

217

(20 replies, posted in PunBB 1.2 show off)

You could have left the copyright to Rickard though......

218

(28 replies, posted in Programming)

Something like

$sql = ereg_replace($this->prefix ."users", "YOURTABLEusers", $sql);

Should work .
It must be placed in line 76 of include/dblayers/mysql.php

Replace YOURTABLE with the prefix of the usertable that you want to use.

219

(5 replies, posted in PunBB 1.2 discussion)

Ah.

There are two threads with the name "Google AdSense" and since that guy's post didn't exist anymore I didn't know which.
I only found on ein the search so I went there to look.

I am subscribed to the other one so that is solved.
Sorry for waking you up. wink

Well,
although it is really unpolite to laugh at somebody who made an effort to help out others  I agree that this doesn't look user friendly at all.

But then again, if people want it like this, why not?
People want Windows, you know... smile

221

(5 replies, posted in PunBB 1.2 discussion)

Smartys wrote:

He could have posted and deleted his post, and you might have subscribed accidentally smile

I checked if I subscribed accidentally, but then on the bottom it should have said "unsubscribe from this thread" which it didn't.
Plus, I may be a bit demented at times but I am really sure I didn't subscribe. I swear..... smile

222

(7 replies, posted in Programming)

Yes, you can, and it is especially useful when you have fields with flags (like status=1, status=2 etc) where the numbers don't reflect the order that you want them to appear.

223

(5 replies, posted in PunBB 1.2 discussion)

I just got an email from the punBB forum mailer.

It went:
===========
Ruckus has replied to the topic 'Google AdSense' to which you are subscribed. There may be more new replies, but this is the only notification you will receive until you visit the board again.

The post is located at http://punbb.org/forums/viewtopic.php?pid=51776#p51776"
===========

Now:
first: I never subscribed to this thread
Second: The user list says that user Ruckus has made exactly one post, but when you click to see the post it doesn't show up.

WTH is going on? smile

224

(2 replies, posted in PunBB 1.2 discussion)

As far as PunBB is concerned there will be no problem.

That's right.
Actually, in my original post I recommended to move the password file out of the document root and adjust the admin_common.php accordingly.