[geeklog-cvs] Geeklog-1.x/plugins/spamx Developer.txt,1.2,1.3

Dirk Haun dhaun at qs1489.pair.com
Fri May 23 05:14:47 EDT 2008


Update of /cvsroot/geeklog/Geeklog-1.x/plugins/spamx
In directory qs1489.pair.com:/tmp/cvs-serv20777

Modified Files:
	Developer.txt 
Log Message:
Updated Spam-X developer documentation


Index: Developer.txt
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/plugins/spamx/Developer.txt,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Developer.txt	26 Jan 2005 11:19:53 -0000	1.2
--- Developer.txt	23 May 2008 09:14:45 -0000	1.3
***************
*** 1,40 ****
! The spamx plugin interface has been modified so that other modules and
! plugins can use the spamx engine to examine user submitted text.
  
! The code from comment.php can be used as an example of the call.
  
! // Let plugins have a chance to check for SPAM
! $result = PLG_checkforSpam ($comment, $_CONF['spamx']);
      
! // Now check the result and redirect to index.php if spam action was taken
! if ($result > 0) {
!     // notice no return value here to prevent spam based denial of service attack
!     echo COM_refresh ($_CONF['site_url'] . '/index.php?msg='
!                       . $result . '&plugin=spamx');
!     exit;
! }
  
! All that is required is to send the comment to spamx with the
  PLG_checkforSpam call.  The two parameters are the comment text itself and
! an action number with tells spamx what actions to take if spam is found. 
  You can use the built in actions by passing the sum of the numbers of the
! spamx action modules for those actions you want to use.  The actions are
  performed in numerical order.  The current action modules are:
  
! Mail admin     -> 8
! Ignore comment -> 128
  
  So to Ignore the comment pass 128, to mail the admin pass 8, to do both pass
  136.  All action module numbers are multiples of 2 and each modules number
! is anded with value you pass to the plugin.  The modules are executed in
  numerical order so Mail Admin would happen before Ignore Comment.  Best
  practices require that you put this action number in a configuration
  variable, so that the site admin can change it if necessary.  If you do not
! want to use any of the spamx action modules then pass 0 as the action and
! check the return from the function call. If spam is found it will return
  true if not false.  If you do not pass anything as the action then the
  system default will be used.
  
! Spamx has three types of modules: admin, examine, and action.  Each module
  is contained within a class file.  The name of the file the module is in is
  critical.  For example: an admin module must end with .Admin.class.php.  The
--- 1,51 ----
! The Spam-X plugin interface has been designed so that other modules and
! plugins can use the Spam-X engine to examine user submitted text.
  
! The code from lib-comment.php can be used as an example of the call.
  
!     // Let plugins have a chance to check for SPAM
!     $result = PLG_checkforSpam($comment, $_CONF['Spam-X']);
      
!     // Now check the result and display message if spam action was taken
!     if ($result > 0) {
!         COM_displayMessageAndAbort($result, 'spamx', 403, 'Forbidden');
!     }
  
! Alternatively, you could redirect them to the site's index page:
! 
!     / Now check the result and display message if spam action was taken
!     if ($result > 0) {
!         echo COM_refresh($_CONF['site_url'] . '/index.php?msg='
!                          . $result . '&plugin=spamx');
!         exit;
!     }
! 
! The use of COM_displayMessageAndAbort is recommended, as that will also send
! a proper HTTP status code (403, i.e. "Access denied", in the above example)
! and abort immediately while COM_refresh will cause another page load and put
! additional load on the webserver.
! 
! All that is required is to send the comment to Spam-X with the
  PLG_checkforSpam call.  The two parameters are the comment text itself and
! an action number which tells Spam-X what actions to take if spam is found. 
  You can use the built in actions by passing the sum of the numbers of the
! Spam-X action modules for those actions you want to use.  The actions are
  performed in numerical order.  The current action modules are:
  
!     Mail admin     -> 8
!     Ignore comment -> 128
  
  So to Ignore the comment pass 128, to mail the admin pass 8, to do both pass
  136.  All action module numbers are multiples of 2 and each modules number
! is AND'ed with the value you pass to the plugin.  The modules are executed in
  numerical order so Mail Admin would happen before Ignore Comment.  Best
  practices require that you put this action number in a configuration
  variable, so that the site admin can change it if necessary.  If you do not
! want to use any of the Spam-X action modules then pass 0 as the action and
! check the return from the function call.  If spam is found it will return
  true if not false.  If you do not pass anything as the action then the
  system default will be used.
  
! Spam-X has three types of modules: admin, examine, and action.  Each module
  is contained within a class file.  The name of the file the module is in is
  critical.  For example: an admin module must end with .Admin.class.php.  The
***************
*** 42,46 ****
  the file.  So if the class was named MassDelete then the file would be named
  MassDelete.Admin.class.php.  Examine modules end in .Examine.class.php and
! Action modules end in .Action.class.php. If you add a new actions to spamx,
  you must assign it a number.  Pick a number not used by other action modules
  and in the correct numerical sequence.
--- 53,57 ----
  the file.  So if the class was named MassDelete then the file would be named
  MassDelete.Admin.class.php.  Examine modules end in .Examine.class.php and
! Action modules end in .Action.class.php.  If you add a new action to Spam-X,
  you must assign it a number.  Pick a number not used by other action modules
  and in the correct numerical sequence.




More information about the geeklog-cvs mailing list