76

(72 replies, posted in PunBB 1.2 discussion)

oops ... well, I don't use a prefix myself, and I hadn't thought about that at all ... I'm not sure how to best handle that?

But I guess we'll have to use some sort of replaceable symbol, so you'd write something like <prefix>, and then PunBB can replace this with the prefix before running the query?

Or what would you suggest?

77

(72 replies, posted in PunBB 1.2 discussion)

let's take a look, where is it? smile

78

(72 replies, posted in PunBB 1.2 discussion)

Jansson wrote:

What happens if two mods changes the same line?

That can't happen - if you try to install two mods that rely on finding and changing the same part of a file, you'll get an error message, and the process will be aborted without applying any of the mods.

@Connorhd:

Yes, I thought about doing something similar ... what I had in mind, is a simple mod archive site - the mod parser function is in a separate include for this reason, and can do a "quick scan" (like it does on startup now), not fully loading the mod, but only getting the title and description etc. ... this was intended to be used for a mod archive also. What I figured is, such an archive would also expose a small script that PunMod installations can load from the outside, to check for newer versions of installed mods. This stuff isn't at the top of my to-do list right now though, but if somebody else wants to do an archive, reusing the include file should be very very simple - it's just one function call to parse and load information from a mod, and returns everything as an assoc.array ...

79

(72 replies, posted in PunBB 1.2 discussion)

By the way, I also plan on doing a separate tool, which will compare two installations of PunBB, and generate a PunMod script to automatically implement all source code changes between one installation (the original) and another (your modified installation) ...

This would be useful first of all, if you want to build a new mod - if you start with a clean installation and make your changes on that, you can then afterwards automatically generate the complete mod (minus database changes).

It would also be useful if you already have a lot of customizations applied (who doesn't), and wish to upgrade to a newer version of PunBB - you can then generate a custom mod by comparing the original release your installation is based on, to your customized one, then install a clean new updated release, and then apply your mod on it.

I've only barely started on this yet, so I don't know when it will be ready for testing...

80

(72 replies, posted in PunBB 1.2 discussion)

Any of you been testing this?

Anyone got other ideas or bugreports?

Only thing on my to-do list right now is subdirectory scanning, which will allow you to (optionally) put your mod and any external files in a subfolder - imo, this is better than zipping them, since if they were zipped, PunMod would have to unzip them all every time the page loads (to find titles and descriptions etc.) ...

If nobody else has anything, I'll probably just get that done, and stick a one-point-oh on it smile

81

(72 replies, posted in PunBB 1.2 discussion)

That seems a bit overkill? For distribution, you can already just use zip like you would for any other file ... with the SQL and CREATE commands, almost every mod can already be done in a single file anyways. Speaking of which ... smile

PunMod version 0.9.3 (BETA) has been released for testing.

Download here:

http://www.mindplay.dk/temp/punmod093.zip

New: CREATE command added, allows embedding text/script files in your mods.

New: SQL command, allows running arbitrary SQL statements through a specified PunBB database abstraction layer.

Improved: more useful error messages for mod developers.

Updated: all relevant documentation.

82

(72 replies, posted in PunBB 1.2 discussion)

Connorhd wrote:

yeh i was thinking because some mods have a little extra file and it would be much easier if it could just be one "pack"although i realise some mods have to many file that are too big to do that

Good point, I'll add a command for that too then smile

83

(72 replies, posted in PunBB 1.2 discussion)

The SQL command is definitely a good idea, I will add that.

As for create file .. I think this would clutter the .pun files too much, they wouldn't be readable - you already have the INSTALL command anwyays. Might be useful for smaller files though, I guess. Maybe I'll add this too, will see...

84

(72 replies, posted in PunBB 1.2 discussion)

well, I thought about integrating it with the admin screen, but it doesn't seem like there's much point? well, depends on how you intend to use it of course - but in any case, you should always backup the database and all scripts before applying mods, and I guess if you can do that, you already have server administration privileges of some sort, so ... I don't know, but for my own purposes, I will probably use it to apply all of my mods, and testing locally, before uploading - I don't think it would be a good idea to encourage the use of this tool as a means of just testing any mod on your production copy of your forum, since there is no way to uninstall a mod or undo the changes to the database. Doesn't seem like a good idea. Or?

85

(72 replies, posted in PunBB 1.2 discussion)

Announcing PunMod

PunMod version 0.9.2 (BETA) has been released for testing.

PunMod is a mod installation system for PunBB.

What this means, is that you can write simple mod installation scripts that apply various changes to the PunBB source code in a safe and controlled manner.

Why did I make this: well, if it's not obvious smile .. upgrading to newer versions, when you have already applied various mods, can be a lot of work - because you're most likely unable to remember which files you modified and how, so you end up having to go through the manual installation of every mod over again. Or worse, you end up not upgrading at all. With PunMod, you can safely and easily apply all your source code changes to a newer version, usually with very little or no manual work.

The syntax for mod scripts is extremely simple, somewhat similar to the original MDK-1.1 specification, and it takes only 10 minutes to learn - most of your existing mods can probably be rewritten into mod scripts in a few minutes.

Some of the most important features include:

- Apply all your mods in one go, in a transactional and safe manner: all changes are performed in memory first, so that if one or more mods fail, no changes are applied to any files.

- Apply your mods in any order: you can modify the order in which the mods are applied - for example, if there is a problem applying one mod before another, because the second mod relies on information that was changed by the previous mod, this will be detected and you can then change the order.

- Many potential problems (such as conflicting modes, different versions of the same mod, already installed mods etc.) are detected and prevented at an early stage, before any damage can be done by a mod.

This beta release includes only a few mods, one for testing and a couple of my own mods ready to install. I encourage you to download and test this release, and to start writing your own mod scripts. Detailed instructions and help for using the PunMod installer itself, is built into the script. The syntax for writing your own mod scripts is explained in the included textfiles.

WARNING: BACK UP YOUR PUNBB FOLDER BEFORE APPLYING MODS!

Please post your feedback, bug reports, suggestions, requests, ideas and favorite recipes! smile

Download here:

http://www.mindplay.dk/temp/punmod092.zip

you're right, any characters (except the logically illegal ones named by Rickard here) are allowed in usernames - I got this bug report from a user, and it turns out he was talking about the subject, not the username. sorry about the confusion then, there's no problem at all! smile

(feel free to close this thread)

well, whatever characters are permitted then smile ... it should list them.

in lang\en_register.php, I would suggest adding a comment about which characters are allowed, e.g.:

...
'Username info'                =>    'Usernames can be between 2 and 25 characters long. Please use only characters a-z, A-Z and 0-9.',
'Pass info 1'                =>    'Passwords can be between 4 and 16 characters long. Passwords are case sensitive. Please use only characters a-z, A-Z and 0-9.',
...

we've had chinese and russian users, among others, who were confused about this when they were trying to register...

89

(15 replies, posted in PunBB 1.2 discussion)

Yes, it's slow when loading, but then you only need to load once - I don't see the point in breaking it up.

Denmark is in Denmark - it's a small country in the EU, just between Germany and Sweden.

I'm not translating to chinese myself, a chinese client did that - which is why I had to make this tool smile

90

(15 replies, posted in PunBB 1.2 discussion)

(...oh, now I'm a "senior member", am I? heck, I'm not even 30 yet, quit trying to make me feel old, damnit! wink )

91

(15 replies, posted in PunBB 1.2 discussion)

alright, here's version 1.0 ... nothing much changed though, removed some junk from the code, and changed the name to "PunBB PHP Localizer" to avoid confusing it with Pun Translator (the Delphi app).

of course you're all welcome to change/improve this script, I know there's plenty that could be done to make it better - but it suits my needs just fine, I'm done with the translations I needed to make, so I'm not putting anymore time into it, sorry...

Rickard,

feel free to pop it in that "useful scripts" folder in the PunBB distrib, what's it called, you know the one I mean smile

Yes, I have made such a mod:

MultiLanguage Mod
=================

for PunBB v.1.1.x

some considerations:

- language selection will be placed as a primary function in
  the main navigational links, since we want language selection
  to be available to all users, including guests.

- language selection will not be placed on user's profile page,
  since we do not want this functionality to suddenly move there
  when the user decides to register.

- language selection will not be displayed on forum installations
  with only one installed language.

with these objectives in mind, off we go.

first, add a "language" column to the "user" table - on mysql,
this is done with the following statement:

ALTER TABLE `users` ADD `language` VARCHAR( 10 ) DEFAULT NULL;

in "config.php", after setting $language (which now determines
the default language), add an array of installed languages:

$languages = array(
    'en' => 'English',
    'de' => 'German',
    'ru' => 'Russian'
);

defining $languages in "config.php" is of course optional, and
language selection will not be present on the users' profiles
page if only one language is installed.

some sections in "common.php" need to be moved around a bit.
cut the code between the following remark and the next:

    // Check/update/set cookie and fetch user info

paste it before the section that begins with the remark:

    // Enable output buffering

then cut the code section following this remark:

    // Attempt to load the common language file

and paste that before the section with this remark:

    // Enable output buffering

these changes won't immidiately affect anything, they're just
necessary because we need to change the language setting in
check_cookie() before the language files are loaded.

so next up is "functions.php", where we have to load the
users language setting into the global $language .. go to
the function with the header:

function check_cookie(...)

add $language to the global statement, like so:

    global $language, $db, $pun_config, $pun_root, $cookie_name....
          ^ there

then find the following line:

    $expire = $now + 31536000;    // The cookie expires after a year

and paste the following chunk of code after it:

    // Switch to language specified by cookie:
    if (strlen($_COOKIE[$cookie_name.'_lang']) > 0) {
        if (file_exists($pun_root.'lang/'.$_COOKIE[$cookie_name.'_lang']))
            $language = $_COOKIE[$cookie_name.'_lang'];
    }

now we must initialize the language cookie from the user's setting
when he logs in, so edit "login.php", and find these lines:

    $result = $db->query('SELECT id, username, password, save_pass, status FROM '.$db->prefix.'users WHERE username=\''.addslashes($form_username).'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
    list($user_id, $db_username, $db_password_hash, $save_pass, $status) = $db->fetch_row($result);

change them to:

    $result = $db->query('SELECT id, username, password, save_pass, status, language FROM '.$db->prefix.'users WHERE username=\''.addslashes($form_username).'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
    list($user_id, $db_username, $db_password_hash, $save_pass, $status, $setlanguage) = $db->fetch_row($result);

find the setcookie statement:

    setcookie($cookie_name, serialize(array($db_username, $form_password_hash)), $expire, $cookie_path, $cookie_domain, $cookie_secure);

and add this line below it:

    setcookie($cookie_name.'_lang', $setlanguage, $expire, $cookie_path, $cookie_domain, $cookie_secure);

in "lang/??common.php" language files, two new strings need to be
added at the end of the "Stuff for the navigator" section:

'Language'              => 'Language',
'Language info'         => 'Select the language in which you wish to browse this forum.',

a user that isn't logged in (Guest), will have a language selection
button in their navigation bar - edit "functions.php" and find the
global statement in function generate_navlinks:

    global $pun_config, $lang_common, $cookie, $cur_user;

add $languages to it:

    global $pun_config, $lang_common, $cookie, $cur_user, $languages;

find this statement:

    return implode(' | ', $links);

and add this code just above it:

    if (isset($languages))
        $links[] = '<a href="language.php">'.$lang_common['Language'].'</a>';

"language.php" is a new script, copy the included file.

Here's the source for the "language.php":

<?php
/***********************************************************************

  Copyright (C) 2002, 2003, 2004  Rickard Andersson (rickard@punbb.org)

  This file is part of PunBB.

  PunBB is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published
  by the Free Software Foundation; either version 2 of the License,
  or (at your option) any later version.

  PunBB is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  MA  02111-1307  USA

************************************************************************/


$pun_root = './';
require $pun_root.'include/common.php';


// Load the common.php language file
require $pun_root.'lang/'.$language.'/'.$language.'_common.php';

// Switch language:
if (strlen($_GET['set_lang']) > 0)
{
    setcookie($cookie_name.'_lang', $_GET['set_lang'], $expire, $cookie_path, $cookie_domain, $cookie_secure);
    
    if (!$cookie['is_guest'])
        $db->query('UPDATE '.$db->prefix.'users SET language="'.$_GET['set_lang'].'" WHERE id='.$cur_user['id']) or error('Unable to update user language setting', __FILE__, __LINE__, $db->error());
    
    redirect('language.php', 'Switching to your selected language...');
}

$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Language'];
require $pun_root.'header.php';

?>
<table class="punspacer" cellspacing="1" cellpadding="4"><tr><td> </td></tr></table>

<form method="get" action="language.php">
    <table class="punmain" cellspacing="1" cellpadding="4">
        <tr class="punhead">
            <td class="punhead"><?php echo $lang_common['Language'] ?></td>
        </tr>
        <tr>
            <td class="puncon2cent">
<?php

echo $lang_common['Language info'].'<br><br>';

echo '<select name="set_lang">';

if (isset($_COOKIE[$cookie_name.'_lang']))
    $current = $_COOKIE[$cookie_name.'_lang'];
else
    $current = '';

foreach($languages as $langid => $langname)
{
    echo '<option'.($current==$langid ? ' selected' : '').' value="'.$langid.'">'.$langname.'</option>';
}

echo '</select>';

?>
                <br><br>
                <input type="submit" value="<?php echo $lang_common['Submit'] ?>" tabindex="4" accesskey="s">
            </td>
        </tr>
    </table>
</form>

<table class="punspacer" cellspacing="1" cellpadding="4"><tr><td> </td></tr></table>

<?php

require $pun_root.'footer.php';

93

(0 replies, posted in PunBB 1.2 bug reports)

Does PunBB search engine take special care for chinese forums? ... Chinese don't separate words with spaces like we do - each letter is a word, and thus the search engine should index every character separately ... if it indexes chinese in the same way it indexes english, no one will ever be able to find anything, except by accurately entering a complete sentence...

(???)

94

(15 replies, posted in PunBB 1.2 discussion)

@zaher

1) why would you prefer to click every string first? that doesn't make any sense to me - it's incredibly slow ... having everything on screen at once, you never even have to touch the mouse, just stay on the keyboard and do what you came to do: translate smile

2) I didn't get any notices? I'll add that error reporting line anyways though.

3) Yes, comments and code is "lost in translation" - it's not possible to simply "fix" this, as my translator works differently ... for consistency, it bases it's output files on the ORIGINAL language files - thus every translated file will have same comments, same structure etc. as the original files, which IMO they should. But hey, anyways, for chinese (and those few other languages with special character sets), manually copying in those 5-10 lines of code in *_common.php shouldn't be too much work to overcome?

4) good, yes - thanks for pointing it out.

@Rickard: it is stable already - the v1.0.x templates for simplified chinese have already been updated v1.1.x with it smile ... it's not terribly user friendly though, I'll make a few more improvements and fixes before v1.0.

Beta 2 with the listed corrections is up now.

95

(98 replies, posted in PunBB 1.2 discussion)

actually, all I'm missing to complete the set is the :X smiley, but I'm not too fond of the one in your set either...

96

(15 replies, posted in PunBB 1.2 discussion)

I've was using PunTranslator, but I had some problems with input methods and whatnot, so I finally just decided to make my own tool for it.

I'm also not a fan of making a platform dependent tool for a platform independent forum smile ... plus, having to click around in the GUI for every change is just too slow, so here's a small PHP script for translating PunBB's language files:

Download beta 1 here

I'd appreciate your help with testing.

Note that this is NOT beautiful or well commented code, and it was not optimized to look pretty - it was written in a hurry, and for functionality ...

You should be able to translate very quickly with this tool, as you can simply tab through each field in the enormous form it outputs, and edit everything one step at a time. Also, it should work with any past/future version of PunBB without changes.

Please read inside the php source for more notes and instructions - you will need to set read/write permissions for php before running the script, and you need to configure the language folders in the beginning of the script.

of course - you need a working PunBB installation, including a ready database.

98

(98 replies, posted in PunBB 1.2 discussion)

I just looked at PunBB's representation of this smiley, and I would have thought it means "furious" or at least "really, really angry". But now I can see that you're right, it does mean "sworn to secrecy" or "not saying anything".

But if existing PunBB posts already used it to express something else, smileys in those posts will make no sense if we change it.

Maybe that's only a minor problem, as not many people seem to use it in the first place...?

99

(98 replies, posted in PunBB 1.2 discussion)

okay, looks like we can agree on E for the big_smile smiley, and B for the :X smiley? (on second thought, for :X, I now like B better then A too)

so unless someone yells curses, I will declare the matter settled, and remove the other options?

100

(98 replies, posted in PunBB 1.2 discussion)

My stupid remarks aside, I think I prefer E for the :D smiley too - given that I can't convince you all to love B, which is obviously the greatest ... I could settle for E.

Any preferences for :X ? ... I think I would choose A, but I would settle for B too.

Be sure to specify if you're voting for :D or :X !