141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Google's Highly Open Participation Program tries to get young students into Open Source and Joomla! specifically. Everyone is welcome, there are not limits. You can be a coder, documenter, tester, translator to help out. Jump in and start helping!
User avatar
SanderKromwijk
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Thu Dec 13, 2007 2:59 pm

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by SanderKromwijk » Fri Jan 11, 2008 10:23 pm

Hi,

The program can delete messages now.

Sander
You do not have the required permissions to view the files attached to this post.
Simple and elegant messaging. Download the Messaging extension for Joomla! See http://extensions.joomla.org/extensions/4026/details

User avatar
louis.landry
Joomla! Ace
Joomla! Ace
Posts: 1388
Joined: Wed Aug 17, 2005 11:03 pm
Location: San Jose, California
Contact:

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by louis.landry » Fri Jan 11, 2008 10:58 pm

Hi Sander,

Looks an outstanding start for your component and you really are showing a great understsanding of the underlying framework.  A quick note.  If you move your tables/ folder that contains your JTable classes into the administrator then the getTable() method of your models would be much more likely to work.

JModel actually adds the administrator tables folder to its lookup array of paths on line 90 of libraries/joomla/application/component/model.php

Code: Select all

		if (array_key_exists('table_path', $config)) {
			$this->addTablePath($config['table_path']);
		} else if (defined( 'JPATH_COMPONENT_ADMINISTRATOR' )){
			$this->addTablePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'tables');
		}
JPATH_COMPONENT_ADMINISTRATOR is a constant that defines the path to your component's admin root. :)

Great start.

- Louis
Joomla Platform Maintainer
A hacker does for love what others would not do for money.

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by depresz » Sat Jan 12, 2008 12:14 pm

Hi Sander,

Really nice work,
textarea of new message should be 2 times bigger than now. BTW: Look on J!'s PM. There is still encoding problem. What about UTF-8? ;) Now instead: standard chars, f.e.: ±¶¿¼æ“”ñµ, I can see something like this Ä?Å?żźÄ?â??źâ??Å?µĸâ??

I have found quite big bug:
When you are guest, and you enter following address: index.php?option=com_messaging you can access to empty mailbox. It souldn't be available for non-logged in user. That was nothing according to this: enter index.php?option=com_messaging&controller=message&view=message as guest. What can you see? Yeah... That's riht... Send message to somebody. Most interesting is field "From". When I send message from guest to administrator, I had in "from" column name... administrator (ID of user is 0!!!) ;). I didn't send message to other users because I am on local server without mail support and I can't create new account. I think that this vulnerability should be fixed as soon as possible.

Line 131 of file site/models/message.php:
$query = "INSERT INTO #__messaging SET idFrom=".$from.", idTo=".$to[$i].", subject='".$subject."', message='".$message."', date='".$date."'";
I know that is SQL ready and html relpace... but you forgot about apostrophes: idTo='".$to[$i]."', If are everywhere, why not here? xD

I was thinking only about security vulnerabilities, this time.
I spent my entire morning for testing this extension.

Good Luck!,
Tomasz Dobrzyñski
Last edited by depresz on Sat Jan 12, 2008 12:17 pm, edited 1 time in total.
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

User avatar
SanderKromwijk
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Thu Dec 13, 2007 2:59 pm

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by SanderKromwijk » Sat Jan 12, 2008 5:17 pm

Hi,

Thanks Louis Landry!

To depresz:
depresz wrote: Most interesting is field "From". When I send message from guest to administrator, I had in "from" column name... administrator (ID of user is 0!!!) ;). I didn't send message to other users because I am on local server without mail support and I can't create new account. I think that this vulnerability should be fixed as soon as possible.
Actually there was no bug! In the from column it showed the name of the current user  :-[. I also corrected the problem that guests could log in. Thanks to the tip of Louis Landry, encoding now works.

Sander
You do not have the required permissions to view the files attached to this post.
Last edited by SanderKromwijk on Sat Jan 12, 2008 5:21 pm, edited 1 time in total.
Simple and elegant messaging. Download the Messaging extension for Joomla! See http://extensions.joomla.org/extensions/4026/details

User avatar
SanderKromwijk
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Thu Dec 13, 2007 2:59 pm

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by SanderKromwijk » Sun Jan 13, 2008 3:33 pm

Hi,

The program now suggests a username when typing a name in the "To" field.

I uploaded the program to joomlacode. The project can be found at http://joomlacode.org/gf/project/messaging/.

Sander
Simple and elegant messaging. Download the Messaging extension for Joomla! See http://extensions.joomla.org/extensions/4026/details

User avatar
SanderKromwijk
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Thu Dec 13, 2007 2:59 pm

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by SanderKromwijk » Sun Jan 13, 2008 4:37 pm

Hi,

I've added a new function: the users can now disable the messaging program individually thanks to the UserMeta plugin. To do this install the UserMeta program after having installed the messaging program and add the following piece of code to plugins/system/usermeta/user.xml:


No
Yes


The program now contains all current feature requests posted on this forum (so if someone wants something to be added, Post! :P)

The file can be found in JoomlaCode.

Sander
Simple and elegant messaging. Download the Messaging extension for Joomla! See http://extensions.joomla.org/extensions/4026/details

User avatar
SanderKromwijk
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Thu Dec 13, 2007 2:59 pm

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by SanderKromwijk » Mon Jan 14, 2008 8:30 pm

Hi,

I've improved the program a little further, and I gave the administrators more powers (hurray!!). They can now set the maximum size of the inbox.

Sander
You do not have the required permissions to view the files attached to this post.
Simple and elegant messaging. Download the Messaging extension for Joomla! See http://extensions.joomla.org/extensions/4026/details

User avatar
SanderKromwijk
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Thu Dec 13, 2007 2:59 pm

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by SanderKromwijk » Mon Jan 14, 2008 8:56 pm

Hi,

Here is the documentation file.

Sander
You do not have the required permissions to view the files attached to this post.
Simple and elegant messaging. Download the Messaging extension for Joomla! See http://extensions.joomla.org/extensions/4026/details

User avatar
SanderKromwijk
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Thu Dec 13, 2007 2:59 pm

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by SanderKromwijk » Tue Jan 15, 2008 6:31 pm

Hi,

Has anyone tested the extension yet?

Sander
Simple and elegant messaging. Download the Messaging extension for Joomla! See http://extensions.joomla.org/extensions/4026/details

User avatar
SanderKromwijk
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Thu Dec 13, 2007 2:59 pm

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by SanderKromwijk » Tue Jan 15, 2008 8:55 pm

Hi,

I've also made a module which shows the number of messages in your Inbox.

Sander
You do not have the required permissions to view the files attached to this post.
Simple and elegant messaging. Download the Messaging extension for Joomla! See http://extensions.joomla.org/extensions/4026/details

User avatar
MiCCAS
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 188
Joined: Mon Jan 01, 2007 6:59 am
Contact:

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by MiCCAS » Thu Jan 17, 2008 12:44 am

Wow, well done!

I'll do some further testing for you later on and see if we can make sure there are no bugs.. but wow that's amazing work :)
MiCCAS.net Free PC Services

User avatar
mcsmom
Joomla! Exemplar
Joomla! Exemplar
Posts: 7985
Joined: Thu Aug 18, 2005 8:43 pm
Location: New York
Contact:

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by mcsmom » Thu Jan 17, 2008 3:43 pm

Sander.

I'm getting a 500 error on sending a message.


Also i have max error reporting on and i am getting this in my in box

Notice: Undefined property: users in /home/xxxxx/public_html/testpackage/components/com_messaging/views/messages/tmpl/default.php on line 64



The messages come through though!

And I really like the way it looks, simple minimal interface, very elegant :).
So we must fix our vision not merely on the negative expulsion of war, but upon the positive affirmation of peace. MLK 1964.
http://officialjoomlabook.com Get it at http://www.joomla.org/joomla-press-official-books.html Buy a book, support Joomla!.

User avatar
SanderKromwijk
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Thu Dec 13, 2007 2:59 pm

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by SanderKromwijk » Thu Jan 17, 2008 8:46 pm

Hi,

Thanks for testing the program.
mcsmom wrote: I'm getting a 500 error on sending a message.
I don't get this error message. I tried with Firefox and with Internet Explorer, but they both work. I also reinstalled the extension, but I still don't get the error message. Maybe I posted an old version.
mcsmom wrote: Notice: Undefined property: users in /home/xxxxx/public_html/testpackage/components/com_messaging/views/messages/tmpl/default.php on line 64
I forgot to take that part away when I reprogrammed the site. I corrected it now.
mcsmom wrote: And I really like the way it looks, simple minimal interface, very elegant  :).
Thanks :D.

Sander.
You do not have the required permissions to view the files attached to this post.
Simple and elegant messaging. Download the Messaging extension for Joomla! See http://extensions.joomla.org/extensions/4026/details

User avatar
SanderKromwijk
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Thu Dec 13, 2007 2:59 pm

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by SanderKromwijk » Mon Jan 21, 2008 8:31 pm

Hi,

Could someone send his review please?

Sander
Simple and elegant messaging. Download the Messaging extension for Joomla! See http://extensions.joomla.org/extensions/4026/details

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7056
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by AmyStephen » Tue Jan 22, 2008 4:19 am

Sander -

Install works great.

Was able to install and configure the User Meta fine.

User was able to logon and check their data - change their preferences for messaging.

Went to send a message (LOVE the name lookup - that's sweet) - hit the send and got a 500 error:
View not found [name, type, prefix]: frontpage,html,messagesView
Be back later,
Amy

User avatar
SanderKromwijk
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Thu Dec 13, 2007 2:59 pm

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by SanderKromwijk » Tue Jan 22, 2008 4:09 pm

Hi,

I've done some testing and I have found the problem. For some reason, when you send the message, the program redirects to the frontpage view wich is never called and which doesn't exist. I can correct this by adding a view named frontpage, but it would be better not to use a workaround. Could this be Joomla who tries to do something automaticly because of some configuration?
I don't have this problem on my computer. I even installed the program on another computer, but it still works. I'm using xampp as webserver, does this make a difference?
Could other poeple who also get an error message send some information about which build, which server, which installation language and wich browser they use?

Thanks,
Sander
Simple and elegant messaging. Download the Messaging extension for Joomla! See http://extensions.joomla.org/extensions/4026/details

deepthoughts
Joomla! Apprentice
Joomla! Apprentice
Posts: 45
Joined: Tue Sep 27, 2005 1:12 pm
Location: The northern part of Sweden (Piteå)

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by deepthoughts » Tue Jan 22, 2008 8:40 pm

It has to do with the fact that SEF-urls are enabled. I've got the same problem in a component I'm developing, it works great with SEF-urls disabled but the moment you enabled them you get the 500-error and that it's looking for the view frontpage. Just tried the same thing with your component and sure enough, without SEF it works great and when you enable it, voila, error 500. I have started a thread in "Joombie Coding Q/A" but unfortunately I still haven't gotten an answer. (And since I'm quite the n00b when it comes to developing for Joomla this makes me quite lost.)

Some information from the server that this occurs on:

Code: Select all

Database Version:   	 4.1.22-standard
Database Collation: 	utf8_general_ci
PHP Version: 	5.2.4
Web Server: 	Apache [version	1.3.39 (Unix)]
Web Server to PHP interface: 	cgi
Joomla! Version: 	Joomla! 1.5.0 Production/Stable [ Khepri ] 21-January-2008 23:55 GMT
User Agent: 	Mozilla/5.0 (Windows; U; Windows NT 5.1; sv-SE; rv:1.9b2) Gecko/2007121120 Firefox/3.0b2 
Stefan Nitsche
stefan_at_nitsche_dot_se

User avatar
depresz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Thu Nov 29, 2007 4:14 pm
Location: Piotrków Trybunalski, Poland
Contact:

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by depresz » Tue Jan 22, 2008 9:00 pm

Yeah, I confirm
SEF off = com_messaging OK
SEF on = com_messaging 500

Apache/2.2.4 (Ubuntu) PHP/5.2.3-1ubuntu6.3 Server
Opera 9.25, Joomla 21 Jan 08

BTW: SEF is very... bizarre. I don't know why but, it is, just because  :D
Great Hacking Opportunity Project
numbers? sure! 3d 22h on forum, about 500h of work <- this is real GHOP

User avatar
mcsmom
Joomla! Exemplar
Joomla! Exemplar
Posts: 7985
Joined: Thu Aug 18, 2005 8:43 pm
Location: New York
Contact:

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by mcsmom » Wed Jan 23, 2008 2:33 pm

I don't see a router.php file.

Look at one of the core extensions and see how to set it up.

Try com_newsfeed.
So we must fix our vision not merely on the negative expulsion of war, but upon the positive affirmation of peace. MLK 1964.
http://officialjoomlabook.com Get it at http://www.joomla.org/joomla-press-official-books.html Buy a book, support Joomla!.

User avatar
SanderKromwijk
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Thu Dec 13, 2007 2:59 pm

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by SanderKromwijk » Wed Jan 23, 2008 6:15 pm

Hi,

I found the problem. I made an error in the link after sending the message.

Is the router.php file necessary?

Sander
You do not have the required permissions to view the files attached to this post.
Simple and elegant messaging. Download the Messaging extension for Joomla! See http://extensions.joomla.org/extensions/4026/details

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7056
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by AmyStephen » Wed Jan 23, 2008 7:14 pm

Sander -

It really is otherwise those who use SEF URLs end up having parameters with your extension.

Are you having trouble understanding the router logic? We can try to assist.

Thanks!
Amy :)

User avatar
SanderKromwijk
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Thu Dec 13, 2007 2:59 pm

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by SanderKromwijk » Thu Jan 24, 2008 8:17 pm

Hi,

I've added the router.php file. It works for those who use SEF URLs.

Sander
You do not have the required permissions to view the files attached to this post.
Simple and elegant messaging. Download the Messaging extension for Joomla! See http://extensions.joomla.org/extensions/4026/details

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7056
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by AmyStephen » Thu Jan 24, 2008 10:17 pm

Sander -

That router is wonderful. No mismatch of URLs on a SEF URL site - it's very professional.

This is a very complex component. Amazing what you have done. And, all of this while learning how to develop in Joomla! - and - how to use the MVC.

A few things to think about (I am not saying you have to make all these changes; but, you should consider these items)

1. SELECT * FROM #_
It's best to select what is needed.

2. models/message.php getUsers()
This is a great feature (looking up the names). I would suggest not loading both name and username if matching (as below).

Code: Select all

foreach($rows as $row){
	$users[] = $row->name;
	if (!($row->name == $row->username)) {
		$users[] = $row->username;
	}
}
3. Message sent to invalid user
Would be nice to retain the form data and return it to the form.

4. Sending to Multiple users
a. It would be nice for the lookup to start over after the last comma (something like this in com_messaging.script.js)

Code: Select all

	var text = to.value;
	text = text.substring((text.lastIndexOf (",") + 1), (text.length - (text.lastIndexOf (",") - 1) ))
b. It would be nice to be able to send to multiple users (As I look through your code, it looks like you are starting on this)

Code: Select all

//$to = explode("; ", $data["to"]);		Use if mulitple addressees are accepted
5. Tokens
With all of the work that has been done in Joomla! to protect against CSRF, I do recommend you look at adding tokens to your forms.

+++

Sander -

This extension is exceptional. You had to design it and build it and learn J! and MVC and routers all at once. Your work is wonderful. That's why I even suggest some of these things. We don't have a PM system for v 1.5 that I know of and this one is great! Lots of people have been clammering for it. You will find this to be very popular.

Nice work.
Amy :)

User avatar
SanderKromwijk
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Thu Dec 13, 2007 2:59 pm

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by SanderKromwijk » Fri Jan 25, 2008 9:04 pm

Hi,

I've corrected the problems. I also added the possibility to send messages to multiple users. It returns the form information if there is a problem.

But when I tried adding tokens, Joomla returns an error message. "JHTML form not supported. File not found.". How should I add tokens?

Sander
Simple and elegant messaging. Download the Messaging extension for Joomla! See http://extensions.joomla.org/extensions/4026/details

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7056
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by AmyStephen » Fri Jan 25, 2008 10:34 pm

Sander -

Can you share what you have, thus far, and then we can respond to the code with suggestions?

Thanks!
Amy :)

User avatar
SanderKromwijk
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Thu Dec 13, 2007 2:59 pm

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by SanderKromwijk » Fri Jan 25, 2008 11:07 pm

Hi,

Here is the file. The problem is in the message view (called when making a new message).

Sander
You do not have the required permissions to view the files attached to this post.
Simple and elegant messaging. Download the Messaging extension for Joomla! See http://extensions.joomla.org/extensions/4026/details

User avatar
SanderKromwijk
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Thu Dec 13, 2007 2:59 pm

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by SanderKromwijk » Sun Jan 27, 2008 1:33 pm

Hi,

I've found the solution. The anti-CSRF security works now!

Sander
Simple and elegant messaging. Download the Messaging extension for Joomla! See http://extensions.joomla.org/extensions/4026/details

User avatar
SanderKromwijk
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Thu Dec 13, 2007 2:59 pm

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by SanderKromwijk » Sun Jan 27, 2008 1:35 pm

Sorry,

I forgot to attach the file. Here it is!

Sander
You do not have the required permissions to view the files attached to this post.
Last edited by SanderKromwijk on Sun Jan 27, 2008 1:50 pm, edited 1 time in total.
Simple and elegant messaging. Download the Messaging extension for Joomla! See http://extensions.joomla.org/extensions/4026/details

clem75
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Tue Oct 23, 2007 3:44 am

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by clem75 » Sun Jan 27, 2008 1:58 pm

AmyStephen wrote: Sander -
Your work is wonderful. That's why I even suggest some of these things. We don't have a PM system for v 1.5 that I know of and this one is great! Lots of people have been clammering for it. You will find this to be very popular.
I've been using uddeim as a pms on joomla 1.5. Works well.

User avatar
SanderKromwijk
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Thu Dec 13, 2007 2:59 pm

Re: 141 - Implement Private Messaging as a Joomla! v 1.5 extension(s) (Advanced)

Post by SanderKromwijk » Sun Jan 27, 2008 7:22 pm

clem75 wrote: I've been using uddeim as a pms on joomla 1.5. Works well.
I've looked at uddeIM, but the problem is it is made for Joomla 1.0. Even the newest version isn't 1.5 compatible.

Sander
Simple and elegant messaging. Download the Messaging extension for Joomla! See http://extensions.joomla.org/extensions/4026/details


Locked

Return to “Google's Highly Open Participation Contest”