addcomment

The Contact Form 7 - Infusionsoft Add-on addcomment function.

Description

addcomment( $m ); 

Parameters (1)

0. $m
The m.

Usage

  1. if ( !function_exists( 'addcomment' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'contact-form-7-infusionsoft-add-on/src/xmlrpc-3.0/demo/server/discuss.php'; 
  3.  
  4. // The m. 
  5. $m = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = addcomment($m); 
  9.  

Defined (1)

The function is defined in the following location(s).

/src/xmlrpc-3.0/demo/server/discuss.php  
  1. function addcomment($m) 
  2. global $xmlrpcerruser; 
  3. $err=""; 
  4. // since validation has already been carried out for us,  
  5. // we know we got exactly 3 string values 
  6. $n = php_xmlrpc_decode($m); 
  7. $msgID = $n[0]; 
  8. $name = $n[1]; 
  9. $comment = $n[2]; 
  10.  
  11. $dbh=dba_open("/tmp/comments.db", "c", "db2"); 
  12. if($dbh) 
  13. $countID="${msgID}_count"; 
  14. if(dba_exists($countID, $dbh)) 
  15. $count=dba_fetch($countID, $dbh); 
  16. else 
  17. $count=0; 
  18. // add the new comment in 
  19. dba_insert($msgID . "_comment_${count}", $comment, $dbh); 
  20. dba_insert($msgID . "_name_${count}", $name, $dbh); 
  21. $count++; 
  22. dba_replace($countID, $count, $dbh); 
  23. dba_close($dbh); 
  24. else 
  25. $err="Unable to open comments database."; 
  26. // if we generated an error, create anerrorreturn response 
  27. if($err) 
  28. return new xmlrpcresp(0, $xmlrpcerruser, $err); 
  29. else 
  30. // otherwise, we create the right response 
  31. // with the state name 
  32. return new xmlrpcresp(new xmlrpcval($count, "int"));