Index: /extensions/Piwecard/include/piwecard.class.php
===================================================================
--- /extensions/Piwecard/include/piwecard.class.php	(revision 20430)
+++ /extensions/Piwecard/include/piwecard.class.php	(revision 20431)
@@ -6,10 +6,15 @@
 	var $user_groups = array();
 	
-	// Class constructor
+	/**
+	 * Constructor
+	 */
 	function __construct() {
 		$this->get_config();
 	}
 	
-	// Load general configuration from config_database
+	/**
+	 * Load configuration from database
+	 * Assign value to the variable $config
+	 */
 	function get_config() {
 		$query = 'SELECT value FROM '.CONFIG_TABLE.' WHERE param="piwecard";';
@@ -25,5 +30,8 @@
 	}
 	
-	// Initialize default values of params
+	/**
+	 * Load default configuration from the install directory
+	 * Assign value to the variable $config
+	 */
 	private function get_default_config() {
 	    require(PIWECARD_INSTALL_PATH.'default_values.inc.php');
@@ -34,5 +42,9 @@
 	}
 
-	//Get the default value of a parameter
+	/**
+	 * Get the default value of a parameter
+	 * @param name of the parameter
+	 * @return the default config of the parameter
+	 */
 	function get_default_config_param($param) {
 	    require(PIWECARD_INSTALL_PATH.'default_values.inc.php');
@@ -40,9 +52,14 @@
 	}
 	
-	// Save  general configuration to config_database
+	/**
+	 * Save the current configuration (ie the value of $config) to the database
+	 */
 	function set_config() {
 		conf_update_param('piwecard', pwg_db_real_escape_string(serialize($this->config)));
 	}
 	
+	/**
+	 * Initialize the section parameter of the page
+	 */
 	function section_init_ecard() {
 		global $tokens, $page;
@@ -52,7 +69,9 @@
 	}
 	
+	/**
+	 * Load the ecard
+	 */
 	function index_ecard() {
-		global $page;
-		
+		global $page;	
 		if (isset($page['section']) and $page['section'] == 'ecard') {
 			include('publish.inc.php');
@@ -60,5 +79,9 @@
 	}
 
-	//Générer une chaine de caractère unique et aléatoire
+	/**
+	 * Get a random string
+	 * @param Integer number of caracter of the random string
+	 * @return String the random string
+	 */
 	private function random($car) {
 		$string = "";
@@ -71,4 +94,11 @@
 	}
 	
+	/**
+	 * Parse the message
+	 * @param String string to parse
+	 * @param Array parser parameters
+	 * @param Array an array with the id and the url of the image
+	 * @return String the parsed string
+	 */
 	function parse($data, $values, $image_element) {
 		include (PIWECARD_PATH.'include/parse_param.inc.php');
@@ -84,5 +114,8 @@
 	}
 	
-	// Get the number of ecard in the database
+	/**
+	 * Get the number of ecards in the database
+	 * @return Integer number of ecards
+	 */
 	function get_nb_ecard() {
 		$query = 'SELECT COUNT(DISTINCT ecard_id) AS nb FROM '.PIWECARD_TABLE.' ORDER BY date_creation;';
@@ -96,5 +129,8 @@
 	}
 
-	// Get the number of valid ecard in the database
+	/**
+	 * Get the number of validecards in the database
+	 * @return Integer number of valid ecards
+	 */
 	function get_nb_valid_ecard() {
 		$query = 'SELECT COUNT(DISTINCT ecard_id) AS nb FROM '.PIWECARD_TABLE.' WHERE date_validity IS NULL OR date_validity > NOW();';
@@ -108,7 +144,10 @@
 	}
 	
-	
-	// Get ecard information into array
-	function get_ecard($ecard_id = null) {
+	/**
+	 * Get ecard informations into an array
+	 * @param Integer ecard id
+	 * @return Array informations of the ecard
+	 */
+	function get_ecard($ecard_id) {
 		if ($ecard_id!== null) {
 			$query = 'SELECT * FROM ' . PIWECARD_TABLE .' WHERE ecard_id="' . $ecard_id . '" LIMIT 1;';
@@ -122,5 +161,10 @@
 	}
 
-	function is_valid($ecard_id = null) {
+	/**
+	 * Is the ecard valid?
+	 * @param Integer ecard id
+	 * @return Boolean True if valid, False otherwise
+	 */
+	function is_valid($ecard_id) {
 		if (isset($ecard_id)) {
 			$ecard_info = $this->get_ecard($ecard_id);
@@ -146,7 +190,9 @@
 	}
 	
-	// delete one ecard
-	// force to delete valid ecard
-	function delete_ecard($ecard_id = null) {
+	/**
+	 * Delete one ecard
+	 * @param Integer ecard id
+	 */
+	function delete_ecard($ecard_id) {
 		if (isset($ecard_id)) {
 			$query = 'DELETE FROM ' . PIWECARD_TABLE .' WHERE ecard_id="' . $ecard_id  . '";';
@@ -156,5 +202,7 @@
 	}
 	
-	// Delete all invalid ecard
+	/**
+	 * Delete all invalid ecards
+	 */
 	function delete_allinvalid_ecard() {
 		$query = 'DELETE FROM ' . PIWECARD_TABLE .' WHERE date_validity < NOW();';
@@ -162,4 +210,9 @@
 	}
 	
+	/**
+	 * Is the email valid?
+	 * @param String email address
+	 * @return Boolean True if valid, False otherwise
+	 */
 	function is_valid_email($email_address) {
 		$syntax = '#^[\w.-]+@[\w.-]+\.[a-zA-Z]{2,6}$#';
@@ -171,5 +224,7 @@
 	}
 	
-	// Add tpl to picture.php page to display ecard informations 
+	/**
+	 * Add tpl to picture.php page to display ecard informations
+	 */
 	function display_ecard_to_picture() {
 		global $page, $user, $template;
@@ -413,5 +468,8 @@
 	}
 	
-	//Send an email
+	/**
+	 * Send an email
+	 * @param Array informations of the email
+	 */
 	function mail($email_infos) {
 		global $lang_info;
@@ -459,4 +517,9 @@
 	}
 	
+	/**
+	 * Get the content of the email when the format is plain text
+	 * @param String the email message
+	 * @param Smarty a smarty object
+	 */
 	function get_text_message($message_text, $smarty) {
 		global $page, $conf;
@@ -474,4 +537,9 @@
 	}
 	
+	/**
+	 * Get the content of the email when the format is html
+	 * @param String the email message
+	 * @param Smarty a smarty object
+	 */
 	function get_html_message($message_html, $smarty) {
 		global $page, $conf;
Index: /extensions/Piwecard/install/functions.inc.php
===================================================================
--- /extensions/Piwecard/install/functions.inc.php	(revision 20430)
+++ /extensions/Piwecard/install/functions.inc.php	(revision 20431)
@@ -1,3 +1,7 @@
 <?php
+/**
+ * Create the piwecard table in the database
+ * @param String name of the table
+ */
 function piwecard_db_create($table) {
 	$query = 'CREATE TABLE ' . $table . ' (
@@ -18,4 +22,8 @@
 }
 
+/**
+ * Delete the piwecard table in the database
+ * @param String name of the table
+ */
 function piwecard_db_delete($table) {
 	$query = 'DROP TABLE ' . $table . ';';
@@ -23,4 +31,9 @@
 }
 
+/**
+ * Update the piwecard table in the database from Piwecard version 2.3
+ * @param String old table name
+ * @param String new table name
+ */
 function piwecard_db_update_from_2_3($old_table, $new_table) {
 	$query = 'SELECT * FROM '.$old_table.';';
@@ -49,4 +62,8 @@
 }
 
+/**
+ * Update the piwecard table in the database from Piwecard version 2.4.a.b3
+ * @param String table name
+ */
 function piwecard_db_update_from_2_4a_b3($table) {
 	$query = 'ALTER TABLE '.$table.' DROP PRIMARY KEY;';
@@ -58,4 +75,8 @@
 }
 
+/**
+ * Create the piwecard entry in the config table of the database
+ * @param String entry name
+ */
 function piwecard_conf_create($name) {
 	$query = 'INSERT INTO '.CONFIG_TABLE.' (param,value,comment) VALUES ("'.$name.'","","'.ucfirst($name).' configuration");';
@@ -63,4 +84,8 @@
 }
 
+/**
+ * Delete the piwecard entry in the config table of the database
+ * @param String entry name
+ */
 function piwecard_conf_delete($name){
 	$query = 'DELETE FROM '.CONFIG_TABLE.' WHERE param="'.$name.'";';
@@ -68,4 +93,9 @@
 }
 
+/**
+ * Rename the piwecard entry in the config table of the database
+ * @param String old name
+ * @param String new name
+ */
 function piwecard_conf_rename($old_name, $new_name){
 	$query = 'UPDATE '.CONFIG_TABLE.' SET param="'.$new_name.'" WHERE param="'.$old_name.'";';
Index: /extensions/Piwecard/js/piwecard.js
===================================================================
--- /extensions/Piwecard/js/piwecard.js	(revision 20430)
+++ /extensions/Piwecard/js/piwecard.js	(revision 20431)
@@ -1,2 +1,10 @@
+/**
+ * Check if a field is valid
+ * @param Object element to check
+ * @param Integer type of the element (0 is text, 1 is email, 2 is number)
+ * @param String Style of the error displayed (default = inline)
+ * @param Boolean True if the field can be empty, False otherwise
+ * @return True if OK, False otherwise
+ */
 function piwecard_checkField(element, elementType, display, nullIsOK) {
 	var TEXT = 0;
@@ -51,4 +59,9 @@
 }
 
+/**
+ * Style to add to the field if piwecard_checkField returns false
+ * @param Object element
+ * @param String Style of the error displayed (default = inline)
+ */
 function add_error_style(element, display) {
 	document.getElementById(element.id+'_error').style.display = display;
@@ -56,4 +69,8 @@
 }
 
+/**
+ * Remove the error style from the field if piwecard_checkField returns true
+ * @param Object element
+ */
 function remove_error_style(element) {
 	document.getElementById(element.id+'_error').style.display = 'none';
Index: /extensions/Piwecard/ws/ws_functions.inc.php
===================================================================
--- /extensions/Piwecard/ws/ws_functions.inc.php	(revision 20430)
+++ /extensions/Piwecard/ws/ws_functions.inc.php	(revision 20431)
@@ -12,4 +12,10 @@
 );
 
+/**
+ * Function called by Javascript
+ * @param Array Parameters passed through Javascript
+ * @param
+ * @return String the preview of the email
+ */
 function piwecard_ws_previewEmail($params, $service) {
 	$format_message = $params['format_message'];
@@ -19,4 +25,10 @@
 }
 
+/**
+ * Construct the preview of the email
+ * @param String Email format (text or html)
+ * @param String the email message
+ * @return String the preview of the email
+ */
 function previewEmail($format_message, $message) {
 	$piwecard = new Piwecard();
@@ -47,4 +59,9 @@
 }
 
+/**
+ * Get style from the email template
+ * @param String The value of the node "Style"
+ * @return Array the styles of the email
+ */
 function piwecard_create_style_array($style) {
 	$style = str_replace(array("\n", "\t"), array('', ''), $style);
@@ -66,4 +83,9 @@
 }
 
+/**
+ * Parse the email message
+ * @param String message to parse
+ * @return String parsed message
+ */
 function parse($data) {
 	global $conf;
