Re: [Release] ChatLite v0.5.1 (javascript chat on forum index)

rahahm33 wrote:

this extension really needs some work. im not able to use it on my forums due to the mere fact that it doesnt produce valid xhtml code and it lacks basic features such as a submit button (duh?)

Don't be rude. Make a version yourself if you want to improve it.
99% of users don't need a submit button. The ENTER key works just fine

Re: [Release] ChatLite v0.5.1 (javascript chat on forum index)

esupergood wrote:
rahahm33 wrote:

this extension really needs some work. im not able to use it on my forums due to the mere fact that it doesnt produce valid xhtml code and it lacks basic features such as a submit button (duh?)

Don't be rude. Make a version yourself if you want to improve it.
99% of users don't need a submit button. The ENTER key works just fine

how was i being rude? i was simply giving helpful feedback on the extension by pointing out its various flaws that shouldnt have been overlooked in the first place. and saying 99% of users dont need a submit button is plain idiotic on so many levels so im not even going to justify that statement with the obvious explanation. now, clearly if i had the expertise and knowledge in developing xml code/extensions, then i wouldnt be here putting in my 2cents worth, kthanks.

Re: [Release] ChatLite v0.5.1 (javascript chat on forum index)

I'm just saying don't say "Duh" to someone who has worked hard to create a popular extension. Oh and calling me idiotic is also rude. Conversation over.

Re: [Release] ChatLite v0.5.1 (javascript chat on forum index)

zz.... go troll somewhere else nubtube, ur input isnt needed in these forums thx.

55

Re: [Release] ChatLite v0.5.1 (javascript chat on forum index)

So how do I add a submit button? I don't really need it but there are always technoretards out there. I've learned not to overestimate the abilities of individuals. big_smile

Re: [Release] ChatLite v0.5.1 (javascript chat on forum index)

I've modified the extension very slightly to include/remove some things that I needed and I thought I'd post it here for anyone else who needed it.

I've modified it to add the chat to every page. Next, I removed it from showing up for anyone not logged in. Lastly, I removed it from showing up for the default group that everyone is put in when they first register, making it only show up for people you move out of that group and that are logged in.

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE extension SYSTEM "ext-1.0.dtd">

<!--
/**
 * ChatLite: Adds a javascript chat to the forum.
 * Please note the licence DOES NOT apply to prototype's framework supplied with this extension. 
 *
 * @author Neck - http://www.eikylon.net
 * @license Creative Commons Attribution 3.0 Unported - http://creativecommons.org/licenses/by/3.0/
 * @package ek_chatlite 
 */
-->

<extension engine="1.0">
    <id>ek_chatlite</id>
    <title>ChatLite</title>
    <version>0.5.1</version>
    <description>Adds a javascript chat to the forum index.</description>
    <author>Neck - http://www.eikylon.net</author>
    <minversion>1.3</minversion>
    <maxtestedon>1.3.2</maxtestedon>

    <install><![CDATA[

// check the PHP version
if(version_compare(PHP_VERSION, '5.2.1') === -1) {
    $notices[] = '<strong>ERROR !</strong> PHP 5.2.1 or superior required ('.PHP_VERSION.' found). This extension cannot be run on your server, please uninstall it.';
}
// check write access on some files
if(!is_writable($ext_info['path'].'/data/chat.dat') || !is_writable($ext_info['path'].'/data/.htaccess')) {
    $notices[] = '<strong>WARNING !</strong> Write access needed. Please give php the permission to write in <em>ek_chatlite/data/chat.dat</em> and <em>ek_chatlite/data/.htaccess</em> before running the chat.';
}

    ]]></install>

    <hooks>
        <hook id="hd_head" priority="4"><![CDATA[

// add javascript and style files on the Index

// The following line is commented out to add the chatbox to every page (including admin pages). Uncomment it (and the ending bracket) to put it back to only the index page
// if(FORUM_PAGE === 'index') {
if(!$forum_user['is_guest']) { // this will remove the chat for users that aren't logged in
    if($forum_user['g_id'] != $forum_config['o_default_user_group']) { // this removes the chat for the default group, but leaves it for every other group
        $forum_head['prototypejs'] = '<script type="text/javascript" src="'.$ext_info['url'].'/media/js/prototype.js"></script>';
        $forum_head['ek_chatlitejs'] = '<script type="text/javascript" src="'.$ext_info['url'].'/media/js/chat.js?logged='.(($forum_user['is_guest']) ? 0 :(($forum_user['is_admmod']) ? 2 : 1)).'&baseUri='.$base_url.'/&extUri='.$ext_info['url'].'/"></script>';

        if (file_exists($ext_info['path'].'/media/js/lang/'.$forum_user['language'].'.js')) {
            $forum_head['ek_chatlitelangjs'] = '<script type="text/javascript" src="'.$ext_info['url'].'/media/js/lang/'.$forum_user['language'].'.js"></script>';
        } else {
            $forum_head['ek_chatlitelangjs'] = '<script type="text/javascript" src="'.$ext_info['url'].'/media/js/lang/English.js"></script>';
        }

        $ek_chatlite_css = (file_exists($ext_info['path'].'/media/css/'.$forum_user['style'].'.css')) ? $forum_user['style'] : 'default';
        $forum_head['style_ek_chatlite'] = '<link rel="stylesheet" type="text/css" media="screen" href="'.$ext_info['url'].'/media/css/'.$ek_chatlite_css.'.css" />';
    } // comment out this bracket if you remove the default group portion above
} // comment out this bracket if you remove the guest (users not logged in) portion above
// } // removed to add chat to every page
        ]]></hook>
        
        <hook id="mi_new_action"><![CDATA[
        

if ($action == 'ek_chatlite') {
    // the file we work on
    $chatFile = $ext_info['path'].'/data/chat.dat';

    $do = (isset($_POST['do'])) ? $_POST['do'] : null;
    if($do === 'post') {
        date_default_timezone_set('UTC');
        $message = (isset($_POST['message'])) ? forum_trim($_POST['message']) : null;
    
        // check for guests or empty messages
        if($forum_user['is_guest'] == true) {
            header('HTTP/1.x 401 Unauthorized');
            exit();
        } else if (empty($message)) {
            header('HTTP/1.x 404 Not Found');
            exit();
        } else {
            // read chat's content
            $content = file_get_contents($chatFile);
            $content = (empty($content)) ? array() : json_decode($content);

            // prepare values
            $user = htmlspecialchars($forum_user['username']);
            $message = str_replace("\n", '<br />', htmlspecialchars($message));

            // check double message
            $last = end($content);
            if(!empty($last) && $last[1]===$user && $last[3]===$message) {
                header('HTTP/1.x 403 Forbidden');
                exit();
            }

            // add the new message
            $content[] = array(
                md5(uniqid(rand(), true)),
                $user,
                date('r'),
                $message
            );

            // remove if there's more than 50 messages
            while(count($content) >= 50) {
                array_shift($content);
            }

            // encode and write
            $content = json_encode($content);
            file_put_contents($chatFile, $content);
            // push the checksum
            $check = md5($content);
            $htaccess = file_get_contents($ext_info['path'].'/data/.htaccess');
            $htaccess = preg_replace('`X-json "\\\"\w{32}\\\""`', 'X-json "\"'.$check.'\""', $htaccess);
            file_put_contents($ext_info['path'].'/data/.htaccess', $htaccess);
        }
    } else if ($do === 'del') {
        // admins/mods only
        if($forum_user['is_admmod'] != true) {
            header('HTTP/1.x 401 Unauthorized');
            exit();
        }

        // get and validate message id
        $msgId = (isset($_POST['msgId'])) ? $_POST['msgId'] : null;
        if(preg_match('`\w{32}`A', $msgId) == 0) {
            header('HTTP/1.x 404 Not Found');
            exit();
        }

        // get content, seek for the message and delete it
        $found = false;
        $content = file_get_contents($chatFile);
        $content = (empty($content)) ? array() : json_decode($content);
        foreach($content as $i=>$msg) {
            if($msg[0] === $msgId) {
                array_splice($content, $i, 1);
                $found = true;
                break;
            }
        }

        // return new content or an error
        if($found) {
            // encode and write
            $content = json_encode($content);
            file_put_contents($chatFile, $content);
            // push the checksum
            $check = md5($content);
            $htaccess = file_get_contents($ext_info['path'].'/data/.htaccess');
            $htaccess = preg_replace('`X-json "\\\"\w{32}\\\""`', 'X-json "\"'.$check.'\""', $htaccess);
            file_put_contents($ext_info['path'].'/data/.htaccess', $htaccess);
            
        } else {
            header('HTTP/1.x 404 Not Found');
            exit();
        }
    } else {
        $content = file_get_contents($ext_info['path'].'/data/chat.dat');
        $check = md5($content);
    }

    // return chat content
    header('X-json: "'.$check.'"');
    echo $content;
    exit();
}

        ]]></hook>

        <hook id="co_modify_url_scheme"><![CDATA[

// disable token validation for chat submit
if(get_current_url() === $base_url.'/misc.php?action=ek_chatlite') {
    $_POST['csrf_token'] = generate_form_token($base_url.'/misc.php?action=ek_chatlite');
}
        ]]></hook>
    </hooks>
</extension>

The file above is manifest.xml and the modifications begin on about line 42. I've commented all the lines that I've changed and if you remove/modify it to suit your needs, remember to remove the ending brackets (which also have been commented) further down in the code.

57 (edited by Neck 2009-01-01 19:39)

Re: [Release] ChatLite v0.5.1 (javascript chat on forum index)

Sorry not having much time for this lately. Update will come when new year and co are over.

Feel free to share your own modification like slickplaid smile


@rahahm33:
I answered about submit button before your reply.
Regarding standard, to be honest I don't care. I don't see the point of applying standard for the sake of it regardless of what's the return (for example the tons of absolute div on forum index instead of a table is an error imho). This extension works perfectly like this on tested browsers and I wont bother adding useless tags for the beauty of it.

PS: don't misunderstand me, I plenty support standard effort of w3c. But I also do realistic programming, rules are generic, case is specific, main goal is to get it working not to spend 1 day per line of code to be sure its perfect.

58

Re: [Release] ChatLite v0.5.1 (javascript chat on forum index)

I like to think: nice code is happy code. But... ok.

59 (edited by MattF 2009-01-01 21:00)

Re: [Release] ChatLite v0.5.1 (javascript chat on forum index)

Neck wrote:

Regarding standard, to be honest I don't care. I don't see the point of applying standard for the sake of it regardless of what's the return (for example the tons of absolute div on forum index instead of a table is an error imho). This extension works perfectly like this on tested browsers and I wont bother adding useless tags for the beauty of it.

PS: don't misunderstand me, I plenty support standard effort of w3c. But I also do realistic programming, rules are generic, case is specific, main goal is to get it working not to spend 1 day per line of code to be sure its perfect.

Those standards are there for a very good reason. If you are outputting invalid code, it *may* display correctly in all major browsers, as they are at the moment in time. That is all you can say, however. One has no idea how it will display in esoteric clients or even with the next revision of a mainstream client. Making the code valid removes those possibilities. You know then that how it should display is how it will display. You aren't relying on quirks or anything else to render your output.

In truth, it is only a lot of extra work if you don't try and code cleanly from the start. If you make best effort at clean code from the initial moment fo starting the mod, the amount of tidying up required at the end will be minimal.

60

Re: [Release] ChatLite v0.5.1 (javascript chat on forum index)

Yep, it's a something you have to get used to.

61 (edited by slickplaid 2009-01-02 02:55)

Re: [Release] ChatLite v0.5.1 (javascript chat on forum index)

I modified the extension some more to make it validate as XHTML 1.0 Strict and added a send button.

I'm currently working on getting an admin backend added onto it so you can set some options so until I finish that, the previous modifications I've done aren't included.

Modified chatlite:ChatLite 0.6.0

Let me know if you find anything wrong with it as I'm still kind of a novice at this.

62 (edited by rahahm33 2009-01-05 00:49)

Re: [Release] ChatLite v0.5.1 (javascript chat on forum index)

Neck wrote:

Sorry not having much time for this lately. Update will come when new year and co are over.

Feel free to share your own modification like slickplaid

@rahahm33
I answered about submit button before your reply.
Regarding standard, to be honest I don't care. I don't see the point of applying standard for the sake of it regardless of what's the return (for example the tons of absolute div on forum index instead of a table is an error imho). This extension works perfectly like this on tested browsers and I wont bother adding useless tags for the beauty of it.

PS: don't misunderstand me, I plenty support standard effort of w3c. But I also do realistic programming, rules are generic, case is specific, main goal is to get it working not to spend 1 day per line of code to be sure its perfect.

                        Last edited by Neck (2009-01-01 15:39:25)

rofl thats just being lazy then. so you'd rather produce sloppy code that outputs correctly for the time being instead of neat and wellformed code thats guaranteed to output as it should no matter how or what environment its displayed in?

lmao apparently what u fail to realize is that those "generic rules" is what makes code run correctly in the first place, and if u dont care enough about the standards and rules of how things are properly done, then u shouldnt be programming in the first place. what a joke.

// Utchin - Ok, Clam down.

63

Re: [Release] ChatLite v0.5.1 (javascript chat on forum index)

@slickpaid code is free, do what you want... but dont use same name/version as me please.

@rahahm33: if you think I shouldn't be programming I'll just say to not use my code instead of complaining.

64

Re: [Release] ChatLite v0.5.1 (javascript chat on forum index)

Could should be valid, it doesnt take long to do (depending on the amount of code in question) however for the next release the code should be valid. 

However just because the developers views are different to yours, doesn't mean you can be getting personal with each other. Next time, please state improvements such as Making it W3C valid.

We will have guidelines and rules set out for community based extension developers and developers will check code and contact the extension developer about this. If you wish to be part of the extension developing team, start learning! smile

Regarding the same name/version number, members can reupload modifications that they make to the extension you create with the same name/number. Though it would be an idea to change it so people dont get confused.

Sorry. Unactive due to personal life.

65 (edited by iniara 2009-01-09 03:21)

Re: [Release] ChatLite v0.5.1 (javascript chat on forum index)

The modded version looks good.

66

Re: [Release] ChatLite v0.5.1 (javascript chat on forum index)

Utchin wrote:

We will have guidelines and rules set out for community based extension developers and developers will check code and contact the extension developer about this. If you wish to be part of the extension developing team, start learning!

Can't wait till the rest of the devs are back... big_smile you said Jan 11th, right?

Re: [Release] ChatLite v0.5.1 (javascript chat on forum index)

Bug in the manifest.xml file on line 43

$forum_head['ek_chatlitejs'] = '<script type="text/javascript" src="'.$ext_info['url'].'/media/js/chat.js?logged='.(($forum_user['is_guest']) ? 0 :(($forum_user['is_admmod']) ? 2 : 1)).'&baseUri='.$base_url.'/&extUri='.$ext_info['url'].'/"></script>';

change with

 $forum_head['ek_chatlitejs'] = '<script type="text/javascript" src="'.$ext_info['url'].'/media/js/chat.js?logged='.(($forum_user['is_guest']) ? 0 :(($forum_user['is_admmod']) ? 2 : 1)).'&amp;baseUri='.$base_url.'/&amp;extUri='.$ext_info['url'].'/"></script>';

Re: [Release] ChatLite v0.5.1 (javascript chat on forum index)

Great mod thank you

just, i have a menu in my header (i've integrate punBB with wordpress), and it works with jquery, and your chatbox have a conflict with i think, because i don't show the chatbox if i load jquery (1.2.6), if i delete the code for load jquery, my menu works always neutral , and the chatbox work normally

any idea ? because your chatbox isn't based on jquery i think

thanks for your mod smile

Re: [Release] ChatLite v0.5.1 (javascript chat on forum index)

I believe it uses prototype. You might try using jquery in a kind of "safe mode" using the jQuery(); function instead of the shortcut $(); which both prototype and jquery use (i think).

I'll also look into modifying it a bit more to be compatible with other libraries.

http://docs.jquery.com/Using_jQuery_wit … _Libraries

Re: [Release] ChatLite v0.5.1 (javascript chat on forum index)

ok thank for information, i test wink

Re: [Release] ChatLite v0.5.1 (javascript chat on forum index)

I have translatet to Norwegian.
Link: http://rapidshare.com/files/186748550/Norwegian.js.html

PunBB, the FluxBB of tomorrow - today!

72

Re: [Release] ChatLite v0.5.1 (javascript chat on forum index)

Hy!

I downloaded your first chat script (3.0 i think), and its work really good, grat!

At the time i can't install the latest versions because the server isn't mine, and its got only php 5.0

My question is: how could i manage to show the chatbox only for a special group?
Is it possible?

Thanks: Levi-d

73 (edited by Fascist 2009-06-29 04:29)

Re: [Release] ChatLite v0.5.1 (javascript chat on forum index)

Russian translation for ChatLite 0.6.0

http://vip-file.com/download/81e8c51875 … ru.7z.html

Re: [Release] ChatLite v0.5.1 (javascript chat on forum index)

slickplaid wrote:

I modified the extension some more to make it validate as XHTML 1.0 Strict and added a send button.

I'm currently working on getting an admin backend added onto it so you can set some options so until I finish that, the previous modifications I've done aren't included.Modified chatlite:ChatLite 0.6.0

Let me know if you find anything wrong with it as I'm still kind of a novice at this.

Last edited by slickplaid (2009-01-02 02:55:36)

Nice work!

Re: [Release] ChatLite v0.5.1 (javascript chat on forum index)

Anybody know if it is possible to somehow get the chatbox not only on the forums but also on a website?