Dotclear

Changeset 2133


Ignore:
Timestamp:
03/21/10 11:56:19 (14 years ago)
Author:
Moe
Message:

Log 404 Errors 0.5 :

  • added host name
  • escaped all the inputted data before display
Location:
plugins/log404Errors
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • plugins/log404Errors/_admin.php

    r1012 r2133  
    33# 
    44# This file is part of Log 404 Errors, a plugin for Dotclear 2 
    5 # Copyright (C) 2009 Moe (http://gniark.net/) 
     5# Copyright (C) 2009,2010 Moe (http://gniark.net/) 
    66# 
    77# Log 404 Errors is free software; you can redistribute it and/or 
  • plugins/log404Errors/_define.php

    r2045 r2133  
    33# 
    44# This file is part of Log 404 Errors, a plugin for Dotclear 2 
    5 # Copyright (C) 2009 Moe (http://gniark.net/) 
     5# Copyright (C) 2009,2010 Moe (http://gniark.net/) 
    66# 
    77# Log 404 Errors is free software; you can redistribute it and/or 
     
    2626        /* Description*/                'Log and display 404 errors in your administration', 
    2727        /* Author */                    'Moe (http://gniark.net/)', 
    28         /* Version */                   '0.4.1', 
     28        /* Version */                   '0.5', 
    2929        /* Permissions */               'admin' 
    3030); 
  • plugins/log404Errors/_install.php

    r1172 r2133  
    33# 
    44# This file is part of Log 404 Errors, a plugin for Dotclear 2 
    5 # Copyright (C) 2009 Moe (http://gniark.net/) 
     5# Copyright (C) 2009,2010 Moe (http://gniark.net/) 
    66# 
    77# Log 404 Errors is free software; you can redistribute it and/or 
     
    4646     ->dt('timestamp',0,false,'now()') 
    4747     ->ip('varchar',39,true,null) 
     48     ->host('text',0,true,null) 
    4849     ->user_agent('varchar',255,true,null) 
    4950     ->referrer('text',0,true,null) 
  • plugins/log404Errors/_public.php

    r1172 r2133  
    33# 
    44# This file is part of Log 404 Errors, a plugin for Dotclear 2 
    5 # Copyright (C) 2009 Moe (http://gniark.net/) 
     5# Copyright (C) 2009,2010 Moe (http://gniark.net/) 
    66# 
    77# Log 404 Errors is free software; you can redistribute it and/or 
     
    2424if ($core->blog->settings->log404errors_active) 
    2525{ 
    26      $core->addBehavior('publicHeadContent', 
    27           array('log404ErrorsBehaviors','publicHeadContent')); 
     26     $core->addBehavior('publicAfterDocument', 
     27          array('log404ErrorsBehaviors','publicAfterDocument')); 
    2828} 
    2929 
    3030class log404ErrorsBehaviors 
    3131{ 
    32      public static function publicHeadContent($core) 
     32     public static function publicAfterDocument($core) 
    3333     { 
    3434          if ($core->url->type != '404') {return;} 
     
    5151               $cur->dt = date("Y-m-d H:i:s"); 
    5252               $cur->ip = http::realIP(); 
     53               $cur->host = @gethostbyaddr(http::realIP()); 
    5354               $cur->user_agent = $_SERVER['HTTP_USER_AGENT']; 
    5455               $cur->referrer = (isset($_SERVER['HTTP_REFERER']) 
  • plugins/log404Errors/index.php

    r2045 r2133  
    33# 
    44# This file is part of Log 404 Errors, a plugin for Dotclear 2 
    5 # Copyright (C) 2009 Moe (http://gniark.net/) 
     5# Copyright (C) 2009,2010 Moe (http://gniark.net/) 
    66# 
    77# Log 404 Errors is free software; you can redistribute it and/or 
     
    150150                         <th><?php echo(__('Date')); ?></th> 
    151151                         <th><?php echo(__('IP address')); ?></th> 
     152                         <th><?php echo(__('Host name')); ?></th> 
    152153                         <th><?php echo(__('Referrer')); ?></th> 
    153154                         <th><?php echo(__('User agent')); ?></th> 
  • plugins/log404Errors/lib.log404Errors.php

    r1172 r2133  
    33# 
    44# This file is part of Log 404 Errors, a plugin for Dotclear 2 
    5 # Copyright (C) 2009 Moe (http://gniark.net/) 
     5# Copyright (C) 2009,2010 Moe (http://gniark.net/) 
    66# 
    77# Log 404 Errors is free software; you can redistribute it and/or 
     
    3939          else 
    4040          { 
    41                $query = 'SELECT id, url, dt, ip, referrer, user_agent '. 
     41               $query = 'SELECT id, url, dt, ip, host, referrer, user_agent '. 
    4242                    'FROM '.$core->prefix.'errors_log '. 
    4343                    'WHERE (blog_id = \''.$core->con->escape( 
     
    5454          while ($rs->fetch()) 
    5555          { 
    56                $url = html::escapeHTML($rs->url); 
     56               $url = $rs->url; 
     57                
     58               # html::escapeHTML() is used to avoid malicious code injection 
    5759                
    5860               if (strlen($url) > 60) 
    5961               { 
    60                     $url = '<a href="'.$url.'" title="'.$url.'">'. 
    61                          text::cutString($url,60).'&hellip;</a>'; 
     62                    $url = '<a href="'.html::escapeHTML($url).'" '. 
     63                         'title="'.html::escapeHTML($url).'">'. 
     64                         html::escapeHTML(text::cutString($url,60)).'…</a>'; 
    6265               } 
    6366               else 
    6467               { 
    65                     $url = '<a href="'.$url.'" title="'.$url.'">'.$url.'</a>'; 
     68                    $url = '<a href="'.html::escapeHTML($url).'" '. 
     69                         'title="'.html::escapeHTML($url).'">'. 
     70                         html::escapeHTML($url).'</a>'; 
    6671               } 
    6772                
     
    8792                         if (strlen($referrer) > 60) 
    8893                         { 
    89                               $referrer = '<a href="'.$referrer.'" title="'.$referrer.'">'. 
    90                                    text::cutString($referrer,60).'&hellip;</a>'; 
     94                              $referrer = '<a href="'.html::escapeHTML($referrer).'" '. 
     95                                   'title="'.html::escapeHTML($referrer).'">'. 
     96                                   html::escapeHTML(text::cutString($referrer,60)).'…</a>'; 
    9197                         } 
    9298                         else 
    9399                         { 
    94100                              $referrer = '<a href="'. 
    95                                    html::escapeHTML($referrer).'">'.$referrer.'</a>'; 
     101                                   html::escapeHTML($referrer).'">'. 
     102                                        html::escapeHTML($referrer).'</a>'; 
    96103                         } 
    97104                    } 
     
    99106                    $ip = $rs->ip; 
    100107                     
    101                     if (empty($ip)) 
    102                     { 
    103                          $ip = '&nbsp;'; 
    104                     } 
     108                    $ip = ((empty($ip)) ? '&nbsp;' : html::escapeHTML($ip)); 
     109                     
     110                    $host = $rs->host; 
     111                     
     112                    $host = ((empty($host)) ? '&nbsp;' : html::escapeHTML($host)); 
    105113                     
    106114                    $user_agent = $rs->user_agent; 
    107115                     
    108                     if (empty($user_agent)) 
    109                     { 
    110                          $user_agent = '&nbsp;'; 
    111                     } 
     116                    $user_agent = ((empty($user_agent)) 
     117                         ? '&nbsp;' : html::escapeHTML($user_agent)); 
    112118                     
    113119                    echo('<tr>'. 
     
    117123                              $core->blog->settings->blog_timezone).'</td>'. 
    118124                         '<td>'.$ip.'</td>'. 
     125                         '<td>'.$host.'</td>'. 
    119126                         '<td>'.$referrer.'</td>'. 
    120127                         '<td>'.$user_agent.'</td>'. 
  • plugins/log404Errors/locales/fr/main.po

    r2045 r2133  
    11# Language: français 
    2 # Module: log404Errors - 0.4.1 
    3 # Date: 2010-02-07 16:21:34 
     2# Module: log404Errors - 0.5 
     3# Date: 2010-03-21 10:51:45 
    44# Translated with dcTranslater - 1.2 
    55 
     
    77msgstr "Content-Type: text/plain; charset=UTF-8\n" 
    88 
    9 #: index.php:176 
     9#: index.php:177 
    1010msgid "404 Errors" 
    1111msgstr "Erreurs 404" 
     
    2727msgstr "Les erreurs 404 ne sont pas enregistrées." 
    2828 
    29 #: index.php:174 
     29#: index.php:175 
    3030msgid "Summary" 
    3131msgstr "Résumé" 
    3232 
    33 #: index.php:201 
     33#: index.php:202 
    3434msgid "Errors" 
    3535msgstr "Erreurs" 
     
    4040 
    4141#: index.php:152 
     42msgid "Host name" 
     43msgstr "Nom d'hôte" 
     44 
     45#: index.php:153 
    4246msgid "Referrer" 
    4347msgstr "Référent" 
    4448 
    45 #: index.php:196 
     49#: index.php:197 
    4650msgid "drop" 
    4751msgstr "effacer" 
    4852 
    49 #: index.php:179 
     53#: index.php:180 
    5054msgid "Count" 
    5155msgstr "Nombre" 
    5256 
    53 #: index.php:181 
     57#: index.php:182 
    5458msgid "Date of last error" 
    5559msgstr "Date de la dernière erreur" 
    5660 
    57 #: index.php:208 
     61#: index.php:209 
    5862msgid "Settings" 
    5963msgstr "Paramètres" 
    6064 
    61 #: index.php:213 
     65#: index.php:214 
    6266msgid "Log 404 errors" 
    6367msgstr "Enregistrer les erreurs 404" 
    6468 
    65 #: index.php:218 
     69#: index.php:219 
    6670msgid "Errors per page:" 
    6771msgstr "Erreurs par page&nbsp;:" 
    6872 
    69 #: index.php:225 
     73#: index.php:226 
    7074msgid "Save configuration" 
    7175msgstr "Enregistrer la configuration" 
Note: See TracChangeset for help on using the changeset viewer.

Sites map