[ Index ]
 

Code source de GeekLog 1.4.1

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/plugins/spamx/ -> Developer.txt (source)

   1  The spamx plugin interface has been modified so that other modules and
   2  plugins can use the spamx engine to examine user submitted text.
   3  
   4  The code from comment.php can be used as an example of the call.
   5  
   6  // Let plugins have a chance to check for SPAM
   7  $result = PLG_checkforSpam ($comment, $_CONF['spamx']);
   8      
   9  // Now check the result and redirect to index.php if spam action was taken
  10  if ($result > 0) {
  11      // notice no return value here to prevent spam based denial of service attack
  12      echo COM_refresh ($_CONF['site_url'] . '/index.php?msg='
  13                        . $result . '&plugin=spamx');
  14      exit;
  15  }
  16  
  17  All that is required is to send the comment to spamx with the
  18  PLG_checkforSpam call.  The two parameters are the comment text itself and
  19  an action number with tells spamx what actions to take if spam is found. 
  20  You can use the built in actions by passing the sum of the numbers of the
  21  spamx action modules for those actions you want to use.  The actions are
  22  performed in numerical order.  The current action modules are:
  23  
  24  Mail admin     -> 8
  25  Ignore comment -> 128
  26  
  27  So to Ignore the comment pass 128, to mail the admin pass 8, to do both pass
  28  136.  All action module numbers are multiples of 2 and each modules number
  29  is anded with value you pass to the plugin.  The modules are executed in
  30  numerical order so Mail Admin would happen before Ignore Comment.  Best
  31  practices require that you put this action number in a configuration
  32  variable, so that the site admin can change it if necessary.  If you do not
  33  want to use any of the spamx action modules then pass 0 as the action and
  34  check the return from the function call. If spam is found it will return
  35  true if not false.  If you do not pass anything as the action then the
  36  system default will be used.
  37  
  38  Spamx has three types of modules: admin, examine, and action.  Each module
  39  is contained within a class file.  The name of the file the module is in is
  40  critical.  For example: an admin module must end with .Admin.class.php.  The
  41  first part of the file name must be the name of the class contained within
  42  the file.  So if the class was named MassDelete then the file would be named
  43  MassDelete.Admin.class.php.  Examine modules end in .Examine.class.php and
  44  Action modules end in .Action.class.php. If you add a new actions to spamx,
  45  you must assign it a number.  Pick a number not used by other action modules
  46  and in the correct numerical sequence.
  47  


Généré le : Wed Nov 21 12:27:40 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics