PageRenderTime 37ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/plugins/system/log.php

https://bitbucket.org/asosso/joomla15
PHP | 74 lines | 36 code | 8 blank | 30 comment | 0 complexity | eb154c27bbf36166bf69a095343d81a2 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
  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. // no direct access
  14. defined( '_JEXEC' ) or die( 'Restricted access' );
  15. jimport( 'joomla.plugin.plugin' );
  16. /**
  17. * Joomla! System Logging Plugin
  18. *
  19. * @package Joomla
  20. * @subpackage System
  21. */
  22. class plgSystemLog extends JPlugin
  23. {
  24. /**
  25. * Constructor
  26. *
  27. * For php4 compatability we must not use the __constructor as a constructor for plugins
  28. * because func_get_args ( void ) returns a copy of all passed arguments NOT references.
  29. * This causes problems with cross-referencing necessary for the observer design pattern.
  30. *
  31. * @access protected
  32. * @param object $subject The object to observe
  33. * @param array $config An array that holds the plugin configuration
  34. * @since 1.5
  35. */
  36. function plgSystemLog(& $subject, $config) {
  37. parent::__construct($subject, $config);
  38. }
  39. function onLoginFailure($response)
  40. {
  41. jimport('joomla.error.log');
  42. $log = JLog::getInstance();
  43. $errorlog = array();
  44. switch($response['status'])
  45. {
  46. case JAUTHENTICATE_STATUS_CANCEL :
  47. {
  48. $errorlog['status'] = $response['type'] . " CANCELED: ";
  49. $errorlog['comment'] = $response['error_message'];
  50. $log->addEntry($errorlog);
  51. } break;
  52. case JAUTHENTICATE_STATUS_FAILURE :
  53. {
  54. $errorlog['status'] = $response['type'] . " FAILURE: ";
  55. $errorlog['comment'] = $response['error_message'];
  56. $log->addEntry($errorlog);
  57. } break;
  58. default :
  59. {
  60. $errorlog['status'] = $response['type'] . " UNKNOWN ERROR: ";
  61. $errorlog['comment'] = $response['error_message'];
  62. $log->addEntry($errorlog);
  63. } break;
  64. }
  65. }
  66. }