Source for file log.php

Documentation is available at log.php

  1. <?php
  2. /**
  3. @version        $Id: log.php 9764 2007-12-30 07:48:11Z ircmaxell $
  4. @package        Joomla
  5. @copyright    Copyright (C) 2005 - 2008 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.  * @author        Johan Janssens <johan.janssens@joomla.org>
  23.  * @package        Joomla
  24.  * @subpackage    System
  25.  */
  26. class  plgSystemLog extends JPlugin
  27. {
  28.     /**
  29.      * Constructor
  30.      *
  31.      * For php4 compatability we must not use the __constructor as a constructor for plugins
  32.      * because func_get_args ( void ) returns a copy of all passed arguments NOT references.
  33.      * This causes problems with cross-referencing necessary for the observer design pattern.
  34.      *
  35.      * @access    protected
  36.      * @param    object    $subject The object to observe
  37.      * @param     array   $config  An array that holds the plugin configuration
  38.      * @since    1.5
  39.      */
  40.     function plgSystemLog($subject$config{
  41.         parent::__construct($subject$config);
  42.     }
  43.  
  44.     function onLoginFailure($response)
  45.     {
  46.         jimport('joomla.error.log');
  47.  
  48.         $log JLog::getInstance();
  49.         $errorlog array();
  50.  
  51.         switch($response['status'])
  52.         {
  53.             case JAUTHENTICATE_STATUS_CANCEL :
  54.             {
  55.                 $errorlog['status']  $response['type'" CANCELED: ";
  56.                 $errorlog['comment'$response['error_message'];
  57.                 $log->addEntry($errorlog);
  58.             break;
  59.  
  60.             case JAUTHENTICATE_STATUS_FAILURE :
  61.             {
  62.                 $errorlog['status']  $response['type'" FAILURE: ";
  63.                 $errorlog['comment'$response['error_message'];
  64.                 $log->addEntry($errorlog);
  65.             }    break;
  66.  
  67.             default :
  68.             {
  69.                 $errorlog['status']  $response['type'" UNKNOWN ERROR: ";
  70.                 $errorlog['comment'$response['error_message'];
  71.                 $log->addEntry($errorlog);
  72.             }    break;
  73.         }
  74.     }
  75. }

Documentation generated on Sun, 06 Apr 2008 07:14:23 +0200 by phpDocumentor 1.4.0a2