split sending of ecards into an API call

stella - October 19, 2009 - 16:35
Project:ecard
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

I'm integrating a custom module with the ecard module. I don't want to use the standard form, and have instead created my own. As a result I wanted there to be a 'ecard_send_card()' function which I could call with all the necessary information and the card(s) would be sent. Currently all of this code logic resides in the submit handler for the standard form. I've split it out into its own function so now I can avail of the same functionality via a handy api call.

Cheers,
Stella

AttachmentSize
ecard_api.patch5.12 KB

#1

stella - October 19, 2009 - 17:06

oops spotted a mistake when notifications are disabled. Fixed now.

AttachmentSize
ecard_api.patch 5.41 KB

#2

Kars-T - October 30, 2009 - 19:02

+++ ecard.module 19 Oct 2009 17:05:20 -0000
@@ -375,13 +375,43 @@ function ecard_form_validate($form_id, &
+  $form_state['nid'] = $node->nid;

This gives me a PHP Notice and I can't understand why you do this and where $node comes from?

I reworked the patch a bit. Biggest change is that I removed the random handling to make it a bit faster and uncomplicated. The version to generate MD5 hashes till you find one not in the database is very secure. But as there is no transaction active not 100% secure. So hashing microtime with some salt should be fair enough.

Please take a look at it so we can submit this :)

I'm on crack. Are you, too?

AttachmentSize
ecard_api-608684-D6-v02.patch 5.87 KB

#3

stella - October 30, 2009 - 20:59
Status:needs review» reviewed & tested by the community

Hmmm looks like that line was in the original ecard_form_submit(). I don't see any need for it, so it can probably be removed alright. The new patch looks good, especially the new random key generation.

#4

Kars-T - November 2, 2009 - 12:13
Status:reviewed & tested by the community» fixed

#608684 by stella, Kars-T: Added split sending of ecards into an API call.

Commited.

#5

System Message - November 16, 2009 - 12:20
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.