(31 replies, posted in PunBB 1.3 discussion)

just to give you entire picture I need to do this:

I need to place


in either


    of forum or in starting post of a forum post by a user/admin etc

imagine you have a list of topics and next to the item starter there is a rating of article

I'll be placing the this in manifest.xml

<hook id="hd_head">
     $forum_head['ratings'] = '<script type="text/javascript" src="rate.js"></script>';

to get the javascript.

for creating table I will use this 

$schema = array(
        'FIELDS'        => array(
            'id'            => array(
                'datatype'        => 'SERIAL',
                'allow_null'    => false
            'cat_name'        => array(
                'datatype'        => 'VARCHAR(80)',
                'allow_null'    => false,
                'default'        => '\'New Category\''
            'disp_position'    => array(
                'datatype'        => 'INT(10)',
                'allow_null'    => false,
                'default'        => '0'
        'PRIMARY KEY'    => array('id')
    $forum_db->create_table('categories', $schema);

from you smile
based on the following mysql statment

CREATE TABLE `tableName` (
          `ip` varchar(15) NOT NULL,
          `rating` varchar(1) NOT NULL,
          `page` varchar(99) NOT NULL,
          PRIMARY KEY  (`ip`,`page`)

in original php I have this

above header

and this :
in body of rate.php

how should I implement this in the manifest.xml

the file include/rate.php looks like this:

$action = $_GET['a'];

function rate()
    $star_value = $_GET['r'];
    $page       = $_GET['p'];
    $ip         = $_SERVER['REMOTE_ADDR'];
    //Add to database
    mysql_query("INSERT INTO `".DB_TABLE."` VALUES ('$ip','$star_value','$page')");
    $ref = $_SERVER['HTTP_REFERER'];
    header("Location: " .$ref);

function reRate()
    $star_value = $_GET['r'];
    $page       = $_GET['p'];
    $ip         = $_SERVER['REMOTE_ADDR'];
    //Add to database
    mysql_query("UPDATE `".DB_TABLE."` SET `rating` = '$star_value' WHERE `ip` = '$ip' AND `page` = '$page'");
    $ref = $_SERVER['HTTP_REFERER'];
    header("Location: " .$ref);

function writeRate($page)
    $ip = $_SERVER['REMOTE_ADDR'];
    $result = mysql_query("SELECT `ip` FROM `".DB_TABLE."` WHERE `ip` = '".$ip."' AND `page` = '$page'");
    $num_rows = mysql_num_rows($result);
        echo '<p>Your Rating: ';
        $result = mysql_query("SELECT `rating` FROM `".DB_TABLE."` WHERE `ip` = '".$ip."' AND `page` = '$page'");
        $rating = mysql_result($result, 0);
        if($rating == 1)
            echo '<a href="include/rate.php?p='.$page.'&r=1&a=2"><img src="stars/starCurrent.gif" border="0" name="'.$page.'one" onmouseover="Swap1(\''.$page.'\')" onmouseout="SwapBackOne(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=2&a=2"><img src="stars/empty.gif" border="0" name="'.$page.'two" onmouseover="Swap2(\''.$page.'\')" onmouseout="SwapBackOne(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=3&a=2"><img src="stars/empty.gif" border="0" name="'.$page.'three" onmouseover="Swap3(\''.$page.'\')" onmouseout="SwapBackOne(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=4&a=2"><img src="stars/empty.gif" border="0" name="'.$page.'four" onmouseover="Swap4(\''.$page.'\')" onmouseout="SwapBackOne(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=5&a=2"><img src="stars/empty.gif" border="0" name="'.$page.'five" onmouseover="Swap5(\''.$page.'\')" onmouseout="SwapBackOne(\''.$page.'\')" /></a>';
        if($rating == 2)
and so on for each rating of 5

basically i want to make this into an extension....

the original script has
(and includes/constants.php where db info was placed)
/stars/  (gifs)

its working now in IE7, but placing of the postentry is stil lthe same as in my previous sceenshot post. i.e its too far down. i see the smilies in original size now though big_smile way cool  smile

its not visible in FF and Chrome due to this issue maybe that fluxbb has aswell=?
http://fluxbb.org/forums/topic/2369/tex … port-form/

fair enough smile good work anyway. thanks again.

PS: i dont thinks its browser issue... but of height .... of quick reply... but maybe a developer can look at it hopefully and tell us if somethings bug y  in 1.3.2 ....


the box is screwing it up my end
couldnt see it in firefox or chrome at all
this screenshot is a IE7 one

and when i hover over images it doesnt show them in that box.

can you maybe tell me again which line exactely you put it in ?

Just followed those instructions on a test forum I have and got the following screenshots...
My test forum is on 1.3.2
maybe you could install a test forum standard installation and then implement this "extension" (lot of code changing big_smile ) - if it works; add the changed files to the zip or rar whatever.

what is working great is that it gets the :myname: i ve added to folder img and it even adds it to help - def love that (that part of code should be standard in next release I think)

here what i get after following your steps:


see Firefox screenshot here


see google chrome screenshot here

fine by me. not doing it for credit or monetary sake smile and yours is better in that it chooses all images from folder ; that was annoying me with mine... could i use your code that says gett all from folder if I change created by to include your name?

definitely very good.
animated gifs also work?


(31 replies, posted in PunBB 1.3 discussion)

will i need to include this which is now named  include/constants.php somehow in manifest.xml

define("DB_SERVER", "");
define("DB_USER", "");
define("DB_PASS", "");
define("DB_NAME", "");
define("DB_TABLE", "");

$dbhandle = mysql_connect(DB_SERVER,DB_USER,DB_PASS) or die(mysql_error());
mysql_select_db(DB_NAME, $dbhandle) or die(mysql_error());

or is this information that can be called upon differently with a hook or something


(31 replies, posted in PunBB 1.3 discussion)

These are the three files that this rating extension has
(plus there is a folder "/stars/" with the images)
(links lead to my forum - just so that not all the code is cluttering this post!)

I would appreciate anyone (dev, etc) taking a hard look at it -  as I can't get it to work yet.

Main trouble being:

1. uninstall section in manifest.xml  aswell as unsure about install manifest.xml

2. hooks are working for placing in header but only show "ratings" text, instead of showing the gif of stars rating

any feedback welcome
PS: if anyone can make this work for $ - just give me a price and satisfaction guarantee big_smile

working on a rating extension of posts/page and i need to integrate this ;
SQL statement

             CREATE TABLE `tableName` (
          `ip` varchar(15) NOT NULL,
          `rating` varchar(1) NOT NULL,
          `page` varchar(99) NOT NULL,
          PRIMARY KEY  (`ip`,`page`)

any pointers please?

EDIT: Changed Title.

Thx much appreciated!

the url links in posts I meant sorry ....
so in a users post: www.xyz.com   <-- i want that to open in a tab

so target open in a new tab or window if tab isnt possible....  (_blank)


I'd prefer for my site to change the default to
open in new tab
not always in own

where can I set that?
is there a hook or something i can call on?

thanks for any input

ADDED 01-01-2009   Custom_Smilies  2.1
Download the Custom Smilies Extension 2.1
This set will now work with pun_bbcode   ( and  also without  bbcode running)

showing  20x20 without any manual modification of any other files. It will also show help correctly.
I tested it on trunk r1002
(important that you have latest include/parser.php£)

give me feedback on smilies you'd like added or alternative sets!


ADDED 29-12-2008:
Download the Custom Smilies Extension 2.0

This release will make all the smilies in the post appear at 20x20 instead of 15x15.
[you can easily change your preference in the manifest.xml by modifying those values...]
Make sure you have the latest include/parser.php installed (I've attached it in .rar in case)

If you're using PUN_BBCODE you can change size , by replacing this in pun_bbcode/bar.php


// Display the smiley set
foreach (array_unique($smilies) as $smile_text => $smile_file)
    echo '<a href="javascript:insert_text(\''.$smile_text.'\', \'\');" tabindex="'.($tabindex--).'"><img src="'.$base_url.'/img/smilies/'.$smile_file.'" width="20" height="20" alt="'.$smile_text.'" /></a>'."\n";


and if you want help.php to show them in 20x20


    // Display the smiley set
    if (!defined('FORUM_PARSER_LOADED'))
        require FORUM_ROOT.'include/parser.php';

    $smiley_groups = array();

    foreach ($smilies as $smiley_text => $smiley_img)
        $smiley_groups[$smiley_img][] = $smiley_text;

    foreach ($smiley_groups as $smiley_img => $smiley_texts)
        echo "\t\t\t\t".'<p>'.implode(' '.$lang_common['and'].' ', $smiley_texts).' <span>'.$lang_help['produces'].'</span> <img src="'.$base_url.'/img/smilies/'.$smiley_img.'" width="20" height="20" alt="'.$smiley_texts[0].'" /></p>'."\n";


Be my guineapig;

Download the Custom Smilies Extension Beta

Question: How do you think I should handle rows where smilies take up 3/4 of width (at the moment it right aligns them;
a. should I left align it aswell under B I U etc   or
b. work on a Tab that only shows them if you hover over it ( smile will need help with that)

What It Does:
replaces all smilies with this set

see in proper size here

'smile.png', '=)' => 'smile.png', ':|' => 'neutral.png', '=|' => 'neutral.png', ':(' => 'sad.png', '=(' => 'sad.png', ':D' => 'laughing.png', ';)' => 'wink.png', ':/' => 'blink.png', ':P' => 'tongue.png', ':p' => 'tongue.png', ':cool:' => 'cool.png', ':whistling:' => 'whistling.png', ':wassat:' => 'wassat.png', ':unsure:' => 'unsure.png', ':tongue:' => 'tongue.png', ':sick:' => 'sick.png', ':silly:' => 'silly.png', ':sideways:' => 'sideways.png', ':pinch:' => 'pinch.png', ':kissing:' => 'kissing.png', ':angry:' => 'angry.png', ':blush:' => 'blush.png', ':cheerful:' => 'cheerful.png', ':devil:' => 'devil.png', ':dizzy:' => 'dizzy.png', ':ermm:' => 'ermm.png', ':icon_exclaim:' => 'icon_exclaim.gif', ':icon_arrow:' => 'icon_arrow.gif', ':icon_idea:' => 'icon_idea.gif'

Designed for:
fixed smilie.png to sick.png as was missing.

            <hook id="ps_start"><![CDATA[
        //this adds the custom set of smilies
            foreach($smilies as $k=>$v) $smilies[$k] = '../../extensions/custom_smilies/img/'.$v;


thanks !

thanks a lot , will try !

<hook id="ps_start"><![CDATA[
        //this adds the custom set of smilies
            $smilies = array(':)' => $ext_info['url']/extensions_name/img/smilie.png,  ':|' => $ext_info['url']/extensions_name/img/neutral.png);


would that work?
or how do I make the  smiley path in the array relative to the forum root

// Convert a series of smilies to images
function do_smilies($text)

on line 758 in parser.php ?

Be my guineapig;

Download the Custom Smilies Extension Beta

Question: How do you think I should handle rows where smilies take up 3/4 of width (at the moment it right aligns them;
a. should I left align it aswell under B I U etc   or
b. work on a Tab that only shows them if you hover over it ( smile will need help with that)

edited above
original post below


I'm working on an extension which overrides the default smilies with a completely new set;

based on include/parser.php line 19
($hook = get_hook('ps_start')) ? eval($hook) : null;

What needs changing here [in addition to location (in colors)] being changed?

        <hook id="ps_start"><![CDATA[
        //this adds the custom set of smilies
            $smilies = array(':)' => 'smile.png', '=)' => 'smile.png', ':|' => 'neutral.png');
            <img src="'.$ext_info['path'].'/img/smile.png"/>

How do I include the img src location in green above so that normal location red doesn't show?

Thanks for any pointers

Well I recently downloaded most recent 1.3.2 and adminstrator area stays english.
Let me know if you ever know of someone who has it working in 1.3.2.

I've tried both. All works except admin.

Can you give me a bit more information on how to use that method? Assuming I want to change the code of your official pun_pm so that my code (extension) gets it properly

array_insert($links, 'pm', '<li id="navextra"><a href="pm_link">pm_link</a></li>');
where would above ^^ code go (file, line) , what would it replace

if (isset($links['pm']))
and where that one ^^  (file, line)

sorry if these are novice questions...

additional info; the administrator section stays english with the download from your site in 1.3.2
i guess thats fine
i also tested it in fluxbb where it works except clicking the search link returns this error
Notice: Undefined index: Search info in     search.php on line 401

thanks again for the great effort.

You really are a star. That worked! Thx!

Parse error: syntax error, unexpected T_ECHO

<img src="'echo .$ext_info['path'] '/img/navuserlist.png" alt="User list" />
<img src="'echo $ext_info['path'] '/img/navuserlist.png"/>  tried both

my code....

Ok I added:

    $links['userlist'] = '<li id="navuserlist"'.((FORUM_PAGE == 
'userlist') ? '  class="isactive"' : '').'><a href="'.forum_link
<img src="<?php echo $ext_info['path'] ?>/img/navuserlist.png" alt="User list" 
/></a> </li>';



$links['userlist'] = '<li id="navuserlist"'.((FORUM_PAGE ==
 'userlist') ? '  class="isactive"' : '').'><a  href="'.forum_link($forum_url['users']).'">
<img  src="'.$base_url.'/img/navuserlist.png" alt="User list" />

which gave me:

Parse error: syntax error, unexpected T_STRING

what have I done wrong?

(am using same extension as one I posted here just with that change)

1. Good thanks smile
2.  So if they [developers] add hook it could be done easily? Any chance of that happening?  Do I need to add hook request?
3.  I want to add the images to my extension so that on install it's just one click. Where can I find info on how to do that? Or if you can tell me all the better!