plugins/admin/SecurityLog.php
changeset 140 40f7fa5fd061
parent 128 01955bf53f96
child 142 ca9118d9c0f2
equal deleted inserted replaced
139:070ff1509cc2 140:40f7fa5fd061
    19   {
    19   {
    20     echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>';
    20     echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>';
    21     return;
    21     return;
    22   }
    22   }
    23   
    23   
    24   if ( defined('ENANO_DEMO_MODE') )
    24   // if ( defined('ENANO_DEMO_MODE') && substr($_SERVER['REMOTE_ADDR'], 0, 8) != '192.168.' )
    25   {
    25   // {
    26     die('Security log is disabled in demo mode.');
    26   //   die('Security log is disabled in demo mode.');
    27   }
    27   // }
    28   
    28   
    29   echo '<h3>System security log</h3>';
    29   echo '<h3>System security log</h3>';
    30   
    30   
    31   // Not calling the real fetcher because we have to paginate the results
    31   // Not calling the real fetcher because we have to paginate the results
    32   $offset = ( isset($_GET['offset']) ) ? intval($_GET['offset']) : 0;
    32   $offset = ( isset($_GET['offset']) ) ? intval($_GET['offset']) : 0;
    77     require('config.php');
    77     require('config.php');
    78     $hash = md5($dbpasswd);
    78     $hash = md5($dbpasswd);
    79     unset($dbname, $dbhost, $dbuser, $dbpasswd);
    79     unset($dbname, $dbhost, $dbuser, $dbpasswd);
    80     unset($dbname, $dbhost, $dbuser, $dbpasswd); // PHP5 Zend bug
    80     unset($dbname, $dbhost, $dbuser, $dbpasswd); // PHP5 Zend bug
    81   }
    81   }
    82   if ( defined('ENANO_DEMO_MODE') && !isset($_GET[ $hash ]) && substr($_SERVER['REMOTE_ADDR'], 0, 8) != '192.168.' )
    82   // if ( defined('ENANO_DEMO_MODE') && !isset($_GET[ $hash ]) && substr($_SERVER['REMOTE_ADDR'], 0, 8) != '192.168.' )
    83   {
    83   // {
    84     $return .= '<tr><td class="row1" colspan="4">Logs are recorded but not displayed for privacy purposes in the demo.</td></tr>';
    84   //   $return .= '<tr><td class="row1" colspan="4">Logs are recorded but not displayed for privacy purposes in the demo.</td></tr>';
    85   }
    85   // }
    86   else
    86   // else
    87   {
    87   // {
    88     if(is_int($num))
    88     if(is_int($num))
    89     {
    89     {
    90       $l = 'SELECT action,date_string,author,edit_summary,time_id,page_text FROM '.table_prefix.'logs WHERE log_type=\'security\' ORDER BY time_id DESC, action ASC LIMIT '.$num.';';
    90       $l = 'SELECT action,date_string,author,edit_summary,time_id,page_text FROM '.table_prefix.'logs WHERE log_type=\'security\' ORDER BY time_id DESC, action ASC LIMIT '.$num.';';
    91     }
    91     }
    92     else
    92     else
    97     while($r = $db->fetchrow())
    97     while($r = $db->fetchrow())
    98     {
    98     {
    99       $return .= seclog_format_inner($r);
    99       $return .= seclog_format_inner($r);
   100     }
   100     }
   101     $db->free_result();
   101     $db->free_result();
   102   }
   102   // }
   103   $return .= '</table></div>';
   103   $return .= '</table></div>';
   104   
   104   
   105   return $return;
   105   return $return;
   106 }
   106 }
   107 
   107 
   113     $r =& $f;
   113     $r =& $f;
   114   }
   114   }
   115   global $db, $session, $paths, $template, $plugins; // Common objects
   115   global $db, $session, $paths, $template, $plugins; // Common objects
   116   $return = '';
   116   $return = '';
   117   static $cls = 'row2';
   117   static $cls = 'row2';
       
   118   if ( substr($_SERVER['REMOTE_ADDR'], 0, 8) != '192.168.' && defined('ENANO_DEMO_MODE') )
       
   119   {
       
   120     $r['edit_summary'] = preg_replace('/([0-9])/', 'x', $r['edit_summary']);
       
   121   }
   118   if ( $r['action'] == 'illegal_page' )
   122   if ( $r['action'] == 'illegal_page' )
   119   {
   123   {
   120     list($illegal_id, $illegal_ns) = unserialize($r['page_text']);
   124     list($illegal_id, $illegal_ns) = unserialize($r['page_text']);
   121     $url = makeUrlNS($illegal_ns, $illegal_id, false, true);
   125     $url = makeUrlNS($illegal_ns, $illegal_id, false, true);
   122     $title = get_page_title_ns($illegal_id, $illegal_ns);
   126     $title = get_page_title_ns($illegal_id, $illegal_ns);