[ Index ]
 

Code source de GeekLog 1.4.1

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/plugins/spamx/ -> MailAdmin.Action.class.php (source)

   1  <?php
   2  
   3  /**
   4   * File: MailAdmin.Action.class.php
   5   * This is the Mail Admin Action for the Geeklog Spam-X plugin
   6   * 
   7   * Copyright (C) 2004-2006 by the following authors:
   8   * Author   Tom Willett     tomw AT pigstye DOT net
   9   * 
  10   * Licensed under GNU General Public License
  11   *
  12   * $Id: MailAdmin.Action.class.php,v 1.13 2006/08/12 14:22:48 dhaun Exp $
  13   */
  14  
  15  if (strpos ($_SERVER['PHP_SELF'], 'MailAdmin.Action.class.php') !== false) {
  16      die ('This file can not be used on its own!');
  17  }
  18  
  19  /**
  20   * Include Abstract Action Class
  21   */
  22  require_once($_CONF['path'] . 'plugins/spamx/' . 'BaseCommand.class.php');
  23  
  24  /**
  25   * Action Class which emails the spam post to the site admin
  26   * 
  27   * @author Tom Willett  tomw@pigstye.net 
  28   */
  29  class MailAdmin extends BaseCommand {
  30      /**
  31       * Constructor
  32       */
  33      function MailAdmin()
  34      {
  35          global $num;
  36  
  37          $num = 8;
  38      } 
  39  
  40      function execute($comment)
  41      {
  42          global $result, $_CONF, $_USER, $LANG_SX00, $_SPX_CONF;
  43  
  44          if (isset ($_USER['uid']) && ($_USER['uid'] > 1)) {
  45              $uid = $_USER['uid'];
  46          } else {
  47              $uid = 1;
  48          }
  49          $uid .= '@' . $_SERVER['REMOTE_ADDR'];
  50          $msg = sprintf ($LANG_SX00['emailmsg'],
  51                          $_CONF['site_name'], $uid, $comment);
  52  
  53          // Add headers of the spam post to help track down the source.
  54          // Function 'getallheaders' is not available when PHP is running as
  55          // CGI. Print the HTTP_... headers from $_SERVER array instead then.
  56          $msg .= "\n\n" . $LANG_SX00['headers'] . "\n";
  57          if (function_exists ('getallheaders')) {
  58              $headers = getallheaders ();
  59              foreach ($headers as $key => $content) {
  60                  if (strcasecmp ($key, 'Cookie') != 0) {
  61                      $msg .= $key . ': ' . $content . "\n";
  62                  }
  63              }
  64          } else {
  65              foreach ($_SERVER as $key => $content) {
  66                  if (substr ($key, 0, 4) == 'HTTP') {
  67                      if ($key != 'HTTP_COOKIE') {
  68                          $msg .= $key . ': ' . $content . "\n";
  69                      }
  70                  }
  71              }
  72          }
  73  
  74          $subject = sprintf ($LANG_SX00['emailsubject'], $_CONF['site_name']);
  75          COM_mail ($_SPX_CONF['notification_email'], $subject, $msg);
  76          $result = 8;
  77          SPAMX_log ('Mail Sent to Admin');
  78          return 0;
  79      }
  80  }
  81  
  82  ?>


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