1,526

(22 replies, posted in PunBB 1.3 extensions)

aha smile  then YES!

1,527

(22 replies, posted in PunBB 1.3 extensions)

assuming I have a screenshot - and want to upload it to this website so that everyone can see it -
by doing: attach "picture1.jpg" then see it in my post...
so kind of like you've done above... i guess?

you're using photobucket embed link... that's a good start. but instead of 3rd party site... actual forum site.

1,528

(22 replies, posted in PunBB 1.3 extensions)

RE: Ideas

I need users to be able to attach a picture - gif , jpeg , png - to their post.
Like with pun_attachment possibility to upload - difference: that picture shows and isn't just a "link"

Then once that is done, I'd need a little image to appear in the post TITLE signaling to users  that there is a picture in that post (from the overview it should be visible before clicking post that their is an image included in post)

big_smile as you asked for idea! haha smile

added new release 2.0 - see first post.

1,530

(31 replies, posted in PunBB 1.3 extensions)

Fatal error: require() [function.require.php]: Failed opening required '/functions.php' (include_path='.:/usr/local/lib/php') in

Warning: require(/functions.php) [function.require.php]: failed to open stream: No such file or directory in

Notice: Undefined index: path in

just got this when i tried to uninstall. installation and how it works all very smooth.
any ideas?

1,531

(98 replies, posted in PunBB 1.3 extensions)

http://rapidshare.com/files/177074021/p … chment.rar

I had same problem.... if someone can enlighten.
In the meantime the above link works....


On another forum I just tried to install it I get this error message:
Warning: getimagesize() [function.getimagesize.php]: URL file-access is disabled in the server configuration in

line 30

what have I forgotten to do?

Operating system: FreeBSD
PHP: 5.2.8

1,532

(98 replies, posted in PunBB 1.3 extensions)

just tested it on 1.3.2. brilliant. was able to upload an mp3 then download it from another pc.

what would be good:

% update/loading thing telling you how much kb or mb has been uploaded;
something that tells you total size and then gives you progress...

but great that it has: x downloads since 200X-XX-XX

thanks for great extension!

ok thx.

PS: in include/parser.php

//
// Convert a series of smilies to images
//
function do_smilies($text)
{
    global $forum_config, $base_url, $smilies;

    $text = ' '.$text.' ';

    foreach ($smilies as $smiley_text => $smiley_img)
    {
        if (strpos($text, $smiley_text) !== false)
            $text = preg_replace("#(?<=[>\s])".preg_quote($smiley_text, '#')."(?=\W)#m", '<img src="'.$base_url.'/img/smilies/'.$smiley_img.'" width="18" height="18" alt="'.substr($smiley_img, 0, strrpos($smiley_img, '.')).'" />', $text);
    }

    return substr($text, 1, -1);
}

is there a way to include this (18 instead of 15 height and width) in the extension?
i don't se a hook there that i can use?

go ahead garciat! best if things are developped in parallel and to cover all needs....
my priority at mo is to get that rating stuff working!
but i think it's a good idea you have!

good point about the size. will change that my end aswell. noticed it aswell couple of days ago.

thx for feedback big_smile

1,537

(31 replies, posted in PunBB 1.3 discussion)

sure, your one makes much more sense. just code for nothing otherwise. double.

<?php
header("Content-Type: text/javascript");
?>
var base_url = '<?php echo urldecode($_GET['base_url']) ?>';

function Swap1(page){
    document[""+page+"one"].src = base_url."extensions/rating_script/stars/star.gif";
    return true;
  }
  function Swap2(page){
    document[""+page+"one"].src = base_url."extensions/rating_script/stars/star.gif";
    document[""+page+"two"].src = base_url."extensions/rating_script/stars/star.gif";
    return true;
  }
  function Swap3(page){
    document[""+page+"one"].src = base_url."extensions/rating_script/stars/star.gif";
    document[""+page+"two"].src = base_url."extensions/rating_script/stars/star.gif";
    document[""+page+"three"].src = base_url."extensions/rating_script/stars/star.gif";
    return true;
  }
  function Swap4(page){
    document[""+page+"one"].src = base_url."extensions/rating_script/stars/star.gif";
    document[""+page+"two"].src = base_url."extensions/rating_script/stars/star.gif";
    document[""+page+"three"].src = base_url."extensions/rating_script/stars/star.gif";
    document[""+page+"four"].src = base_url."extensions/rating_script/stars/star.gif";
    return true;
  }
  function Swap5(page){
   document[""+page+"one"].src = base_url."extensions/rating_script/stars/star.gif";
    document[""+page+"two"].src = base_url."extensions/rating_script/stars/star.gif";
    document[""+page+"three"].src = base_url."extensions/rating_script/stars/star.gif";
    document[""+page+"four"].src = base_url."extensions/rating_script/stars/star.gif";
    document[""+page+"five"].src = base_url."extensions/rating_script/stars/star.gif";
    return true;
  }
  function SwapBack(page){
    document[""+page+"one"].src = base_url."extensions/rating_script/stars/empty.gif";
    document[""+page+"two"].src = base_url."extensions/rating_script/stars/empty.gif";
    document[""+page+"three"].src = base_url."extensions/rating_script/stars/empty.gif";
    document[""+page+"four"].src = base_url."extensions/rating_script/stars/empty.gif";
    document[""+page+"five"].src = base_url."extensions/rating_script/stars/empty.gif";
    return true;
  }
  function SwapBackOne(page){
    document[""+page+"one"].src = base_url."extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"two"].src = base_url."extensions/rating_script/stars/empty.gif";
    document[""+page+"three"].src = base_url."extensions/rating_script/stars/empty.gif";
    document[""+page+"four"].src = base_url."extensions/rating_script/stars/empty.gif";
    document[""+page+"five"].src = base_url."extensions/rating_script/stars/empty.gif";
    return true;
  }
  function SwapBackTwo(page){
    document[""+page+"one"].src = base_url."extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"two"].src = base_url."extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"three"].src = base_url."extensions/rating_script/stars/empty.gif";
    document[""+page+"four"].src = base_url."extensions/rating_script/stars/empty.gif";
    document[""+page+"five"].src = base_url."extensions/rating_script/stars/empty.gif";
    return true;
  }
  function SwapBackThree(page){
    document[""+page+"one"].src = base_url."extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"two"].src = base_url."extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"three"].src = base_url."extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"four"].src = base_url."extensions/rating_script/stars/empty.gif";
    document[""+page+"five"].src = base_url."extensions/rating_script/stars/empty.gif";
    return true;
  }
  function SwapBackFour(page){
    document[""+page+"one"].src = base_url."extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"two"].src = base_url."extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"three"].src = base_url."extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"four"].src = base_url."extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"five"].src = base_url."extensions/rating_script/stars/empty.gif";
    return true;
  }
  function SwapBackFive(page){
    document[""+page+"one"].src = base_url."extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"two"].src = base_url."extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"three"].src = base_url."extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"four"].src = base_url."extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"five"].src = base_url."extensions/rating_script/stars/starCurrent.gif";
    return true;
  }
    // Delete extension options from the config
    $query = array(
        'DELETE'    => 'config',
        'WHERE'     => 'conf_name in (\'o_pun_pm_outbox_size\', \'o_pun_pm_inbox_size\', \'o_pun_pm_show_new_count\', \'o_pun_pm_show_global_link\')',
    );
    $forum_db->query_build($query) or error(__FILE__, __LINE__);
    
    $forum_db->drop_table('pun_pm_messages');
    
    $forum_db->drop_field('users', 'pun_pm_new_messages');
    $forum_db->drop_field('users', 'pun_pm_long_subject');

        ]]></uninstall>

(just putting this in to remind me)

<uninstall><![CDATA[
    // Uninstallation code
    if ($forum_db->table_exists('categories'))
        $forum_db->drop_table('categories');
]]></uninstall>

does this look right ?  ^^ or do I need anything changed in my specific case?

So in my manifest.xml it will now look like this:

    <install>
     <![CDATA[
                // Adding SQL statement / creating table /installation code
            $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);        
        ]]>  
    </install>
    <uninstall><![CDATA[
    // Uninstallation code
    if ($forum_db->table_exists('categories'))
        $forum_db->drop_table('categories');
    ]]></uninstall>

1,540

(31 replies, posted in PunBB 1.3 discussion)

So this is what I'd put in rating_script extension  called  rate.php   

<?php
header("Content-Type: text/javascript");
?>
var base_url = '<?php echo urldecode($_GET['base_url']) ?>';

function Swap1(page){
    document[""+page+"one"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    return true;
  }
  function Swap2(page){
    document[""+page+"one"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    document[""+page+"two"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    return true;
  }
  function Swap3(page){
    document[""+page+"one"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    document[""+page+"two"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    document[""+page+"three"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    return true;
  }
  function Swap4(page){
    document[""+page+"one"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    document[""+page+"two"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    document[""+page+"three"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    document[""+page+"four"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    return true;
  }
  function Swap5(page){
   document[""+page+"one"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    document[""+page+"two"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    document[""+page+"three"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    document[""+page+"four"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    document[""+page+"five"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    return true;
  }
  function SwapBack(page){
    document[""+page+"one"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    document[""+page+"two"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    document[""+page+"three"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    document[""+page+"four"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    document[""+page+"five"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    return true;
  }
  function SwapBackOne(page){
    document[""+page+"one"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"two"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    document[""+page+"three"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    document[""+page+"four"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    document[""+page+"five"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    return true;
  }
  function SwapBackTwo(page){
    document[""+page+"one"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"two"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"three"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    document[""+page+"four"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    document[""+page+"five"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    return true;
  }
  function SwapBackThree(page){
    document[""+page+"one"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"two"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"three"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"four"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    document[""+page+"five"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    return true;
  }
  function SwapBackFour(page){
    document[""+page+"one"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"two"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"three"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"four"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"five"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    return true;
  }
  function SwapBackFive(page){
    document[""+page+"one"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"two"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"three"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"four"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"five"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    return true;
  }

Did you mean in this (above) new file rating_script/rate.php I need to modify according to this:

//when you need the base URL, just do something like: base_url.'extensions/something/star.png';

or

when I need it in other files   (rating_script/include/rate.php  ...  rating_script/manifest.xml)


THANKS. MERRY XMAS AND ALL THAT big_smile

I'm adding the following table creation code:

   

 <install>
     <![CDATA[
                // Adding SQL statement / creating table /installation code
            $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);        
        ]]>  
    </install>

How does the uninstall need to look like; I know one has to reverse everything above. But what does that specifically look like in my case. (Or maybe point me to a link or literature on the subject)

      <uninstall><![CDATA[
        // Uninstallation code
            $query = array(
            'DELETE'    => '?????',
            'WHERE'    => '????? in (\'New Category\'')',
            );
            $forum_db->create_table('categories', $schema);
    ]]></uninstall>

Appreciate any pointers, as always.

1,542

(31 replies, posted in PunBB 1.3 discussion)

my rate.js : (with "Finally:" change from you)

function Swap1(page){
    document[""+page+"one"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    return true;
  }
  function Swap2(page){
    document[""+page+"one"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    document[""+page+"two"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    return true;
  }
  function Swap3(page){
    document[""+page+"one"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    document[""+page+"two"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    document[""+page+"three"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    return true;
  }
  function Swap4(page){
    document[""+page+"one"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    document[""+page+"two"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    document[""+page+"three"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    document[""+page+"four"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    return true;
  }
  function Swap5(page){
   document[""+page+"one"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    document[""+page+"two"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    document[""+page+"three"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    document[""+page+"four"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    document[""+page+"five"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/star.gif";
    return true;
  }
  function SwapBack(page){
    document[""+page+"one"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    document[""+page+"two"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    document[""+page+"three"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    document[""+page+"four"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    document[""+page+"five"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    return true;
  }
  function SwapBackOne(page){
    document[""+page+"one"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"two"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    document[""+page+"three"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    document[""+page+"four"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    document[""+page+"five"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    return true;
  }
  function SwapBackTwo(page){
    document[""+page+"one"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"two"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"three"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    document[""+page+"four"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    document[""+page+"five"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    return true;
  }
  function SwapBackThree(page){
    document[""+page+"one"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"two"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"three"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"four"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    document[""+page+"five"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    return true;
  }
  function SwapBackFour(page){
    document[""+page+"one"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"two"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"three"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"four"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"five"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/empty.gif";
    return true;
  }
  function SwapBackFive(page){
    document[""+page+"one"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"two"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"three"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"four"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    document[""+page+"five"].src = "<?php echo urldecode($_GET['base_url']) ?>extensions/rating_script/stars/starCurrent.gif";
    return true;
  }

Then, when you need the JS file, you do something like:

<script type="text/javascript" src="url_to_php_file.php?base_url=<?php echo urlencode($base_url) ?>"></script>

not sure what to do with that....

with your JS script in it

you mean the above code rate.js in "url_to_php_file.php" ; Q : how does it have to be "in it" ? - sorry not quite getting it yet big_smile thanks for your patience. my intentions are good smile

1,543

(31 replies, posted in PunBB 1.3 discussion)

thx!
so re 2b)  - i need to change

document[""+page+"one"].src = ".$ext_info['url'].'/stars/star.gif";
document[""+page+"one"].src = "extensions/rating_script/stars/star.gif";

to get it working?
in the rate.js

1,544

(31 replies, posted in PunBB 1.3 discussion)

http://rapidshare.com/files/175762519/rating_script.rar   <-- latest code I'm working on

this as I said has following prob:
1. uninstall - don't know what value I need to put in
2. a) $rater_stars    source - not sure what and if that needs to be changed

//Assign Value
if ($avg_value <= 0  ){$rater_stars = "stars/00star.gif";}
//Assign Value
if ($avg_value <= 0  ){$rater_stars = ".$ext_info['url'].'/stars/00star.gif";}

2. b) in the .js   do I need to change 

document[""+page+"one"].src = "stars/star.gif";
document[""+page+"one"].src = ".$ext_info['url'].'/stars/star.gif";

if it is right like this ^ 
http://rapidshare.com/files/175768778/r … t_beta.rar  <-- this will be corrected version

3. issue of forum_htmlencode  / $db->escape   - need more info on sanitizing

thx all !

1,545

(31 replies, posted in PunBB 1.3 discussion)

remaining issue

probably really stupid question right, but
it places the TEXT:  rating    where my stars should be at the moment!

plus:
the uninstall - what does that need to look like?
install is fine. but UNinstall prob.

i guess the stars need ".$ext_info['url'].'/  down below aswell in the .js big_smile ?

  
function Swap1(page){
    document[""+page+"one"].src = "stars/star.gif";
    return true;
  }
  function Swap2(page){
    document[""+page+"one"].src = "stars/star.gif";
    document[""+page+"two"].src = "stars/star.gif";
    return true;

and last question for mo:
this is in include/rate.php

 
//Assign Value
if ($avg_value <= 0  ){$rater_stars = "stars/00star.gif";}
if ($avg_value >= 0.5){$rater_stars = "stars/05star.gif";}
if ($avg_value >= 1  ){$rater_stars = "stars/1star.gif";}
if ($avg_value >= 1.5){$rater_stars = "stars/15star.gif";}
if ($avg_value >= 2  ){$rater_stars = "stars/2star.gif";}
if ($avg_value >= 2.5){$rater_stars = "stars/25star.gif";}
if ($avg_value >= 3  ){$rater_stars = "stars/3star.gif";}
if ($avg_value >= 3.5){$rater_stars = "stars/35star.gif";}
if ($avg_value >= 4  ){$rater_stars = "stars/4star.gif";}
if ($avg_value >= 4.5){$rater_stars = "stars/45star.gif";}
if ($avg_value >= 5  ){$rater_stars = "stars/5star.gif";}

    echo 'Avg Rating: <img src="'.$rater_stars.'" width="80" height="16" border="0" name="Rate"/>';
    echo '<br>';
    echo $num_rows." Ratings (Avg ".substr($avg_value,0,4).")";    

what do i need to change the img src to if at all ? example?
thank you

1,546

(31 replies, posted in PunBB 1.3 discussion)

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

should be:

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

and:

$action = forum_htmlencode($_GET['a']);

should be:

$action = isset($_GET['action']) ? intval($_GET['action']) : '';

made the above changes

most recent rating_script version here:

not working yet ... but no errors anymore

remaining issue:

1. after changing "'.$ext_info['url'].'/ to go before all the stars etc...
it just places the TEXT rating in the location where my stars should be - any idea what that could be about?

2. uninstall. how do i write that correctly?

thanks

1,547

(31 replies, posted in PunBB 1.3 discussion)

this is include/rate.php
but once i install everything it tells me  :

Notice: Undefined index: a
include/rate.php on line 3
$action = forum_htmlencode($_GET['a']);
do you think this would help solves issue; sanitizing?

Do not ever use forum_htmlencode on input. Do not ever use it to sanitize a string for use in the database.
forum_htmlencode should be used on output only, to prevent XSS. To sanitize a string for use in the database, use $db->escape.

  <---- how do I implement this in my example here please? anyone....

thx

<?

$action = forum_htmlencode($_GET['a']);
if($action == 1)
{
    rate();
}
if($action == 2)
{
    reRate();
}

function rate()
{
    $star_value = forum_htmlencode($_GET['r']);
    $page       = forum_htmlencode($_GET['p']);
    $ip         = $_SERVER['REMOTE_ADDR'];
   
    //Add to database
    $query = array(
        'INSERT'    => 'ip, rating, page',
        'INTO'        => DB_TABLE,
        'VALUES'    => $ip.', '.$star_value.', '.$page
    );
    $forum_db->query_build($query) or error(__FILE__, __LINE__);
    $ref = $_SERVER['HTTP_REFERER'];
    redirect($ref, 'Redirecting, Please wait &hellip;');
}

function reRate()
{
    $star_value = forum_htmlencode($_GET['r']);
    $page       = forum_htmlencode($_GET['p']);
    $ip         = $_SERVER['REMOTE_ADDR'];
   
    //Add to database
    $query = array(
        'UPDATE'    => DB_TABLE,
        'SET'        => 'rating = '.$star_value,
        'WHERE'        => 'ip = '.$ip.' AND page = '.$page
    );
    $forum_db->query_build($query) or error(__FILE__, __LINE__);
    $ref = $_SERVER['HTTP_REFERER'];
    redirect($ref, 'Redirecting, Please wait &hellip;');
}

function writeRate($page)
{
    $ip = $_SERVER['REMOTE_ADDR'];
    $query = array(
        'SELECT'    => 'ip',
        'FROM'        => DB_TABLE,
        'WHERE'        => 'ip = '.$ip.' AND page = '.$page
    );
    $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
    $num_rows = $forum_db->num_rows($result);
    if($num_rows == 1)
    {
        echo '<p>Your Rating: ';
        $query = array(
            'SELECT'    => 'rating',
            'FROM'        => DB_TABLE,
            'WHERE'        => 'ip = '.$ip.' AND page = '.$page
        );
        $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
        $rating = $forum_db->result($result);
        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)
        {
            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="SwapBackTwo(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=2&a=2"><img src="stars/starCurrent.gif" border="0" name="'.$page.'two" onmouseover="Swap2(\''.$page.'\')" onmouseout="SwapBackTwo(\''.$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="SwapBackTwo(\''.$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="SwapBackTwo(\''.$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="SwapBackTwo(\''.$page.'\')" /></a>';
        }
        if($rating == 3)
        {
            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="SwapBackThree(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=2&a=2"><img src="stars/starCurrent.gif" border="0" name="'.$page.'two" onmouseover="Swap2(\''.$page.'\')" onmouseout="SwapBackThree(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=3&a=2"><img src="stars/starCurrent.gif" border="0" name="'.$page.'three" onmouseover="Swap3(\''.$page.'\')" onmouseout="SwapBackThree(\''.$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="SwapBackThree(\''.$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="SwapBackThree(\''.$page.'\')" /></a>';
        }
        if($rating == 4)
        {
            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="SwapBackFour(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=2&a=2"><img src="stars/starCurrent.gif" border="0" name="'.$page.'two" onmouseover="Swap2(\''.$page.'\')" onmouseout="SwapBackFour(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=3&a=2"><img src="stars/starCurrent.gif" border="0" name="'.$page.'three" onmouseover="Swap3(\''.$page.'\')" onmouseout="SwapBackFour(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=4&a=2"><img src="stars/starCurrent.gif" border="0" name="'.$page.'four" onmouseover="Swap4(\''.$page.'\')" onmouseout="SwapBackFour(\''.$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="SwapBackFour(\''.$page.'\')" /></a>';
        }
        if($rating == 5)
        {
            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="SwapBackFive(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=2&a=2"><img src="stars/starCurrent.gif" border="0" name="'.$page.'two" onmouseover="Swap2(\''.$page.'\')" onmouseout="SwapBackFive(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=3&a=2"><img src="stars/starCurrent.gif" border="0" name="'.$page.'three" onmouseover="Swap3(\''.$page.'\')" onmouseout="SwapBackFive(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=4&a=2"><img src="stars/starCurrent.gif" border="0" name="'.$page.'four" onmouseover="Swap4(\''.$page.'\')" onmouseout="SwapBackFive(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=5&a=2"><img src="stars/starCurrent.gif" border="0" name="'.$page.'five" onmouseover="Swap5(\''.$page.'\')" onmouseout="SwapBackFive(\''.$page.'\')" /></a>';
        }
        echo '<br>';
    }
    else
    {
        echo '<p>Your Rating: ';
        echo ' <a href="include/rate.php?p='.$page.'&r=1&a=1"><img src="stars/empty.gif" border="0" name="'.$page.'one" onmouseover="Swap1(\''.$page.'\')" onmouseout="SwapBack(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=2&a=1"><img src="stars/empty.gif" border="0" name="'.$page.'two" onmouseover="Swap2(\''.$page.'\')" onmouseout="SwapBack(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=3&a=1"><img src="stars/empty.gif" border="0" name="'.$page.'three" onmouseover="Swap3(\''.$page.'\')" onmouseout="SwapBack(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=4&a=1"><img src="stars/empty.gif" border="0" name="'.$page.'four" onmouseover="Swap4(\''.$page.'\')" onmouseout="SwapBack(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=5&a=1"><img src="stars/empty.gif" border="0" name="'.$page.'five" onmouseover="Swap5(\''.$page.'\')" onmouseout="SwapBack(\''.$page.'\')" /></a>';
          echo '<br>';
    }
    

        $query = array(
            'SELECT'    => 'rating',
            'FROM'        => DB_TABLE,
            'WHERE'        => 'page = '.$page
        );
        $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);

        $num_rows = $forum_db->num_rows($result);
        $i = 0;
        $star_value = 0;
        while($i < $num_rows)
        {
            $rating = $forum_db->result($result,$i);
            $star_value = $star_value + $rating;
            $i++;
        }
        if($star_value == 0)
        {
            $avg_value = 0;
        }
        else
        {
            $avg_value = $star_value / $num_rows;
        }



//Assign Value
if ($avg_value <= 0  ){$rater_stars = "stars/00star.gif";}
if ($avg_value >= 0.5){$rater_stars = "stars/05star.gif";}
if ($avg_value >= 1  ){$rater_stars = "stars/1star.gif";}
if ($avg_value >= 1.5){$rater_stars = "stars/15star.gif";}
if ($avg_value >= 2  ){$rater_stars = "stars/2star.gif";}
if ($avg_value >= 2.5){$rater_stars = "stars/25star.gif";}
if ($avg_value >= 3  ){$rater_stars = "stars/3star.gif";}
if ($avg_value >= 3.5){$rater_stars = "stars/35star.gif";}
if ($avg_value >= 4  ){$rater_stars = "stars/4star.gif";}
if ($avg_value >= 4.5){$rater_stars = "stars/45star.gif";}
if ($avg_value >= 5  ){$rater_stars = "stars/5star.gif";}

    echo 'Avg Rating: <img src="'.$rater_stars.'" width="80" height="16" border="0" name="Rate"/>';
    echo '<br>';
    echo $num_rows." Ratings (Avg ".substr($avg_value,0,4).")";    
        
}

?>

1,548

(31 replies, posted in PunBB 1.3 discussion)

<extension engine="1.0">
    <id>rating_script</id>
    <title>Rating Script</title>
    <version>0.1.0</version>
    <description>Rate posts as you know it from youtube</description>
    <author>KeyDog contributors La'me - Garciat - j.roszk</author>
    <minversion>1.3 Beta</minversion>
    <maxtestedon>1.3 Beta</maxtestedon>
    <install>
     <![CDATA[
                // Adding SQL statement / creating table /installation code
            $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);        
        ]]>  
    </install>
   
            <uninstall><![CDATA[
        // Uninstallation code
            $query = array(
            'DELETE'    => '??????',
            'WHERE'        => '????? in (\'New Category\'')',
            );
            $forum_db->create_table('categories', $schema);
    ]]></uninstall>
    <hooks>
        <hook id="hd_head"><![CDATA[
        // To place the rate.js in header
             $forum_head['ratings'] = '<script type="text/javascript" src="rate.js"></script>';
        ]]>
           </hook>
        <hook id="vf_topic_loop_normal_topic_pre_item_title_merge"><![CDATA[
            // To add  to each topic's title (Screenshot 1)
            $forum_page['item_title']['link'] .= 'ratings';
    
        ]]>
        </hook>
        <hook id="vt_row_pre_post_ident_merge"><![CDATA[
            // To add  to the post number
            $forum_page['post_ident']['num'] = 'ratings'.$forum_page['post_ident']['num'];
    
        ]]>
        </hook> 
        <hook id="vf_start"><![CDATA[
        // Include tbe include/rate.php from extension directory
            require $ext_info['path'].'/include/rate.php';
          ]]>
        </hook>    
    </hooks>
</extension>

this is my xml.manifest now

how do i do the uninstall????
thx for all the inputs.

1,549

(31 replies, posted in PunBB 1.3 discussion)

2 Questions:

// Adding SQL statement / creating table
            $schema = array(
                'FIELDS'        => array(
                        'id'            => array(
                        'datatype'        => 'SERIAL',
                        'allow_null'    => false
                    ),   

...... etc

// not sure where this hook will go yet
$action = forum_htmlencode($_GET['a']);
if($action == 1)
{
    rate();
}
if($action == 2)
{
    reRate();
}

etc......

Where Do I need to hook those ?

1,550

(31 replies, posted in PunBB 1.3 discussion)

    <description>Rate posts as you know it from youtube</description>
    <author>KeyDog contributors La'me - Garciat - j.roszk</author>
    <minversion>1.3 Beta</minversion>
    <maxtestedon>1.3 Beta</maxtestedon>
    
    <hooks>
        <hook id="hd_head"><![CDATA[
        // To place the rate.js in header
             $forum_head['ratings'] = '<script type="text/javascript" src="rate.js"></script>';
        ]]>
            </hook>
        <hook id="vf_topic_loop_normal_topic_pre_item_title_merge"><![CDATA[
            // To add  to each topic's title (Screenshot 1)
            $forum_page['item_title']['link'] .= 'ratings';
    
        ]]>
        </hook>
        <hook id="vt_row_pre_post_ident_merge"><![CDATA[
            // To add  to the post number
            $forum_page['post_ident']['num'] = 'ratings'.$forum_page['post_ident']['num'];
    
        ]]>
        </hook> 
        <hook id="hd_head"><![CDATA[
            // Adding SQL statement / creating table
            $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);  
            ]]>
            <hook id="hd_head"><![CDATA[
            // not sure where this hook will go yet
$action = forum_htmlencode($_GET['a']);
if($action == 1)
{
    rate();
}
if($action == 2)
{
    reRate();
}

function rate()
{
    $star_value = forum_htmlencode($_GET['r']);
    $page       = forum_htmlencode($_GET['p']);
    $ip         = $_SERVER['REMOTE_ADDR'];
   
    //Add to database
    $query = array(
        'INSERT'    => 'ip, rating, page',
        'INTO'        => DB_TABLE,
        'VALUES'    => $ip.', '.$star_value.', '.$page
    );
    $forum_db->query_build($query) or error(__FILE__, __LINE__);
    $ref = $_SERVER['HTTP_REFERER'];
    redirect($ref, 'Redirecting, Please wait &hellip;');
}

function reRate()
{
    $star_value = forum_htmlencode($_GET['r']);
    $page       = forum_htmlencode($_GET['p']);
    $ip         = $_SERVER['REMOTE_ADDR'];
   
    //Add to database
    $query = array(
        'UPDATE'    => DB_TABLE,
        'SET'        => 'rating = '.$star_value,
        'WHERE'        => 'ip = '.$ip.' AND page = '.$page
    );
    $forum_db->query_build($query) or error(__FILE__, __LINE__);
    $ref = $_SERVER['HTTP_REFERER'];
    redirect($ref, 'Redirecting, Please wait &hellip;');
}

function writeRate($page)
{
    $ip = $_SERVER['REMOTE_ADDR'];
    $query = array(
        'SELECT'    => 'ip',
        'FROM'        => DB_TABLE,
        'WHERE'        => 'ip = '.$ip.' AND page = '.$page
    );
    $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
    $num_rows = $forum_db->num_rows($result);
    if($num_rows == 1)
    {
        echo '<p>Your Rating: ';
        $query = array(
            'SELECT'    => 'rating',
            'FROM'        => DB_TABLE,
            'WHERE'        => 'ip = '.$ip.' AND page = '.$page
        );
        $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
        $rating = $forum_db->result($result);
        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)
        {
            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="SwapBackTwo(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=2&a=2"><img src="stars/starCurrent.gif" border="0" name="'.$page.'two" onmouseover="Swap2(\''.$page.'\')" onmouseout="SwapBackTwo(\''.$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="SwapBackTwo(\''.$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="SwapBackTwo(\''.$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="SwapBackTwo(\''.$page.'\')" /></a>';
        }
        if($rating == 3)
        {
            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="SwapBackThree(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=2&a=2"><img src="stars/starCurrent.gif" border="0" name="'.$page.'two" onmouseover="Swap2(\''.$page.'\')" onmouseout="SwapBackThree(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=3&a=2"><img src="stars/starCurrent.gif" border="0" name="'.$page.'three" onmouseover="Swap3(\''.$page.'\')" onmouseout="SwapBackThree(\''.$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="SwapBackThree(\''.$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="SwapBackThree(\''.$page.'\')" /></a>';
        }
        if($rating == 4)
        {
            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="SwapBackFour(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=2&a=2"><img src="stars/starCurrent.gif" border="0" name="'.$page.'two" onmouseover="Swap2(\''.$page.'\')" onmouseout="SwapBackFour(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=3&a=2"><img src="stars/starCurrent.gif" border="0" name="'.$page.'three" onmouseover="Swap3(\''.$page.'\')" onmouseout="SwapBackFour(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=4&a=2"><img src="stars/starCurrent.gif" border="0" name="'.$page.'four" onmouseover="Swap4(\''.$page.'\')" onmouseout="SwapBackFour(\''.$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="SwapBackFour(\''.$page.'\')" /></a>';
        }
        if($rating == 5)
        {
            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="SwapBackFive(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=2&a=2"><img src="stars/starCurrent.gif" border="0" name="'.$page.'two" onmouseover="Swap2(\''.$page.'\')" onmouseout="SwapBackFive(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=3&a=2"><img src="stars/starCurrent.gif" border="0" name="'.$page.'three" onmouseover="Swap3(\''.$page.'\')" onmouseout="SwapBackFive(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=4&a=2"><img src="stars/starCurrent.gif" border="0" name="'.$page.'four" onmouseover="Swap4(\''.$page.'\')" onmouseout="SwapBackFive(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=5&a=2"><img src="stars/starCurrent.gif" border="0" name="'.$page.'five" onmouseover="Swap5(\''.$page.'\')" onmouseout="SwapBackFive(\''.$page.'\')" /></a>';
        }
        echo '<br>';
    }
    else
    {
        echo '<p>Your Rating: ';
        echo ' <a href="include/rate.php?p='.$page.'&r=1&a=1"><img src="stars/empty.gif" border="0" name="'.$page.'one" onmouseover="Swap1(\''.$page.'\')" onmouseout="SwapBack(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=2&a=1"><img src="stars/empty.gif" border="0" name="'.$page.'two" onmouseover="Swap2(\''.$page.'\')" onmouseout="SwapBack(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=3&a=1"><img src="stars/empty.gif" border="0" name="'.$page.'three" onmouseover="Swap3(\''.$page.'\')" onmouseout="SwapBack(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=4&a=1"><img src="stars/empty.gif" border="0" name="'.$page.'four" onmouseover="Swap4(\''.$page.'\')" onmouseout="SwapBack(\''.$page.'\')" /></a><a href="include/rate.php?p='.$page.'&r=5&a=1"><img src="stars/empty.gif" border="0" name="'.$page.'five" onmouseover="Swap5(\''.$page.'\')" onmouseout="SwapBack(\''.$page.'\')" /></a>';
          echo '<br>';
    }
    
$result = mysql_query("SELECT `rating` FROM `".DB_TABLE."` WHERE `page` = '".$page."'");
        $num_rows = mysql_num_rows($result);
        $i=0;
        $star_value = 0;
        while($i<$num_rows)
        {
            $rating = mysql_result($result,$i);
            $star_value = $star_value + $rating;
            $i++;
        }
        if($star_value==0)
        {
            $avg_value = 0;
        }
        else
        {
            $avg_value = $star_value / $num_rows;
        }



//Assign Value
if ($avg_value <= 0  ){$rater_stars = "stars/00star.gif";}
if ($avg_value >= 0.5){$rater_stars = "stars/05star.gif";}
if ($avg_value >= 1  ){$rater_stars = "stars/1star.gif";}
if ($avg_value >= 1.5){$rater_stars = "stars/15star.gif";}
if ($avg_value >= 2  ){$rater_stars = "stars/2star.gif";}
if ($avg_value >= 2.5){$rater_stars = "stars/25star.gif";}
if ($avg_value >= 3  ){$rater_stars = "stars/3star.gif";}
if ($avg_value >= 3.5){$rater_stars = "stars/35star.gif";}
if ($avg_value >= 4  ){$rater_stars = "stars/4star.gif";}
if ($avg_value >= 4.5){$rater_stars = "stars/45star.gif";}
if ($avg_value >= 5  ){$rater_stars = "stars/5star.gif";}

    echo 'Avg Rating: <img src="'.$rater_stars.'" width="80" height="16" border="0" name="Rate"/>';
    echo '<br>';
    echo $num_rows." Ratings (Avg ".substr($avg_value,0,4).")";    
        
        $query = array(
            'SELECT'    => 'rating',
            'FROM'        => DB_TABLE,
            'WHERE'        => 'page = '.$page
        );
        $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);

        $num_rows = $forum_db->num_rows($result);
        $i = 0;
        $star_value = 0;
        while($i < $num_rows)
        {
            $rating = $forum_db->result($result,$i);
            $star_value = $star_value + $rating;
            $i++;
        }
        if($star_value == 0)
        {
            $avg_value = 0;
        }
        else
        {
            $avg_value = $star_value / $num_rows;
        }
}
      ]]>
    </hooks>
</extension>

just wondering the last and largest part of code - where do i hook that to