Thanks, that did the trick. Is there a reason why $pun_user was not made global in the message function in the first place?

Why does the $pun_user['g_id'] variable return empty when a message is displayed for a guest?

For example when using:

message($lang_uploadimg['No permission']);

$pun_user['g_id'] is empty when you are a guest, instead of 3.

Trauma wrote:

and i want that in my news.html, the <message_news> doest not exceed 200 caracteres (or 20 word .... this values are for exemple).
how can i make for that the news_generator plugin cut the message if he exceed my caracter limit ? :s

I like to use a very useful function called snippet to shorten a string. Here it is:

function snippet($text,$length=20,$tail="...") {
    $text = trim($text);
    $txtl = strlen($text);
    if($txtl > $length) {
        for($i=1;$text[$length-$i]!=" ";$i++) {
            if($i == $length) {
                return substr($text,0,$length) . $tail;
        $text = substr($text,0,$length-$i+1) . $tail;
    return $text;

With your method, using substr("$message", 0, 120) with an example string, will give the following:

PunBB is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as pu

Using the snippet function - snippet("$message", 120) - will give:

PunBB is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as ...

So the last word is never cut.

new morning wrote:

Well, I fixed that part of the pb : I had to CHMOD all files in the 'cache' directory. Now I still can't use this mod : I get a blank screen.  can someone have a look at what happens ? ( /

Are you using the latest version of this mod (v1.3.3)? Also make sure that your  php version is not outdated, and that gd has been configured properly.

Time for a little update. Just some minor fixes - including one I am surprised no one noticed: when uploading an image where image width < max thumbnail width, and image height > max thumbnail width - the image does not resize. For example: when uploading a 80x500 pixel image. Also: decided to remove the dimensions column in the list view - makes the list view look to cluttered. If you want to enable it again, just set the $show_dim variable to "1" in the uploadimg_view.php file. wrote:

I?m wondering if you would be interested in me making a donation in exchange for a little upgrade:

Basically, I want to limit the number of pictures people can upload.   Limiting the size is great, but it would be AWESOME if I could give different groups different #s of images to upload

This would be very easy to do - so no donation necessary. Will mail you the modded version when I get a chance.

Ahmed wrote:

My PHP version has been changed to PHP Version 4.3.9, but this still not works...
The same - says that "succesful", gives links, but in "upload" folder is nothing...

Ask your system administrator to upgrade to a more recent version of php. Also make sure that gd has been configured correctly.

I will update this mod soon - will include the fix that solved cal's problem.

Hi cal - send me an email, so that we can try and fix this. Please also reactivate the php info link (test.php)

dboling wrote:

I think theres a bug in Automatic Image Upload 1.3.2.

If I define the Group Members with permissions in uploadimg_config.php it also gives the same permission to the Group New Members. My guess is that the script is not doing an exact match for the group.

The title 'New member' is not a group, but a rank. Go to the 'User groups' link in the Admin menu to create new groups.

gleb wrote:

Doesn´t seem to wotk at all for Nothing is displayed in the statistic frame? Any solution anyone?

Remember Birthday statistics will only be displayed when it is someone's birthday today. Also: make sure 'yes' is selected in the admin options for 'Users online'. If Birthdays are displayed in the calendar, and you modified the index.php file correctly, there is no reason it shouldn't work.

##        Mod title:  Calendar Categories Add-on
##      Mod version:  1.1.1
##   Works on PunBB:  1.2.*
##     Release date:  2008-07-16
##           Author:  Koos (
##      Description:  Adds category functionality to Calendar 2.0.8a with
##                    full permission control.
##   Affected files:  calendar.php
##                    calendar/config.php
##                    calendar/header.php
##                    lang/English/calendar.php
##                    plugins/AP_Calendar_Settings.php
##                    style/imports/Oxygen_cs.css
##       Affects DB:  New tables:
##                       'calendar_categories'
##                       'calendar_perms'
##                    New column in 'calendar' table:
##                       'cat_id'
##            Notes:  The functionality for tracking Posts/Topics
##                    and Birthdays has been removed.
##       DISCLAIMER:  Please note that "mods" are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##     Contributors:  seesaw

I completed a categories mod of Calendar 2.0.8a a few months ago and decided to make it available since many people have been asking for such a feature. It includes full permission control for calendar categories and also incorporates Calendar-2.0.8a beta Patch v10.

This add-on is for Calendar 2.0.8a - and has been thoroughly tested. It can also be easily uninstalled if wanted.

If you've got Calendar-2.0.7 installed, you must use the readme for calendar-2.0.7.

A special thanks to seesaw for his contributions in incorporating additional interface tweaks and user input sanitisations.

Download from

Ahmed wrote:

Tried vesion 1.1.1:::::::::::

ERROR: Unable to upload image.


I think it would be best if you contact your server administrator and ask them to upgrade to the latest version of php and make sure that GD is configured properly.

Also you can try out one more thing: Use version 1.3.1 of this mod and try to upload an image that is smaller than the thumbnail size (as set in the uploadimg_config.php file). Then check with a ftp program to see if the file was uploaded to the /uploads and /uploads/thumbs folders.

Ahmed wrote:

So I guess there is no problem.

I use just BBcode [url]and it works. Did not use any other upload mod.

Everything looks alright - except your php version is little bit outdated. Can you try to use version 1.1.1 of this mod - and then see if both the /uploads and /uploads/thumbs directories remain empty after trying to upload an image.

Ahmed wrote:

Mod does not work for me. Everything seems to work, I even got "Result
Image uploaded successfully.
Image thumbnail created successfully."

But in reality - upload folder is empty and posted code is not working becouse of this...

What could be problem that mod do not upload files to "upload" folder?

Hi Ahmed. Can you please get the following info for me - by creating a small file (e.g. test.php) containing:

        <? phpinfo() ?>

    and looking at it using a web browser:

*PHP Version


*GD Support
*GD Version


Did you change anything in the uploadimg_config.php file?

Have you successfully used other image upload mods on your forum before?

finley9 wrote:

can ANYone tell me how to display the birthdays in the board stats in index.php

I have the latest version of the calendar working on version 1.2.11

all I want is to be able to display 'today's birthdays' in the stats.

Can someone PLEASE help me smile

Hi - this can be done quite easily. Here is how I did it. This should work with both Calendar-2.0.8a beta and Calendar-2.0.7.


#---------[ 1. OPEN ]---------------------------------------------------------


#---------[ 2. FIND (line: 192) ]---------------------------------------------

    $num_users = count($users);

#---------[ 3. BEFORE, ADD ]---------------------------------------------------

//-------Birthday Code Start-------
    // today's birthdays
    $ttoday = time();
    $tdiff = ($pun_user['timezone'] - $pun_config['o_server_timezone']) * 3600;
    $ttoday += $tdiff;
    $tyear = date("Y");
    $tmonth = date("n");
    $tday = date("j", $ttoday);
$result = $db->query('SELECT id, username, birthday FROM '.$db->prefix.'users WHERE DAYOFMONTH(birthday) = '.$tday.' AND MONTH(birthday) = '.$tmonth.' ORDER BY username') or error('Unable to fetch birthday list', __FILE__, __LINE__, $db->error());

    $bdays_today = array();
    while ($pun_bdays_today = $db->fetch_assoc($result)){
        $bparts = Explode('-', $pun_bdays_today['birthday']);
        $bday_year = $bparts[0];
        $age = (strlen($bday_year)!='4')? "": "(".($tyear-$bday_year).")";
        $bdays_today[] .=  "\n\t\t\t\t".'<dd><a href="profile.php?id='.$pun_bdays_today['id'].'">'.$pun_bdays_today['username'].'</a>'.$age;
    $num_bdays_today = count($bdays_today);
//-------Birthday Code End-------

#---------[ 4. FIND (line: 223) ]---------------------------------------------

    echo "\t\t".'</dl>'."\n\t\t\t".'<div class="clearer"></div>'."\n";

#---------[ 5. BEFORE, ADD ]---------------------------------------------------

// list today's birthdays           
    if ($num_bdays_today > 0)
        echo "\t\t\t".'<dl id="bdayslist" class= "clearb">'."\n\t\t\t\t".'<dt><strong>'."Today's birthdays".': </strong></dt>'."\t\t\t\t".implode(',</dd> ', $bdays_today).'</dd>'."\n\t\t\t".'</dl>'."\n";
        echo "\t\t\t".'<div class="clearer"></div>'."\n";

#---------[ 6. OPEN ]---------------------------------------------------------


#---------[ 7. FIND (line: 229) ]---------------------------------------------

/* 8.1 Horizontal display of online list, main navigation menu and breadcrumbs */

#---------[ 8. AFTER, ADD ]---------------------------------------------------
# Note: No blank lines after the comma

#bdayslist DD, #bdayslist DT,

#---------[ 9. SAVE/UPLOAD ]-------------------------------------------------
thame^ wrote:
MattF wrote:

Changing imagecopyresized to imagecopyresampled *may* also help.

This is the correct answer!  I don't know what I was thinking when I used imagecopyresized back then, but changing it to imagecopyresampled will definitely improve the quality.  I've updated the code on my site (coloured too).  Sorry about that!

I should probably turn all that into a mod, but I'm lazy and I don't know how.  If anyone's willing to do it for me, please do.

You can achieve an even better quality (quality of the 'Automatic Image Upload' mod) by replacing:




on thame^'s code.

The 85 sets the quality. This can be anything between 1-100. I chose 85 since this gives a good quality and still gives a small image file size. Using 100 the file size becomes unnecessarily large.

Nice script by the way.

Made another update - version 1.3.2 now available.

What's new in this version:

1. I added the following statement for allocating all necessary memory for image processing:

ini_set('memory_limit', '-1');

On some servers this will allow you to upload and resize almost any size image.

For example: I have 16MB of php memory - this allowed me to upload images of up to about 2000x1500pixels.
Bigger images would cause php memory max-out.

Now with this improved version I can upload and resize really massive images. I have even tried to upload a
4500x3375 pixel image and it worked perfectly! Perfect thumbnail creation and resize.

2. Added dimensions column to list of uploaded images. Now you can sort the list of uploaded image based on image size (area).

3. Transliterates filenames with umlauts, accents, ligatures and runes.
Instead of purging characters with umlauts and accents - they are now transliterated. For example:
löschen.jpg will save as loeschen.jpg
été.jpg as ete.jpg

4. Fixed bug resulting in interrupted uploads being saved.

5. Some other minor changes

The lang files have also been updated.

maximum wrote:

I made a translation into Russian language. get

Thanks for the translation. Can you perhaps rename the file to .txt so that I can read it?

maximum wrote:

I have thought, and have decided to suggest you to add to the mod function of replacement "not latin" characters.

Table matches for the Russian language is attached. get

Do you really think this is necessary? Where will it be used?

lie2815 wrote:

I mean couldn't it just insert the bbcode img tag in the post that is provided under the picture? Kind of like the image upload mod. You could throw a look at that and try. Your other features are really good, just keep them. I would just say that that mod should be accessible from post.php and edit.php to insert pictures that have been uploaded before (or also offer an extra upload slot)...

Thanks for the ideas. Will have a look at this.

lie2815 wrote:
I wrote:

Also, you should try to make a connection to the gallery mod.

So, how do you guys like that idea?

I haven't actually used the gallery mod myself - will try to look at it when I get a chance.

lie2815 wrote:

The community that I provide with a forum, is very lazy, so would it be possible to make a plugin to post.php and edit.php so that you could somehow click on a picture and it would automatically paste the code, kind of like the easy bbcode mod?

This would be quite handy, but most posted messages don't include images - so with this feature you will have to download images every time you post a message, which can become quite irritating.

dude07 - I have updated the template modification to work with v1.3.1.

dude07 wrote:

I don't know about the name 'Image Hosting,' as that might denote that users are allowed to hotlink the images on other sites. Here's an image host that allows hotlinking as an example..

Glad to see this killer mod is quite active. Brilliant job you're doing.

You're right. I changed it back. I was also feeling little bit uneasy about the name 'Image Hosting'.

onecut wrote:

Re koos, i have a little probleme wich is not really a big probleme but looks strange:

Since last modifications we have make on your code (see previous post) my thumbtails images have an insanely crap quality, like theres only 256 color, exemple:

New release available - v1.3.1.

Made some important improvements - including better image thumbnail and resize quality (true color)

See the changelog for the rest of the changes.

Koos wrote:
dude07 wrote:

Would it be unnecessarily difficult to mod this so the thumbnails link to an html page with the full sized image in it? With a common template that the images would display in?

This would be quite easy to do. Have you already got a template you want to use?

Hi - Here is an easy solution (for v1.3.1 of my mod) with which you don't have to edit any punbb files (just mod edit):

Note: This modification allows you to choose the name of the template file in the config. In my example I called it 'uploadimg_template.php'

#---------[ 1. OPEN ]-----------------------------------------------------------


#---------[ 2. FIND (line: 8) ]-----------------------------------------------

$tdir = "uploads/thumbs/";   // Path To Thumbnails Directory

#---------[ 3. AFTER, ADD ]--------------------------------------------------

$template_filename = "uploadimg_template.php";

#---------[ 4. CREATE NEW FILE 'uploadimg_template.php' WITH THE FOLLOWING CONTENTS ]-----


include "uploadimg_config.php";

$getfile = $_GET['filename'];

  //find forumurl:
  $domain = $_SERVER['HTTP_HOST']; // find out the domain:
  $path = $_SERVER['SCRIPT_NAME']; // find out the path to the current file:
  $urltemp = "http://" . $domain . $path ; // put it all together:
  $parts = Explode('/', $path);
  $currentFile = end($parts);
  $forumurl = substr($urltemp, 0, strpos($urltemp, "$currentFile"));
  $location = "$forumurl$idir$getfile";




<img src="<?php echo $location; ?>">

<a href="javascript: history.go(-1)">Back to forum</a></p>


#---------[ 5. OPEN ]-----------------------------------------------------------


#---------[ 6. FIND (line: 513) ]-----------------------------------------------

      echo "<br>".$lang_uploadimg['Copy and paste'].": <br>
       <textarea name='select' rows='6' cols='100'>

#---------[ 7. REPLACE WITH ]--------------------------------------------------

      echo "<br>".$lang_uploadimg['Copy and paste'].": <br>
       <textarea name='select' rows='6' cols='120'>

#---------[ 8. FIND (line: 255) ]-----------------------------------------------

       echo "<br>".$lang_uploadimg['Copy and paste'].": <br>
       <textarea name='select' rows='6' cols='100'>

#---------[ 9. REPLACE WITH ]--------------------------------------------------

       echo "<br>".$lang_uploadimg['Copy and paste'].": <br>
       <textarea name='select' rows='6' cols='120'>

#---------[ 10. OPEN ]-----------------------------------------------------------


#---------[ 11. FIND (line: 860) ]-----------------------------------------------

echo "<br>
       <textarea name='select' rows='6' cols='100'>

#---------[ 12. REPLACE WITH ]--------------------------------------------------

echo "<br>
       <textarea name='select' rows='6' cols='120'>

#---------[ 13. FIND (line: 714) ]-----------------------------------------------

$getcode = "[url=.$forumurl.$idir.$filenm.][img]".$forumurl.$tdir.$filenm."[/img][/url]";

#---------[ 14. REPLACE WITH ]--------------------------------------------------

$getcode = "[url=".$forumurl.$template_filename."?filename=$filenm][img]".$forumurl.$tdir.$filenm."[/img][/url]";

#---------[ 15. SAVE/UPLOAD ]-------------------------------------------------

Upload all files to forum root.

Just make sure that every
[img]... and[/img]...
start on a seperate line in the code (hit Enter) - except in step 14. For some reason the punbb code tags put them all on the same line.

dude07 wrote:

Sure, just a basic html tamplate that I could mod later..

Must the thumbnail in the 'gallery view' of my mod link to a html page? Or the posted thumbnail in the forum?

sirena wrote:

Just a possibly dumb basic question.

Without trying out the app in detail myself...

If this mod were installed on a punBB forum, could someone upload a php or perl file (or other executable file), rename it beforehand with a JPG extension perhaps, and then once it is on the server rename it and execute it?.

I am presuming that this can't happen (or anything similar) and that this app wouldn't let someone upload a malicious file onto a punBB web server. But some confirmation would be nice smile

I am curious because there seems to be a lot of file inclusion problems going around with PHP apps at the moment...

I don't think this is possible. Just to test this, I renamed a .exe and .php file to .jpg and tried to upload. The true filetype of both these files were recognized and they could not be uploaded.

thesaint wrote:

Try now to put a watermark thing in every big version pic have a watermark.

im to stupid 4 it smile maybe something 4 you koos … class.phps

Thanks. I will check it out.

dude07 wrote:

Would it be unnecessarily difficult to mod this so the thumbnails link to an html page with the full sized image in it? With a common template that the images would display in?

This would be quite easy to do. Have you already got a template you want to use?

maximum wrote:

The column with " User ID " in statistics seems to me is not necessary, and it should be cleaned.

The User ID column was actually more useful in the previous versions - but now with the delete feature in this version, it might now be redundant. In previous versions the only way to delete files was through ftp - one then needed to see the userid, since your userid is used as the prefix of filenames.

maximum wrote:

Than use of such long address is caused. And the variable in the address meets two times.

Can simplify the address up to.

You're right - the reason I did it like this is I didn't want to access the database in the uploadimg_view.php file. The only place I access the database with this mod is in the statistics page. Maybe I'll change it in the next version.

thesaint wrote:

like v1.1.1, Thats all i want smile

Are you sure? That's a little more difficult to modify. If you want the v1.1.1 look - you won't be able to view the statistics table, or browse the files of other users. Are you alright with that? Is there a particular reason why you prefer the old look - and no gallery view?