[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/plugins/system/ -> log.php (source)

   1  <?php
   2  /**
   3  * @version        $Id: log.php 14401 2010-01-26 14:10:00Z louis $
   4  * @package        Joomla
   5  * @copyright    Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
   6  * @license        GNU/GPL, see LICENSE.php
   7  * Joomla! is free software. This version may have been modified pursuant
   8  * to the GNU General Public License, and as distributed it includes or
   9  * is derivative of works licensed under the GNU General Public License or
  10  * other free or open source software licenses.
  11  * See COPYRIGHT.php for copyright notices and details.
  12  */
  13  
  14  // no direct access
  15  defined( '_JEXEC' ) or die( 'Restricted access' );
  16  
  17  jimport( 'joomla.plugin.plugin' );
  18  
  19  /**
  20   * Joomla! System Logging Plugin
  21   *
  22   * @package        Joomla
  23   * @subpackage    System
  24   */
  25  class  plgSystemLog extends JPlugin
  26  {
  27      /**
  28       * Constructor
  29       *
  30       * For php4 compatability we must not use the __constructor as a constructor for plugins
  31       * because func_get_args ( void ) returns a copy of all passed arguments NOT references.
  32       * This causes problems with cross-referencing necessary for the observer design pattern.
  33       *
  34       * @access    protected
  35       * @param    object    $subject The object to observe
  36       * @param     array   $config  An array that holds the plugin configuration
  37       * @since    1.5
  38       */
  39  	function plgSystemLog(& $subject, $config) {
  40          parent::__construct($subject, $config);
  41      }
  42  
  43  	function onLoginFailure($response)
  44      {
  45          jimport('joomla.error.log');
  46  
  47          $log = JLog::getInstance();
  48          $errorlog = array();
  49  
  50          switch($response['status'])
  51          {
  52              case JAUTHENTICATE_STATUS_CANCEL :
  53              {
  54                  $errorlog['status']  = $response['type'] . " CANCELED: ";
  55                  $errorlog['comment'] = $response['error_message'];
  56                  $log->addEntry($errorlog);
  57              } break;
  58  
  59              case JAUTHENTICATE_STATUS_FAILURE :
  60              {
  61                  $errorlog['status']  = $response['type'] . " FAILURE: ";
  62                  $errorlog['comment'] = $response['error_message'];
  63                  $log->addEntry($errorlog);
  64              }    break;
  65  
  66              default :
  67              {
  68                  $errorlog['status']  = $response['type'] . " UNKNOWN ERROR: ";
  69                  $errorlog['comment'] = $response['error_message'];
  70                  $log->addEntry($errorlog);
  71              }    break;
  72          }
  73      }
  74  }


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1