1 (edited by Mako 2005-01-13 16:47)

Topic: Easy Smilies

##
##
##        Mod title:  Easy Smiles
##
##      Mod version:  1.0.1
##   Works on PunBB:  1.2
##     Release date:  2005-01-13
##           Author:  Jon "Mako" Ursenbach (mako@medievalbattles.com)
##
##      Description:  Want an easier way to put smilies on your board?
##
##    Affected files:  include/parser.php
##                    plugins/AP_EasySmiles.php
##
##       Affects DB:  Yes
##
##            Notes:  Adds smilies into the database, rather than into
##                    parser.php. In order use, follow instructions then go
##                    to your admin panel and use the Easy Smilies plugin.
##                    The instructions on there are pretty self-explanatory.
##
##       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.
##
##

http://img109.exs.cx/img109/3953/untitled4gx.jpg

Download Here

I still have a few things to do with this plugin (like make it so it shows the smilies you currently have in your database, and a way to delete them instead of going through a database editor, uploading of phpBB smiley .pak files). Please leave comments.

Site note: I am surprised I was able to do the array merging on the first try. I am not too familiar with arrays, so horray for me. Want a cookie? Yes, please.

"You start coding. I'll go find out what they want." - Computer Analyst to Programmer

Re: Easy Smilies

Error:
The constant PUN_ROOT must be defined and point to a valid PunBB installation root directory.

Must   define('PUN_ROOT', './'); !!!   before $pun_root = './';

3 (edited by alrond 2005-01-13 11:33)

Re: Easy Smilies

Notice: Undefined variable: db_prefix in /srv/www/htdocs/web1/html/punbb/install_mod.php on line 23
Installation successful
Smiley SDK has been installed successfully. See readme.txt for further instructions.

Line 23: $sql = 'CREATE TABLE '.$db_prefix."smilies (

Re: Easy Smilies

It should be $db->prefix

"Programming is like sex: one mistake and you have to support it for the rest of your life."

5 (edited by alrond 2005-01-13 12:22)

Re: Easy Smilies

in AP_EasySmiles.php line 66

Wrong!!!
$db->query('INSERT INTO '.$db->prefix."smilies (id, image, text) VALUES('', '$smiley_code', '$smiley_image')") or error('Unable to add smiley', __FILE__, __LINE__, $db->error());

must!!!!!!!
$db->query('INSERT INTO '.$db->prefix."smilies (id, image, text) VALUES('', '$smiley_image', '$smiley_code')") or error('Unable to add smiley', __FILE__, __LINE__, $db->error());

6 (edited by alrond 2005-01-13 12:49)

Re: Easy Smilies

All image is 15*15
parser.php line 361

//        $text = preg_replace("#(?<=.\W|\W.|^\W)".preg_quote($smiley_text[$i], '#')."(?=.\W|\W.|\W$)#m", '$1<img src="img/smilies/'.$smiley_img[$i].'" width="15" height="15" alt="'.substr($smiley_img[$i], 0, strrpos($smiley_img[$i], '.')).'" />$2', $text);

neu!
        $text = preg_replace("#(?<=.\W|\W.|^\W)".preg_quote($smiley_text[$i], '#')."(?=.\W|\W.|\W$)#m", '$1<img src="img/smilies/'.$smiley_img[$i].'" alt="'.substr($smiley_img[$i], 0, strrpos($smiley_img[$i], '.')).'" />$2', $text);

7 (edited by Mako 2005-01-13 16:46)

Re: Easy Smilies

Wow that's a lot of bugs. Guess that's what I get for coding half-asleep. I'll get right on fixing them. Thanks.

EDIT: Okay, fixed the bugs. Download v1.0.1 here.

"You start coding. I'll go find out what they want." - Computer Analyst to Programmer

8

Re: Easy Smilies

Ok nice but i didnt undrastend somthing why you don't change that "when you post anew topic or sen a replay for topic the smiley will show behind the "massage bady" and if i wanna to add a smiley to the massage i just Click above the smiley and it's will add to the massage...

Yours, Benny.

9

Re: Easy Smilies

That mod already exists. This mod was made to make it easier to input smilies into your board, rather than doing it the normal, eye-peeling way (editing $smiley_text and $smiley_img in the parser file).

"You start coding. I'll go find out what they want." - Computer Analyst to Programmer

Re: Easy Smilies

Okay, I downloaded 1.0.1 and it gives me an error on line 32, which is:

            $sql = 'CREATE TABLE '.$db->prefix.."smilies (

Is it really supposed to be $db->prefix and not $db_prefix?

-Tim

Re: Easy Smilies

i think the error is there are two . after prefix but it might be something else $db->prefix is correct

12

Re: Easy Smilies

Yeah I encountered that bug as well when running it on my forum (I had it only installed on a test forum). For a hotfix, just go into whichever GUI for MySQL you use and make the table through there. I'll see what I can do about the bug though.

"You start coding. I'll go find out what they want." - Computer Analyst to Programmer

Re: Easy Smilies

yelowpunk wrote:

Okay, I downloaded 1.0.1 and it gives me an error on line 32, which is:

            $sql = 'CREATE TABLE '.$db->prefix.."smilies (

Is it really supposed to be $db->prefix and not $db_prefix?

-Tim

I have the same message, why ?

Re: Easy Smilies

Mako wrote:

Yeah I encountered that bug as well when running it on my forum (I had it only installed on a test forum). For a hotfix, just go into whichever GUI for MySQL you use and make the table through there. I'll see what I can do about the bug though.

i told you you have put 2 . when you only need one just replace that line with

$sql = 'CREATE TABLE '.$db->prefix."smilies (

and you should really test install_mod.php before you release it at least just see it actually runs

15

Re: Easy Smilies

Yeah I know. It was around 1am when I made the mod so I wasn't all there, if you know what I mean. Fixed the bug on my system, will add a new feature to the mod today and release v1.0.2 this evening.

Thanks for solving that problem for me though.

"You start coding. I'll go find out what they want." - Computer Analyst to Programmer

Re: Easy Smilies

ok np, also yelowpunk its much more helpful if you give the actual error, since the error was "unexpected '.'" which would make it more obvious wink

17

Re: Easy Smilies

Yeah lol. Guess I really can't explain myself there. I must have been really tired or something.

"You start coding. I'll go find out what they want." - Computer Analyst to Programmer

Re: Easy Smilies

I got this error:

Parse error: parse error in C:\intranet\Apache2\htdocs\forum\install_mod.php on line 32

19 (edited by Mako 2005-01-20 01:37)

Re: Easy Smilies

Made a new update with bug fixes. Continue in this thread: http://punbb.org/forums/viewtopic.php?id=5942

"You start coding. I'll go find out what they want." - Computer Analyst to Programmer