plugins/admin/SecurityLog.php
changeset 659 16b5b89c8055
parent 536 218a627eb53e
child 685 17ebe24cdf85
equal deleted inserted replaced
658:49dee7f374bf 659:16b5b89c8055
    66 }
    66 }
    67 
    67 
    68 function get_security_log($num = false)
    68 function get_security_log($num = false)
    69 {
    69 {
    70   global $db, $session, $paths, $template, $plugins; // Common objects
    70   global $db, $session, $paths, $template, $plugins; // Common objects
       
    71   global $lang;
       
    72   
    71   if ( $session->auth_level < USER_LEVEL_ADMIN )
    73   if ( $session->auth_level < USER_LEVEL_ADMIN )
    72   {
    74   {
    73     $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author) VALUES(\'security\',\'seclog_unauth\',' . time() . ',"' . $db->escape($_SERVER['REMOTE_ADDR']) . '","' . $db->escape($session->username) . '");');
    75     $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author) VALUES(\'security\',\'seclog_unauth\',' . time() . ',"' . $db->escape($_SERVER['REMOTE_ADDR']) . '","' . $db->escape($session->username) . '");');
    74     if ( !$q )
    76     if ( !$q )
    75       $db->_die();
    77       $db->_die();
    76     die('Security log: unauthorized attempt to fetch. Call has been logged and reported to the administrators.');
    78     die('Security log: unauthorized attempt to fetch. Call has been logged and reported to the administrators.');
    77   }
    79   }
    78   
    80   
    79   $return = '<div class="tblholder" style="/* max-height: 500px; clip: rect(0px,auto,auto,0px); overflow: auto; */"><table border="0" cellspacing="1" cellpadding="4" width="100%">';
    81   $return = '<div class="tblholder" style="/* max-height: 500px; clip: rect(0px,auto,auto,0px); overflow: auto; */"><table border="0" cellspacing="1" cellpadding="4" width="100%">';
    80   $cls = 'row2';                                                                                               
    82   $cls = 'row2';                                                                                               
    81   $return .= '<tr><th style="width: 60%;">Type</th><th>Date</th><th>Username</th><th>IP Address</th></tr>';
    83   $return .= '<tr><th style="width: 60%;">' . $lang->get('acpsl_col_type') . '</th><th>' . $lang->get('acpsl_col_date') . '</th><th>' . $lang->get('acpsl_col_username') . '</th><th>' . $lang->get('acpsl_col_ip') . '</th></tr>';
    82   $hash = sha1(microtime());
    84   $hash = sha1(microtime());
    83   if ( defined('ENANO_DEMO_MODE') )
    85   if ( defined('ENANO_DEMO_MODE') )
    84   {
    86   {
    85     require('config.php');
    87     require('config.php');
    86     $hash = md5($dbpasswd);
    88     $hash = md5($dbpasswd);