Your IP : 216.73.216.240


Current Path : /home/juvelize/martine/administrator/components/com_jhackguard/data/
Upload File :
Current File : /home/juvelize/martine/administrator/components/com_jhackguard/data/input_rules.php

<?php
defined('_JEXEC') or die;

class JHackGuard_Input_Filters {
public $build_time = 1729958961;

public $log_level = 0;

public function __construct()
{
$this->log_level = JComponentHelper::getParams('com_jhackguard')->get('log_level',1);
}

/* Goes through each method of this class and executes it
** ignores run and add_log methods */

public function run(){
$methods = get_class_methods('JHackGuard_Input_Filters');
ob_start();
foreach($methods as $m){
    if(!in_array($m,array('run','add_log','__construct')))
    {
        $this->$m();
    }
}
ob_end_clean();
}

public function add_log($message, $severity)
    {
        /* Compare the system log level and the log request level*/
        $log_this = FALSE;
        switch($severity)
        {
            case 'debug':
                if($this->log_level == 2)
                    $log_this = TRUE;
                    break;
            case 'standard':
                if($this->log_level > 0)
                    $log_this = TRUE;
                    break;
        } 
        //Shall we log?
        if(!$log_this)
        {
            unset($log_this);
            return FALSE;
        }
        unset($log_this);
        //We shall log.
        $log_entry = new stdClass();
        $log_entry->message = $message;
        $log_entry->severity = ucfirst($severity);
        $log_entry->ip_address = $_SERVER['REMOTE_ADDR'];
        
        return JFactory::getDbo()->insertObject('#__jhackguard_logs', $log_entry);
   }
} //End of class