Changeset 3706 for extensions/AStat


Ignore:
Timestamp:
Jul 30, 2009, 7:36:50 PM (15 years ago)
Author:
grum
Message:

Update AStat 2.1.0 - new features
See main.inc.php file for details

Location:
extensions/AStat
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • extensions/AStat/admin/astat_by_ip.tpl

    r3394 r3706  
    1010    {foreach from=$datarows key=name item=data}
    1111      <tr class="StatTableRow">
    12         <td style="white-space: nowrap">{$data.ASTAT_IP_GEOLOCALISATION} {$data.ASTAT_IP_ADRESS}</td>
     12        <td style="white-space: nowrap"><a href="">{$data.ASTAT_IP_BLACKLIST} {$data.ASTAT_IP_GEOLOCALISATION} {$data.ASTAT_IP_ADRESS}</td>
    1313        <td class="number">{$data.PAGES}</td>
    1414        <td class="number">{$data.PICTURES}</td>
  • extensions/AStat/admin/astat_config.tpl

    r3394 r3706  
    2020  }
    2121
     22  function isAValidIP(ip, strict)
     23  {
     24    returnedip=ip;
     25    re = /^(\d{1,3}){1}(\.\d{1,3}){0,3}$/i;
     26    if(re.test(ip))
     27    {
     28      num = ip.split('.');
     29      for(i=0;i<num.length;i++)
     30      {
     31        if(num[i]>255) return(false);
     32      }
     33      if(!strict)
     34      {
     35        returnedip+="%";
     36      }
     37      for(j=4-i;j>0;j--)
     38      {
     39        returnedip+=".%";
     40      }
     41      return(returnedip);
     42    }
     43    else
     44    {
     45      return(false);
     46    }
     47  }
     48
     49  function makeOptionsFromList(list, options)
     50  {
     51    if(list=="")
     52    {
     53       return(false);
     54    }
     55
     56    items=list.split(",");
     57    for(i=0;i<items.length;i++)
     58    {
     59      opt = document.createElement("option");
     60      opt.value=items[i];
     61      opt.text=items[i];
     62      options.appendChild(opt);
     63    }
     64  }
     65
     66  function makeListFromOptions(options)
     67  {
     68    list="";
     69    for(i=0;i<options.length;i++)
     70    {
     71      (i!=0)?list+=",":"";
     72      list+=options[i].value;
     73    }
     74    return(list);
     75  }
     76
     77  function addIP()
     78  {
     79    ip=isAValidIP($("#iaddblackip").val(), true);
     80
     81    if(ip==false) return(false);
     82
     83    list = $("#iblacklistedip").val()+",";
     84    if(list.indexOf(ip+",")==-1)
     85    {
     86      opt = document.createElement("option");
     87      opt.value=ip;
     88      opt.text=ip;
     89      $("#iblacklistip")[0].appendChild(opt);
     90      $("#iblacklistedip").val(makeListFromOptions($("#iblacklistip")[0].options));
     91    }
     92    $("#iaddblackip").val("");
     93    checkButtons();
     94  }
     95
     96  function delIP()
     97  {
     98    opt = $("#iblacklistip")[0];
     99
     100    i=0;
     101    while(i<opt.options.length)
     102    {
     103      if(opt.options[i].selected)
     104      {
     105        opt.removeChild(opt.options[i]);
     106      }
     107      else
     108      {
     109        i++;
     110      }
     111    }
     112    $("#iblacklistedip").val(makeListFromOptions(opt.options));
     113    checkButtons();
     114  }
     115
     116  function checkButtons()
     117  {
     118    $("#idelipbutton").attr('disabled', !($("#iblacklistip")[0].selectedIndex!=-1));
     119    $("#iaddipbutton").attr('disabled', (isAValidIP($('#iaddblackip').val(),true)==false) );
     120  }
     121
     122  function init()
     123  {
     124    makeOptionsFromList($("#iblacklistedip").val(), $("#iblacklistip")[0]);
     125
     126    $("#iaddblackip").bind("keyup focus", getIPList).bind("blur", hideIPList);
     127    p = $("#iaddblackip").offset()
     128    $("#iplist").css({
     129      left:p.left+1,
     130      top:p.top+$("#iaddblackip").outerHeight()-1
     131    });
     132    $("#iblacklistip").bind("change", checkButtons);
     133    checkButtons();
     134  }
     135
     136  function getIPList()
     137  {
     138    /*if($("#iaddblackip").val()=="")
     139    {
     140      ip="%";
     141    }
     142    else
     143    {
     144      ip=isAValidIP($("#iaddblackip").val(),false);
     145    }
     146    if(ip==false) return(false);*/
     147    ip=$("#iaddblackip").val()+"%";
     148
     149    checkButtons();
     150    $("html,input").css({cursor:"progress"});
     151    $.get("{/literal}{$datas.ajaxurl}{literal}", {
     152        ajaxfct:"astat_listip",
     153        ipfilter:ip,
     154        exclude:$("#iblacklistedip").val()
     155      },
     156      function (data)
     157      {
     158        $("#iplist").html(data).css({visibility:"visible"});
     159        $("#iipsellist")
     160          .bind("mouseover", function (event) {
     161              $("#iaddblackip").unbind("blur");
     162          } )
     163          .bind("mouseout", function (event) {
     164              $("#iaddblackip").bind("blur", hideIPList);
     165          } )
     166          .bind("blur", hideIPList)
     167          .bind("change", function (event) {
     168            $("#iaddblackip").val($("#iipsellist").val());
     169            $("#iipsellist").trigger("blur").attr("selectedIndex", -1);
     170            checkButtons();
     171            hideIPList();
     172          } ) ;
     173        $("html,input").css({cursor:"default"});
     174        $("input:text").css({cursor:"text"});
     175      }
     176    );
     177  }
     178
     179  function hideIPList()
     180  {
     181    $("#iplist").css({visibility:"hidden"});
     182  }
     183
    22184</script>
    23185{/literal}
     
    112274      <tr>
    113275        <td>{'AStat_NbIPPerPages'|@translate}</td>
    114         <td><input type="text" name="f_AStat_NpIPPerPages" value="{$datas.f_AStat_NpIPPerPages}" maxlength=4/></td>
     276        <td colspan="2"><input type="text" name="f_AStat_NpIPPerPages" value="{$datas.f_AStat_NpIPPerPages}" maxlength=4/></td>
    115277      </tr>
    116278
    117279      <tr>
    118280        <td>{'AStat_DefaultSortIP'|@translate}</td>
    119         <td>
     281        <td colspan="2">
    120282          <select name="f_AStat_DefaultSortIP">
    121283            {html_options values=$AStat_defaultsortip_list_values output=$AStat_defaultsortip_list_labels selected=$datas.AStat_defaultsortip_selected}
     
    123285        </td>
    124286      </tr>
     287
     288      <tr>
     289        <td>{'AStat_BlackListedIP'|@translate}</td>
     290        <td>
     291          <input type="text" size="15" id="iaddblackip" style="width:200px;" autocomplete="off"/>
     292          <input type="hidden" id="iblacklistedip" name="f_AStat_BlackListedIP" value="{$datas.f_AStat_BlackListedIP}"/>
     293          <div id="iplist"></div>
     294        </td>
     295        <td>
     296          <input type="button" value="{'AStat_AddIP'|@translate}" id="iaddipbutton" onclick="addIP();"/>
     297        </td>
     298      </tr>
     299      <tr>
     300        <td>&nbsp;</td>
     301        <td>
     302         <select multiple size="4" id="iblacklistip" style="width:200px;height:150px;">
     303         </select>
     304        </td>
     305        <td>
     306         <input type="button" value="{'AStat_DelIP'|@translate}" id="idelipbutton" onclick="delIP();"/>
     307        </td>
     308      </tr>
     309
     310
     311
    125312    </table>
    126313  </fieldset>
     
    190377</form>
    191378
    192 
    193 
     379<script type="text/javascript">
     380  init();
     381</script>
     382
  • extensions/AStat/admin/astat_tools.tpl

    r3394 r3706  
     1{known_script id="jquery.ui" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.core.packed.js"}
     2{known_script id="jquery.ui.datepicker" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.datepicker.packed.js"}
     3{assign var="datepicker_language" value="template-common/lib/ui/i18n/ui.datepicker-"|@cat:$lang_info.code|@cat:".js"}
     4
     5{if "PHPWG_ROOT_PATH"|@constant|@cat:$datepicker_language|@file_exists}
     6{known_script id="jquery.ui.datepicker-$lang_info.code" src=$ROOT_URL|@cat:$datepicker_language}
     7{/if}
     8
     9{html_head}
     10<link rel="stylesheet" type="text/css" href="{$ROOT_URL}template-common/lib/ui/ui.datepicker.css">
     11{/html_head}
     12
    113{literal}
    214<script type="text/javascript">
    3  
     15
    416 function enabled_purge()
    517 {
    6         var objconfirm = document.getElementById('purge_history_confirm');
    7         var objdate = document.getElementById('purge_history_date');
    8         var objbutton = document.getElementById('purge_history_button');
    9         var objtype0 = document.getElementById('purge_history_type0');
    10        
     18  re = /\d{2}/\d{2}/\d{4}/i;
    1119
    12         if(((objconfirm.checked==true)&&(objtype0.checked==true)&&(objdate.value.length==10))||
    13            ((objconfirm.checked==true)&&(objtype0.checked==false)))
    14         { objbutton.disabled=false; } else { objbutton.disabled=true; }
     20  if(($('#purge_history_confirm').attr('checked')&&$('#purge_history_type0').attr('checked')&&re.test($('#purge_history_date').val()))||
     21     ($('#purge_history_confirm').attr('checked')&&!('#purge_history_type0').attr('checked')))
     22  {
     23    $('#purge_history_button').attr('disabled', true);
     24  }
     25  else
     26  {
     27    $('#purge_history_button').attr('disabled', false);
     28  }
    1529 }
    1630
    1731 function enabled_deleted_picture()
    1832 {
    19         var objconfirm = document.getElementById('deleted_picture_confirm_resync');
    20         var objbutton = document.getElementById('deleted_picture_resync_button');
     33  var objconfirm = document.getElementById('deleted_picture_confirm_resync');
     34  var objbutton = document.getElementById('deleted_picture_resync_button');
    2135
    22         if(objconfirm.checked==true)
    23         { objbutton.disabled=false; } else { objbutton.disabled=true; }
     36  if($('#deleted_picture_confirm_resync').attr('checked'))
     37  {
     38    $('deleted_picture_resync_button').attr('disabled', false);
     39  }
     40  else
     41  {
     42    $('deleted_picture_resync_button').attr('disabled', true);
     43  }
     44 }
     45
     46 function init()
     47 {
     48   $("#purge_history_date").datepicker({
     49     dateFormat: 'dd/mm/yy',
     50     constrainInput: true,
     51     defaultDate:"-12m",
     52     maxDate:0,
     53     minDate:new Date({/literal}"{$datas.ASTAT_MINDATE}"{literal})
     54   });
    2455 }
    2556
     
    2758{/literal}
    2859
    29 {$datas.ASTAT_RESULT_OK} 
     60{$datas.ASTAT_RESULT_OK}
    3061
    3162<fieldset class='formtable'>
    32         <legend>{'AStat_tools_general_nfo'|@translate}</legend>
    33         <p>{$datas.ASTAT_GENERAL_NFO}</p>
     63  <legend>{'AStat_tools_general_nfo'|@translate}</legend>
     64  <p>{$datas.ASTAT_GENERAL_NFO}</p>
    3465</fieldset>
    3566
     
    5182
    5283<fieldset class='formtable'>
    53         <legend>{'AStat_tools_deleted_picture'|@translate}</legend>
    54         <p>{'AStat_tools_deleted_picture_nfo0'|@translate}</p>
    55         <p>{$datas.ASTAT_DELETED_PICTURE_NFO}</p>
    56         <form method="post" action="" class="general">
    57                 { if isset($datas.AStat_deleted_picture_submit0) and $datas.AStat_deleted_picture_submit0 == 'yes'}
     84  <legend>{'AStat_tools_deleted_picture'|@translate}</legend>
     85  <p>{'AStat_tools_deleted_picture_nfo0'|@translate}</p>
     86  <p>{$datas.ASTAT_DELETED_PICTURE_NFO}</p>
     87  <form method="post" action="" class="general">
     88    { if isset($datas.AStat_deleted_picture_submit0) and $datas.AStat_deleted_picture_submit0 == 'yes'}
    5889      <p class='formtable'>
    5990        <input type="submit" value="{'AStat_tools_deleted_picture_apply'|@translate}" name="apply_tool_deleted_picture"/>
    6091      </p>
    61                 {/if}
    62         </form>
    63         <hr/>
    64         <p>{'AStat_tools_deleted_picture_nfo3'|@translate}</p>
    65        
    66         <form method="post" action="" class="general">
    67                 <p>
     92    {/if}
     93  </form>
     94  <hr/>
     95  <p>{'AStat_tools_deleted_picture_nfo3'|@translate}</p>
     96
     97  <form method="post" action="" class="general">
     98    <p>
    6899      <label>
    69100        <input type="radio" value="prepare" name="fAStat_tools_deleted_picture_action" id="deleted_picture0" {$datas.ASTAT_DELETED_PICTURE_PREPARE} >&nbsp;
    70101        {'AStat_tools_deleted_picture_prepare_action'|@translate}
    71102      </label><br>
    72                   <label>
     103      <label>
    73104        <input type="radio" value="apply" name="fAStat_tools_deleted_picture_action" id="deleted_picture1" {$datas.ASTAT_DELETED_PICTURE_DO_ACTION} >&nbsp;
    74         {'AStat_tools_deleted_picture_do_action'|@translate}{$datas.ASTAT_DELETED_PICTURE_NFO_NB}
     105        {'AStat_tools_deleted_picture_do_action'|@translate}{$datas.ASTAT_DELETED_PICTURE_NFO_NB}
    75106      </label>
    76107    </p>
    77                 <p class='formtable'>
    78                         <input type="checkbox" id="deleted_picture_confirm_resync" onclick="enabled_deleted_picture();"/>
    79                         <input type="submit" value="{'AStat_tools_deleted_picture_do'|@translate}" name="apply_tool_deleted_picture_resync" id="deleted_picture_resync_button" disabled />
    80                 </p>
    81         </form>
     108    <p class='formtable'>
     109      <input type="checkbox" id="deleted_picture_confirm_resync" onclick="enabled_deleted_picture();"/>
     110      <input type="submit" value="{'AStat_tools_deleted_picture_do'|@translate}" name="apply_tool_deleted_picture_resync" id="deleted_picture_resync_button" disabled />
     111    </p>
     112  </form>
    82113</fieldset>
    83114
    84115
    85116<fieldset class='formtable'>
    86         <legend>{'AStat_tools_deleted_category'|@translate}</legend>
    87         <p>{'AStat_tools_deleted_category_nfo0'|@translate}</p>
    88         <p>{$datas.ASTAT_DELETED_CATEGORY_NFO}</p>
    89         <form method="post" action="" class="general">
    90                 {if isset($datas.AStat_deleted_category_submit0) and $datas.AStat_deleted_category_submit0=='yes'}
    91                 <p class='formtable'>
    92                         <input type="submit" value="{'AStat_tools_deleted_category_apply'|@translate}" name="apply_tool_deleted_category"/>
    93                 </p>
    94                 {/if}
    95         </form>
     117  <legend>{'AStat_tools_deleted_category'|@translate}</legend>
     118  <p>{'AStat_tools_deleted_category_nfo0'|@translate}</p>
     119  <p>{$datas.ASTAT_DELETED_CATEGORY_NFO}</p>
     120  <form method="post" action="" class="general">
     121    {if isset($datas.AStat_deleted_category_submit0) and $datas.AStat_deleted_category_submit0=='yes'}
     122    <p class='formtable'>
     123      <input type="submit" value="{'AStat_tools_deleted_category_apply'|@translate}" name="apply_tool_deleted_category"/>
     124    </p>
     125    {/if}
     126  </form>
    96127</fieldset>
    97128
    98129
    99130<fieldset class='formtable'>
    100         <legend>{'AStat_tools_purge_history'|@translate}</legend>
    101         <p>{'AStat_tools_purge_history_nfo'|@translate}</p>
    102         <form method="post" action="" class="general">
    103                 <p>
     131  <legend>{'AStat_tools_purge_history'|@translate}</legend>
     132  <p>{'AStat_tools_purge_history_nfo'|@translate}</p>
     133  <form method="post" action="" class="general">
     134    <p>
    104135      <label>
    105136        <input type="radio" value="bydate" name="fAStat_purge_history_type" id="purge_history_type0" checked onclick="enabled_purge();">&nbsp;
     
    107138      </label>
    108139
    109       <input type="text" id="purge_history_date" name="fAStat_purge_history_date" value="" maxlength=10 onchange="enabled_purge();"/><br>
     140      <input type="text" id="purge_history_date" name="fAStat_purge_history_date" size="10" onchange="enabled_purge();"/><br>
    110141
    111142      <label>
     
    113144        {$datas.ASTAT_PURGE_HISTORY_IMAGE_NFO}
    114145      </label>
    115       <br>
     146      <br/>
    116147
    117148      <label>
    118149        <input type="radio" value="bycategoryid0" name="fAStat_purge_history_type" id="purge_history_type2" onclick="enabled_purge();" {$datas.ASTAT_PURGE_HISTORY_CATEGORY_DISABLED}>&nbsp;
    119150        {$datas.ASTAT_PURGE_HISTORY_CATEGORY_NFO}
     151      </label>
     152      <br/>
     153
     154      <label>
     155        <input type="radio" value="byipid0" name="fAStat_purge_history_type" id="purge_history_type3" onclick="enabled_purge();" {$datas.ASTAT_PURGE_HISTORY_IP_DISABLED}>&nbsp;
     156        {$datas.ASTAT_PURGE_HISTORY_IP_NFO}
    120157      </label>
    121158    </p>
     
    126163    </p>
    127164
    128         </form>
     165  </form>
    129166</fieldset>
    130167
     168<script type="text/javascript">
     169  init();
     170</script>
  • extensions/AStat/astat_aim.class.inc.php

    r3394 r3706  
    2020
    2121class AStat_AIM extends common_plugin
    22 { 
     22{
    2323  protected $css = null;
    2424
     
    6161      'AStat_BarColor_Cat' => 'fff966',
    6262      'AStat_DefaultSortIP' => 'page',    //page, ip, picture
    63       'AStat_SeeTimeRequests' => 'false'
     63      'AStat_SeeTimeRequests' => 'false',
     64      'AStat_BlackListedIP' => ''    // ip blacklisted (separator : ",")
    6465      );
    6566
     
    9697  function generate_CSS()
    9798  {
    98     $text = ".AStatBar1, .AStatBar2, .AStatBar3, .AStatBar4, .AStatBarX { 
    99       border:0px; 
     99    $text = ".AStatBar1, .AStatBar2, .AStatBar3, .AStatBar4, .AStatBarX {
     100      border:0px;
    100101      height:8px;
    101102      display: block;
     
    105106      position:relative;
    106107      }
    107        .MiniSquare1, .MiniSquare2, .MiniSquare3, .MiniSquare4 { 
    108       border:0px; 
     108       .MiniSquare1, .MiniSquare2, .MiniSquare3, .MiniSquare4 {
     109      border:0px;
    109110      height:8px;
    110111      width:8px;
     
    119120       .MiniSquare1 { color:#".$this->my_config['AStat_BarColor_Pages'].";   }
    120121       .MiniSquare2 { color:#".$this->my_config['AStat_BarColor_Img'].";  }
    121        .MiniSquare3 { color:#".$this->my_config['AStat_BarColor_IP']."; } 
    122        .MiniSquare4 { color:#".$this->my_config['AStat_BarColor_Cat']."; } 
     122       .MiniSquare3 { color:#".$this->my_config['AStat_BarColor_IP']."; }
     123       .MiniSquare4 { color:#".$this->my_config['AStat_BarColor_Cat']."; }
    123124       .StatTableRow:hover { background-color:#".$this->my_config['AStat_MouseOverColor']."; }
    124        .formtable, .formtable P { text-align:left; display:block; }
     125       .formtable, .formtable P { text-align:left; display:block; }
     126       .formtable tr { vertical-align:top; }
    125127       .window_thumb {
    126128      position:absolute;
     
    133135      z-index:100;
    134136      overflow:hidden;
    135       visibility:hidden; } 
     137      visibility:hidden; }
    136138        .img_thumb {
    137139      border: solid 3px #ffffff;
    138140      background: #000000;
    139141      margin:0px;
    140       padding:0px; } 
     142      padding:0px; }
    141143        .time_request {
    142144      font-size:83%;
     
    146148      table.littlefont th { padding:3px; }
    147149      table.littlefont td { padding:0px;padding-left:3px;padding-right:3px; }
     150      #iplist { visibility:hidden; position:absolute; width:200px; z-index:1000; }
     151      .iipsellistitem { float:right; }
     152      #iipsellist { width:100%; font-family:monospace; }
    148153    ";
    149154
  • extensions/AStat/astat_aip.class.inc.php

    r3543 r3706  
    1717include_once('astat_aim.class.inc.php');
    1818include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
     19include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/ajax.class.inc.php');
    1920
    2021class AStat_AIP extends AStat_AIM
    21 { 
    22   protected $tabsheet; 
     22{
     23  protected $tabsheet;
    2324  protected $list_periods = array('global', 'all', 'year', 'month', 'day');
    2425  protected $list_sortcat = array('page', 'picture', 'nbpicture');
    2526  protected $list_sortimg = array('picture', 'catname');
    2627  protected $list_sortip = array('page', 'picture', 'ip');
     28  protected $ajax;
    2729
    2830  protected $catfilter;    //filter on categories
     
    5658                          l10n('AStat_tools'),
    5759                          $this->page_link.'&amp;fAStat_tabsheet=tools');
     60
     61    $this->ajax = new Ajax();
    5862  }
    5963
     
    7882  {
    7983    global $template;
     84
     85    $this->return_ajax_content();
    8086
    8187    $template->set_filename('plugin_admin_content', dirname(__FILE__)."/admin/astat_admin.tpl");
     
    102108    elseif($_REQUEST['fAStat_tabsheet']=='stats_by_ip')
    103109    {
     110      if(isset($_REQUEST['fAStat_IP_BL']))
     111      {
     112        $this->add_ip_to_filter($_REQUEST['fAStat_IP_BL']);
     113      }
     114
    104115      $this->display_stats_by_ip(
    105116          $_REQUEST['fAStat_year'],
     
    167178  --------------------------------------------------------------------------- */
    168179
     180  /*
     181    return ajax content
     182  */
     183  protected function return_ajax_content()
     184  {
     185    global $ajax, $template;
     186
     187    if(isset($_REQUEST['ajaxfct']))
     188    {
     189      //$this->debug("AJAXFCT:".$_REQUEST['ajaxfct']);
     190      $result="<p class='errors'>An error has occured</p>";
     191      switch($_REQUEST['ajaxfct'])
     192      {
     193        case 'astat_listip':
     194          if(!isset($_REQUEST['ipfilter'])) $_REQUEST['ipfilter']="";
     195          if(!isset($_REQUEST['exclude'])) $_REQUEST['exclude']="";
     196          $result=$this->ajax_listip($_REQUEST['ipfilter'], $_REQUEST['exclude']);
     197          break;
     198      }
     199      //$template->
     200      $this->ajax->return_result($result);
     201    }
     202  }
     203
     204
     205
     206
     207
     208
     209
    169210  private function init_request()
    170211  {
     
    292333
    293334    if($day!="")
    294     { 
     335    {
    295336      $sql_groupdef="HOUR(time) as GId,";
    296337      $sql_select="select HOUR(time) as GId, ";
     
    299340      $sql_order=" order by GId asc";
    300341
    301       for($i=0;$i<24;$i++) 
     342      for($i=0;$i<24;$i++)
    302343      {
    303344        $returned[$i] = array(
     
    313354      }
    314355    }
    315     elseif($month!="") 
    316     { 
     356    elseif($month!="")
     357    {
    317358      $sql_groupdef="DAY(date) as GId,";
    318359      $sql_select="select DAY(date) as GId, ";
     
    323364      $delta = 1;
    324365      $NbDays = strftime('%d', mktime(0,0,0,$month+1,0,$year));
    325       for($i=0;$i<$NbDays;$i++) 
     366      for($i=0;$i<$NbDays;$i++)
    326367      {
    327368        $returned[$i] = array(
     
    337378      }
    338379    }
    339     elseif($year!="") 
    340     { 
     380    elseif($year!="")
     381    {
    341382      $sql_groupdef="MONTH(date) as GId,";
    342383      $sql_select="select MONTH(date) as GId, ";
     
    346387
    347388      $delta = 1;
    348       for($i=0;$i<12;$i++) 
     389      for($i=0;$i<12;$i++)
    349390      {
    350391        $returned[$i] = array(
     
    360401      }
    361402    }
    362     elseif($total!="Y") 
     403    elseif($total!="Y")
    363404    {
    364405      $sql_groupdef="YEAR(date) as GId,";
     
    379420    }
    380421
     422    if($this->my_config['AStat_BlackListedIP']!="")
     423    {
     424      ($sql_where=="")?$sql_where=" where ":$sql_where.=" AND ";
     425      $sql_where .= " NOT ".$this->make_IP_where_clause($this->my_config['AStat_BlackListedIP']);
     426    }
     427
    381428    $sql_max=", (select max(n.MaxPages) as MaxPages, max(n.MaxIP) as MaxIP, max(n.MaxImg) as MaxImg
    382429        from (select ".$sql_groupdef." count(id) as MaxPages, count(distinct IP) as MaxIP, count(image_id) as MaxImg
    383             from ".HISTORY_TABLE.$sql_where.$sql_group.") as n) as n "; 
     430            from ".HISTORY_TABLE.$sql_where.$sql_group.") as n) as n ";
    384431    $sql=$sql_select.$sql.$sql_nfomax.$sql_from.$sql_max.$sql_where.$sql_group.$sql_order;
    385432
     
    394441      { $returned[$row["GId"]-$delta] = $row; }
    395442    }
    396    
     443
    397444    return($returned);
    398445  } //stat by period
     
    423470    $sql_where = "";
    424471    $sql_group=" group by IP_USER ";
    425     $sql_order=" order by ".$sortlist[$sortip]." "; 
     472    $sql_order=" order by ".$sortlist[$sortip]." ";
    426473    $sql_limit=" limit ".(($pagenumber-1)* $nbipperpage).", ".$nbipperpage;
    427474
    428475
    429     if($day!="") 
    430     { 
     476    if($day!="")
     477    {
    431478      $sql_where=" where YEAR(date) = $year and MONTH(date) = $month and DAY(date) = $day ";
    432479    }
    433     elseif($month!="") 
    434     { 
     480    elseif($month!="")
     481    {
    435482      $sql_where=" where YEAR(date) = $year and MONTH(date) = $month ";
    436483    }
    437     elseif($year!="") 
    438     { 
     484    elseif($year!="")
     485    {
    439486      $sql_where=" where YEAR(date) = $year ";
    440487    }
     
    451498    }
    452499
     500    if($this->my_config['AStat_BlackListedIP']!="")
     501    {
     502      ($sql_where=="")?$sql_where=" where ":$sql_where.=" AND ";
     503      $sql_where .= " NOT ".$this->make_IP_where_clause($this->my_config['AStat_BlackListedIP']);
     504    }
     505
    453506    $sql_max=", (select max(n.MaxPages) as MaxPages, max(n.MaxImg) as MaxImg
    454         from (select if(".HISTORY_TABLE.".user_id = 2, IP, if(".USERS_TABLE.".username is null, '[".l10n("AStat_deleted_user")."]', ".USERS_TABLE.".username)) as IP_USER, count(".HISTORY_TABLE.".id) as MaxPages, count(image_id) as MaxImg 
    455             from ".HISTORY_TABLE." LEFT JOIN ".USERS_TABLE." ON ".HISTORY_TABLE.".user_id = ".USERS_TABLE.".id ".$sql_where.$sql_group.") as n) as n "; 
     507        from (select if(".HISTORY_TABLE.".user_id = 2, IP, if(".USERS_TABLE.".username is null, '[".l10n("AStat_deleted_user")."]', ".USERS_TABLE.".username)) as IP_USER, count(".HISTORY_TABLE.".id) as MaxPages, count(image_id) as MaxImg
     508            from ".HISTORY_TABLE." LEFT JOIN ".USERS_TABLE." ON ".HISTORY_TABLE.".user_id = ".USERS_TABLE.".id ".$sql_where.$sql_group.") as n) as n ";
    456509    $sql=$sql_select.$sql.$sql_nfomax.$sql_from.$sql_max.$sql_where.$sql_group.$sql_order.$sql_limit;
    457510
     
    475528      $returned[1] = -1;
    476529    }
    477    
     530
    478531    return($returned);
    479532  } //stat by ip
     
    483536      %Pages
    484537      %Images
    485       by : 
     538      by :
    486539        Categories
    487540        Categories/years
     
    505558
    506559    if($show_thumb=='true')
    507     { 
     560    {
    508561      $sql_thumb = ', '.IMAGES_TABLE.'.path as ThumbPath, '.IMAGES_TABLE.'.file as ThumbFile, '.IMAGES_TABLE.'.tn_ext as Extension';
    509562      $sql_fromthumb = "LEFT JOIN ".IMAGES_TABLE." ON ic2.representative_picture_id = ".IMAGES_TABLE.".id  ";
     
    514567      $sql_fromthumb = "";
    515568    }
    516    
     569
    517570    $sql_from = " from (".HISTORY_TABLE." LEFT JOIN ".CATEGORIES_TABLE." ON ".CATEGORIES_TABLE.".id = ".HISTORY_TABLE.".category_id),
    518 (select category_id as catid, count(image_id) as nb_images, representative_picture_id 
     571(select category_id as catid, count(image_id) as nb_images, representative_picture_id
    519572 from ".IMAGE_CATEGORY_TABLE.", ".CATEGORIES_TABLE."
    520573 where ".CATEGORIES_TABLE.".id = ".IMAGE_CATEGORY_TABLE.".category_id group by category_id) as ic2 ";
     
    522575    $sql_group=" group by category_id, section ";
    523576    $sql_group2="";
    524     $sql_order=" order by ".$sortlist[$sortcat]; 
     577    $sql_order=" order by ".$sortlist[$sortcat];
    525578    $sql_limit=" limit ".(($pagenumber-1)* $nbipperpage).", ".$nbipperpage;
    526579
    527     if($day!="") 
    528     { 
     580    if($day!="")
     581    {
    529582      $sql_where=" where YEAR(date) = $year and MONTH(date) = $month and DAY(date)= $day ";
    530583    }
    531     elseif($month!="") 
    532     { 
     584    elseif($month!="")
     585    {
    533586      $sql_where=" where YEAR(date) = $year and MONTH(date) = $month ";
    534587    }
    535     elseif($year!="") 
    536     { 
     588    elseif($year!="")
     589    {
    537590      $sql_where=" where YEAR(date) = $year ";
    538591    }
     
    552605    $sql_where .= "  ic2.catid = ".HISTORY_TABLE.".category_id ";
    553606
     607    if($this->my_config['AStat_BlackListedIP']!="")
     608    {
     609      $sql_where .= " AND NOT ".$this->make_IP_where_clause($this->my_config['AStat_BlackListedIP']);
     610    }
    554611
    555612    $sql=$sql_select.$sql.$sql_thumb.$sql_from.$sql_fromthumb.$sql_max.$sql_where.$sql_group.$sql_order.$sql_limit;
     
    574631      $returned[1] = -1;
    575632    }
    576    
     633
    577634    return($returned);
    578635  } // stats per categories
     
    582639      Num of view per image
    583640      %view on period
    584       by : 
     641      by :
    585642        Images
    586643        Images/years
     
    605662        ".IMAGES_TABLE.".path as ThumbPath, ".IMAGES_TABLE.".file as ThumbFile,
    606663        MaxImg2.somme as NbVuesMax, ".IMAGES_TABLE.".tn_ext as Extension ";
    607    
     664
    608665    $sql_from = " from ((".HISTORY_TABLE." LEFT JOIN ".IMAGES_TABLE." ON
    609666  ".IMAGES_TABLE.".id = ".HISTORY_TABLE.".image_id) LEFT JOIN ".CATEGORIES_TABLE."
     
    613670    $sql_where = " where ".HISTORY_TABLE.".image_id is not null ";
    614671    $sql_group=" group by image_id, category_id ";
    615     $sql_order=" order by ".$sortlist[$sortimg]; 
     672    $sql_order=" order by ".$sortlist[$sortimg];
    616673    $sql_limit=" limit ".(($pagenumber-1)* $nbipperpage).", ".$nbipperpage;
    617674
    618     if($day!="") 
    619     { 
     675    if($day!="")
     676    {
    620677      $sql_where.=" and YEAR(date) = $year and MONTH(date) = $month and DAY(date)= $day ";
    621678    }
    622     elseif($month!="") 
    623     { 
     679    elseif($month!="")
     680    {
    624681      $sql_where.=" and YEAR(date) = $year and MONTH(date) = $month ";
    625682    }
    626     elseif($year!="") 
    627     { 
     683    elseif($year!="")
     684    {
    628685      $sql_where.=" and YEAR(date) = $year ";
    629686    }
     
    631688
    632689    if($ip!="")
    633     { 
     690    {
    634691      $sql_where.=" and ( ((IP = '$ip') and ( user_id = 2 ))  or (".USERS_TABLE.".username = '$ip') )";
    635       $sql_from_ip=" LEFT JOIN ".USERS_TABLE." ON ".USERS_TABLE.".id = ".HISTORY_TABLE.".user_id ";   
    636     }
    637    
     692      $sql_from_ip=" LEFT JOIN ".USERS_TABLE." ON ".USERS_TABLE.".id = ".HISTORY_TABLE.".user_id ";
     693    }
     694
    638695    if($this->catfilter!="")
    639696    {
     
    643700    }
    644701
     702    if($this->my_config['AStat_BlackListedIP']!="")
     703    {
     704      ($sql_where=="")?$sql_where=" where ":$sql_where.=" AND ";
     705      $sql_where .= " NOT ".$this->make_IP_where_clause($this->my_config['AStat_BlackListedIP']);
     706    }
     707
     708
    645709    $sql_max=", (select count(image_id) as somme from ".HISTORY_TABLE.$sql_from_ip.$sql_where.") as MaxImg, (select count(image_id) as somme from ".HISTORY_TABLE.$sql_from_ip.$sql_where." and ".HISTORY_TABLE.".image_id is not null group by image_id order by somme desc limit 0,1) as MaxImg2 ";
    646710
     
    666730      $returned[1] = -1;
    667731    }
    668    
     732
    669733    return($returned);
    670734  } //stat by images
     
    719783
    720784    /* period label + navigation links */
    721     if($day!="") 
    722     { 
     785    if($day!="")
     786    {
    723787      $template_datas["PERIOD_LABEL"] = l10n("AStat_period_label_hours");
    724788      $template_datas["L_STAT_TITLE"] = $this->format_link(l10n("AStat_period_label_global"), $a_links["global"])." / ".$this->format_link(l10n("AStat_period_label_all"), $a_links["all"])." / ".$this->format_link($year, $a_links["year"])." / ".$this->format_link(l10n("AStat_month_of_year_".$month), $a_links["month"])." / ".l10n("AStat_day_of_week_".date("w",mktime(0, 0, 0, $month, $day, $year)))." $day";
    725789    }
    726     elseif($month!="") 
    727     { 
     790    elseif($month!="")
     791    {
    728792      $template_datas["PERIOD_LABEL"] = l10n("AStat_period_label_days");
    729793      $template_datas["L_STAT_TITLE"] = $this->format_link(l10n("AStat_period_label_global"), $a_links["global"])." / ".$this->format_link(l10n("AStat_period_label_all"), $a_links["all"])." / ".$this->format_link($year, $a_links["year"])." / ".l10n("AStat_month_of_year_".$month);
    730794    }
    731     elseif($year!="") 
    732     { 
     795    elseif($year!="")
     796    {
    733797      $template_datas["PERIOD_LABEL"] = l10n("AStat_period_label_months");
    734798      $template_datas["L_STAT_TITLE"] = $this->format_link(l10n("AStat_period_label_global"), $a_links["global"])." / ".$this->format_link(l10n("AStat_period_label_all"), $a_links["all"])." / ".$year;
    735799    }
    736     elseif($total!="Y") 
    737     { 
     800    elseif($total!="Y")
     801    {
    738802      $template_datas["PERIOD_LABEL"] = l10n("AStat_period_label_years");
    739803      $template_datas["L_STAT_TITLE"] = $this->format_link(l10n("AStat_period_label_global"), $a_links["global"])." / ".l10n("AStat_period_label_all");
    740804    }
    741     else 
    742     { 
     805    else
     806    {
    743807      $template_datas["PERIOD_LABEL"] = l10n("AStat_period_label_all");
    744808      $template_datas["L_STAT_TITLE"] = l10n("AStat_period_label_global");
    745     } 
     809    }
    746810    $template_datas["MAX_WIDTH"] = $max_width+10;
    747811    $template_datas["ASTAT_NFO_STAT"] = l10n("AStat_Nfo_Period");
     
    763827      }
    764828      else
    765       { 
    766         $width_pages = 0; 
     829      {
     830        $width_pages = 0;
    767831        $width_img = 0;
    768832        $width_ip = 0;
     
    770834      }
    771835
    772    
     836
    773837      if($day!="")
    774838      { // si jours sélectionné, heures affichées
     
    787851        $value_img=$img_links["day"].$stats[$i]["GId"];
    788852      }
    789       elseif($year!="") 
     853      elseif($year!="")
    790854      { // si année sélectionnée, mois affichés
    791855        $value = l10n("AStat_month_of_year_".$stats[$i]["GId"]);
     
    803867        $value_img=$img_links["year"].$stats[$i]["GId"];
    804868      }
    805       else 
    806       { 
    807         $value=l10n("AStat_period_label_all"); 
     869      else
     870      {
     871        $value=l10n("AStat_period_label_all");
    808872        $link=$this->page_link."&amp;fAStat_defper=N&amp;fAStat_all=N";
    809873        $value_ip=$ip_links["all"];
     
    897961
    898962    /* periode label + navigation links */
    899     if($day!="") 
    900     { 
     963    if($day!="")
     964    {
    901965      $dir_links = $this->format_link(l10n("AStat_period_label_global"), $a_links["global"])." / ".$this->format_link(l10n("AStat_period_label_all"), $a_links["all"])." / ".$this->format_link($year, $a_links["year"])." / ".$this->format_link(l10n("AStat_month_of_year_".$month), $a_links["month"])." / ".l10n("AStat_day_of_week_".date("w",mktime(0, 0, 0, $month, $day, $year)))." $day";
    902966      $page_link=$ip_links["day"];
    903967      $img_link=$img_links["day"];
    904968    }
    905     elseif($month!="") 
    906     { 
     969    elseif($month!="")
     970    {
    907971      $dir_links = $this->format_link(l10n("AStat_period_label_global"), $a_links["global"])." / ".$this->format_link(l10n("AStat_period_label_all"), $a_links["all"])." / ".$this->format_link($year, $a_links["year"])." / ".l10n("AStat_month_of_year_".$month);
    908972      $page_link=$ip_links["month"];
    909973      $img_link=$img_links["month"];
    910974    }
    911     elseif($year!="") 
    912     { 
     975    elseif($year!="")
     976    {
    913977      $dir_links = $this->format_link(l10n("AStat_period_label_global"), $a_links["global"])." / ".$this->format_link(l10n("AStat_period_label_all"), $a_links["all"])." / ".$year;
    914978      $page_link=$ip_links["year"];
    915979      $img_link=$img_links["year"];
    916980    }
    917     else 
    918     { 
     981    else
     982    {
    919983      $dir_links = $this->format_link(l10n("AStat_period_label_global"), $a_links["global"])." / ".l10n("AStat_period_label_all");
    920984      $page_link=$ip_links["all"];
    921985      $img_link=$img_links["all"];
    922986    }
    923    
     987
    924988
    925989    if($nbpages>1) { $plural="s"; } else { $plural=""; }
     
    927991    for($i=1;$i<=$nbpages;$i++)
    928992    {
    929       if($i==$pagenumber) 
    930       { $pages_links.=" $i "; } 
     993      if($i==$pagenumber)
     994      { $pages_links.=" $i "; }
    931995      else
    932996      {
     
    934998      }
    935999    }
    936    
     1000
    9371001    $template_datas["L_STAT_TITLE"] = $dir_links;
    9381002    $template_datas["MAX_WIDTH"]=$max_width+10;
     
    9551019    {
    9561020        if($stats[$i]["MaxPages"] > 0)
    957       { 
    958         $width_pages = ceil(($stats[$i]["NbPages"] * $max_width) / $stats[$i]["MaxPages"] ); 
     1021      {
     1022        $width_pages = ceil(($stats[$i]["NbPages"] * $max_width) / $stats[$i]["MaxPages"] );
    9591023        $width_img = ceil(($stats[$i]["NbImg"] * $max_width) / $stats[$i]["MaxPages"] );
    9601024      }
    9611025      else
    962       { 
    963         $width_pages = 0; 
     1026      {
     1027        $width_pages = 0;
    9641028        $width_img = 0;
    9651029      }
     
    9701034        $ip_geolocalisation='<a href="http://www.geoiptool.com/fr/?IP='.$stats[$i]["IP_USER"].'" title="Geo IP localisation" target="_blank">['.l10n('AStat_IP_geolocalisation').'] </a>';
    9711035        $ip_adress='<a href="http://www.ripe.net/whois?form_type=simple&amp;full_query_string=&amp;searchtext='.$stats[$i]["IP_USER"].'+&amp;do_search=Search" title="Ripe Whois" target="_blank">'.$stats[$i]["IP_USER"].'</a>';
    972       }
    973       else
     1036        $ip_blacklist=$page_link."&amp;fAStat_IP_BL=".$stats[$i]["IP_USER"];
     1037
     1038        if($pagenumber>1)
     1039        {
     1040          $ip_blacklist.="&amp;fAStat_page_number=$pagenumber";
     1041        }
     1042
     1043        if($sortip!="page")
     1044        {
     1045          $ip_blacklist.="&amp;fAStat_SortIP=$sortip";
     1046        }
     1047
     1048        $ip_blacklist=$this->format_link("[".l10n('AStat_IP_blacklist')."]", $ip_blacklist);
     1049      }
     1050      else
    9741051      {
    9751052        $ip_geolocalisation='';
    9761053        $ip_adress=$stats[$i]["IP_USER"];
    977       }
     1054        $ip_blacklist='';
     1055      }
     1056
    9781057
    9791058
    9801059      $template_datarows[]=array(
     1060        'ASTAT_IP_BLACKLIST' => $ip_blacklist,
    9811061        'ASTAT_IP_GEOLOCALISATION' => $ip_geolocalisation,
    9821062        'ASTAT_IP_ADRESS' => $ip_adress,
     
    10301110
    10311111    /* make navigation links */
    1032     if($day!="") 
    1033     { 
     1112    if($day!="")
     1113    {
    10341114      $dir_links = $this->format_link(l10n("AStat_period_label_global"), $a_links["global"])." / ".$this->format_link(l10n("AStat_period_label_all"), $a_links["all"])." / ".$this->format_link($year, $a_links["year"])." / ".$this->format_link(l10n("AStat_month_of_year_".$month), $a_links["month"])." / ".l10n("AStat_day_of_week_".date("w",mktime(0, 0, 0, $month, $day, $year)))." $day";
    10351115      $page_link=$cat_links["day"];
    10361116    }
    1037     elseif($month!="") 
    1038     { 
     1117    elseif($month!="")
     1118    {
    10391119      $dir_links = $this->format_link(l10n("AStat_period_label_global"), $a_links["global"])." / ".$this->format_link(l10n("AStat_period_label_all"), $a_links["all"])." / ".$this->format_link($year, $a_links["year"])." / ".l10n("AStat_month_of_year_".$month);
    10401120      $page_link=$cat_links["month"];
    10411121    }
    1042     elseif($year!="") 
    1043     { 
     1122    elseif($year!="")
     1123    {
    10441124      $dir_links = $this->format_link(l10n("AStat_period_label_global"), $a_links["global"])." / ".$this->format_link(l10n("AStat_period_label_all"), $a_links["all"])." / ".$year;
    10451125      $page_link=$cat_links["year"];
    10461126    }
    1047     else 
    1048     { 
     1127    else
     1128    {
    10491129      $dir_links = $this->format_link(l10n("AStat_period_label_global"), $a_links["global"])." / ".l10n("AStat_period_label_all");
    10501130      $page_link=$cat_links["all"];
    10511131    }
    1052    
     1132
    10531133
    10541134    if($nbpages>1)
     
    10641144    for($i=1;$i<=$nbpages;$i++)
    10651145    {
    1066       if($i==$pagenumber) 
     1146      if($i==$pagenumber)
    10671147      {
    10681148        $pages_links.=" $i ";
     
    10961176      $width_pages = ceil(($stats[$i]["PctPages"] * $max_width)/100);
    10971177      $width_img = ceil(($stats[$i]["PctImg"] * $max_width)/100 );
    1098      
     1178
    10991179      if($showthumb=='true')
    1100       { 
     1180      {
    11011181        $filethumb=$this->change_file_ext($stats[$i]["ThumbFile"], $stats[$i]["Extension"]);
    11021182        $filethumb=str_replace($stats[$i]["ThumbFile"],"thumbnail/".$conf['prefix_thumbnail'].$filethumb,$stats[$i]["ThumbPath"]); }
     
    11091189      { $category = $this->format_link($stats[$i]["IdCat"], PHPWG_ROOT_PATH."index.php?/category/".$stats[$i]["category_id"]); }
    11101190      else
    1111       { 
     1191      {
    11121192        $category = "<i>".l10n('AStat_section_label').' : ';
    11131193        if(l10n('AStat_section_'.$stats[$i]["IdCat"])!='AStat_section_'.$stats[$i]["IdCat"])
     
    11421222
    11431223  /* ------------------------------------------------------------------------------------------
    1144       display stats for images 
     1224      display stats for images
    11451225      ------------------------------------------------------------------------------------------ */
    11461226  function display_stats_by_image($year, $month, $day, $max_width, $nbipperpage, $pagenumber,$showthumb, $sortimg, $ip, $seetimerequest)
     
    11761256
    11771257    /* navigation links */
    1178     if($day!="") 
    1179     { 
     1258    if($day!="")
     1259    {
    11801260      $dir_links = $this->format_link(l10n("AStat_period_label_global"), $a_links["global"])." / ".$this->format_link(l10n("AStat_period_label_all"), $a_links["all"])." / ".$this->format_link($year, $a_links["year"])." / ".$this->format_link(l10n("AStat_month_of_year_".$month), $a_links["month"])." / ".l10n("AStat_day_of_week_".date("w",mktime(0, 0, 0, $month, $day, $year)))." $day";
    11811261      $page_link=$img_links["day"];
    11821262    }
    1183     elseif($month!="") 
    1184     { 
     1263    elseif($month!="")
     1264    {
    11851265      $dir_links = $this->format_link(l10n("AStat_period_label_global"), $a_links["global"])." / ".$this->format_link(l10n("AStat_period_label_all"), $a_links["all"])." / ".$this->format_link($year, $a_links["year"])." / ".l10n("AStat_month_of_year_".$month);
    11861266      $page_link=$img_links["month"];
    11871267    }
    1188     elseif($year!="") 
    1189     { 
     1268    elseif($year!="")
     1269    {
    11901270      $dir_links = $this->format_link(l10n("AStat_period_label_global"), $a_links["global"])." / ".$this->format_link(l10n("AStat_period_label_all"), $a_links["all"])." / ".$year;
    11911271      $page_link=$img_links["year"];
    11921272    }
    1193     else 
    1194     { 
     1273    else
     1274    {
    11951275      $dir_links = $this->format_link(l10n("AStat_period_label_global"), $a_links["global"])." / ".l10n("AStat_period_label_all");
    11961276      $page_link=$img_links["all"];
     
    12011281      $dir_links.= " [IP : $ip]";
    12021282    }
    1203    
     1283
    12041284
    12051285    if($nbpages>1) { $plural="s"; } else { $plural=""; }
     
    12071287    for($i=1;$i<=$nbpages;$i++)
    12081288    {
    1209       if($i==$pagenumber) 
    1210       { $pages_links.=" $i "; } 
     1289      if($i==$pagenumber)
     1290      { $pages_links.=" $i "; }
    12111291      else
    12121292      {
     
    12361316    for($i=0;$i<count($stats);$i++)
    12371317    {
    1238       $width_pages = ceil(($stats[$i]["NbVues"] * $max_width)/$stats[$i]["NbVuesMax"] ); 
     1318      $width_pages = ceil(($stats[$i]["NbVues"] * $max_width)/$stats[$i]["NbVuesMax"] );
    12391319      $width_img = ceil(($stats[$i]["PctImg"] * $max_width)/100 );
    1240      
     1320
    12411321      if($showthumb=='true')
    12421322      {
    12431323        $filethumb=$this->change_file_ext($stats[$i]["ThumbFile"], $stats[$i]["Extension"]);
    1244         $filethumb=str_replace($stats[$i]["ThumbFile"],"thumbnail/".$conf['prefix_thumbnail'].$filethumb,$stats[$i]["ThumbPath"]); 
     1324        $filethumb=str_replace($stats[$i]["ThumbFile"],"thumbnail/".$conf['prefix_thumbnail'].$filethumb,$stats[$i]["ThumbPath"]);
    12451325      }
    12461326      else
     
    12581338        }
    12591339        else
    1260         { 
     1340        {
    12611341          if($stats[$i]["ThumbFile"]!="")
    12621342          {
     
    12701350      }
    12711351      else
    1272       { 
     1352      {
    12731353        $image_links = "<i>".l10n('AStat_section_label').' : ';
    12741354        if(l10n('AStat_section_'.$stats[$i]["CatName"])!='AStat_section_'.$stats[$i]["CatName"])
     
    12811361        }
    12821362
    1283         $image_links.="</i> / "; 
     1363        $image_links.="</i> / ";
    12841364
    12851365        if($stats[$i]["ImgName"]!="")
     
    12881368        }
    12891369        else
    1290         { 
     1370        {
    12911371          if($stats[$i]["ThumbFile"]!="")
    12921372          {
     
    13201400
    13211401
     1402  private function add_ip_to_filter($ip)
     1403  {
     1404    if(strpos($this->my_config['AStat_BlackListedIP'].",", $ip.",")===false)
     1405    {
     1406      ($this->my_config['AStat_BlackListedIP']!='')?$this->my_config['AStat_BlackListedIP'].=",":"";
     1407      $this->my_config['AStat_BlackListedIP'].=$ip;
     1408      $this->save_config();
     1409    }
     1410  }
     1411
    13221412
    13231413  /*
     
    13301420    $save_status=false;
    13311421
    1332     if(isset($_POST['submit'])) 
     1422    if(isset($_POST['submit']))
    13331423    {
    13341424      if(!is_adviser())
    13351425      {
    1336         reset($this->my_config); 
    1337         while (list($key, $val) = each($this->my_config)) 
     1426        reset($this->my_config);
     1427        while (list($key, $val) = each($this->my_config))
    13381428        {
    13391429          if(isset($_POST['f_'.$key]))
     
    13641454
    13651455    //standards inputs zones
    1366     reset($this->my_config); 
    1367     while (list($key, $val) = each($this->my_config)) 
     1456    reset($this->my_config);
     1457    while (list($key, $val) = each($this->my_config))
    13681458    {
    13691459      $template_datas["f_".$key]=$val;
    13701460    }
     1461
     1462    //
     1463    $template_datas['ajaxurl']=$this->page_link;
    13711464
    13721465    // define selected item for lists zones
     
    13951488    }
    13961489    // default ip order
    1397     reset($this->list_sortip); 
    1398     while (list($key, $val) = each($this->list_sortip)) 
     1490    reset($this->list_sortip);
     1491    while (list($key, $val) = each($this->list_sortip))
    13991492    {
    14001493      $template_list_values['sortip'][]=$val;
     
    14341527
    14351528
    1436   /* 
     1529  /*
    14371530    display tools page
    14381531  */
     
    14481541
    14491542    // >> PURGE HISTORY --------------------------------------------------------
    1450     if(isset($_POST['apply_tool_purge_history'])) 
     1543    if(isset($_POST['apply_tool_purge_history']))
    14511544    {
    14521545      if(!is_adviser())
    14531546      {
    1454         $action_result['action']='AStat_tools_purge_history';     
    1455         $action_result['result']='false';     
     1547        $action_result['action']='AStat_tools_purge_history';
     1548        $action_result['result']='false';
    14561549        $action_result['msg']='AStat_tools_result_ko';
    1457        
     1550
    14581551        $ok_to_purge=true;
    14591552        if($_REQUEST['fAStat_purge_history_type']=='bydate')
     
    14661559
    14671560          $purge_date=mktime(0,0,0,$date[1],$date[0],$date[2]);
    1468           $fdate=date("Y-m-d", mktime(0,0,0,$date[1],$date[0],$date[2]));
     1561          $fparam=date("Y-m-d", mktime(0,0,0,$date[1],$date[0],$date[2]));
    14691562
    14701563          if(date("d/m/Y", $purge_date)!=$_REQUEST['fAStat_purge_history_date'])
    1471           {     
    1472             $action_result['nfo']='AStat_tools_invalid_date';     
     1564          {
     1565            $action_result['nfo']='AStat_tools_invalid_date';
    14731566            $ok_to_purge=false;
    14741567          }
    14751568          elseif(date("Ymd", $purge_date)>=date("Ymd"))
    14761569          {
    1477             $action_result['nfo']='AStat_tools_invalid_date2';     
     1570            $action_result['nfo']='AStat_tools_invalid_date2';
    14781571            $ok_to_purge=false;
    14791572          }
    14801573        }
     1574        elseif($_REQUEST['fAStat_purge_history_type']=='byipid0')
     1575        {
     1576          $fparam=$this->my_config['AStat_BlackListedIP'];
     1577        }
    14811578        else
    14821579        {
    1483           $fdate="";
     1580          $fparam="";
    14841581        }
    14851582
    14861583        if($ok_to_purge)
    14871584        {
    1488           $result=$this->do_purge_history( $fdate, $_REQUEST['fAStat_purge_history_type']);
     1585          $result=$this->do_purge_history( $fparam, $_REQUEST['fAStat_purge_history_type']);
    14891586          if($result)
    14901587          {
     
    15421639      }
    15431640    }
    1544     // 
     1641    //
    15451642    elseif(isset($_POST['apply_tool_deleted_picture']))
    15461643    {
     
    15661663
    15671664    // >> DELETED_CATEGORY -----------------------------------------------------
    1568     elseif(isset($_POST['apply_tool_deleted_category'])) 
     1665    elseif(isset($_POST['apply_tool_deleted_category']))
    15691666    {
    15701667      if(!is_adviser())
     
    15871684    }
    15881685    // << DELETED_CATEGORY -----------------------------------------------------
    1589      
     1686
    15901687    // >> DELETED USER ---------------------------------------------------------
    1591     elseif(isset($_POST['apply_tool_deleted_user'])) 
     1688    elseif(isset($_POST['apply_tool_deleted_user']))
    15921689    {
    15931690      if(!is_adviser())
     
    16151712    $table_exists=$this->verify_AStat_picture_table_status();
    16161713    if($table_exists==true)
    1617     { 
     1714    {
    16181715      $template_datas["ASTAT_DELETED_PICTURE_DO_ACTION"] = "checked";
    16191716      $template_datas["ASTAT_DELETED_PICTURE_PREPARE"] = "disabled";
    16201717    }
    16211718    else
    1622     { 
     1719    {
    16231720      $template_datas["ASTAT_DELETED_PICTURE_PREPARE"]="checked";
    16241721      $template_datas["ASTAT_DELETED_PICTURE_DO_ACTION"]="disabled";
     
    16321729    {
    16331730      $list='';
    1634       for($i=0;$i<count($nfo[2]);$i++) 
    1635       { 
     1731      for($i=0;$i<count($nfo[2]);$i++)
     1732      {
    16361733        if($nfo[2][$i][0]>1) { $s='s'; } else { $s=''; }
    1637         $list.="<li>image_id #".$nfo[2][$i][1]." : ".$nfo[2][$i][0]." ".l10n("AStat_event$s")."</li>"; 
     1734        $list.="<li>image_id #".$nfo[2][$i][1]." : ".$nfo[2][$i][0]." ".l10n("AStat_event$s")."</li>";
    16381735      }
    16391736      $template_datas["ASTAT_DELETED_PICTURE_NFO"] = sprintf(l10n('AStat_tools_deleted_picture_nfo1'), $nfo[0], $nfo[1], $list);
     
    16441741    {
    16451742      $template_datas["ASTAT_DELETED_PICTURE_NFO"] = l10n('AStat_tools_deleted_picture_nfo2');
    1646     } 
     1743    }
    16471744    // << DISPLAY DELETED_PICTURE NFO ------------------------------------------
    16481745
     
    16721769    {
    16731770      $list='';
    1674       for($i=0;$i<count($nfo[2]);$i++) 
    1675       { 
     1771      for($i=0;$i<count($nfo[2]);$i++)
     1772      {
    16761773        if($nfo[2][$i][0]>1) { $s='s'; } else { $s=''; }
    1677         $list.="<li>user_id #".$nfo[2][$i][1]." : ".$nfo[2][$i][0]." ".l10n("AStat_event$s")."</li>"; 
     1774        $list.="<li>user_id #".$nfo[2][$i][1]." : ".$nfo[2][$i][0]." ".l10n("AStat_event$s")."</li>";
    16781775      }
    16791776      $template_datas["ASTAT_DELETED_USER_NFO"] = sprintf(l10n('AStat_tools_deleted_user_nfo1'), $nfo[0], $nfo[1], $list);
     
    16831780    {
    16841781      $template_datas["ASTAT_DELETED_USER_NFO"] = l10n('AStat_tools_deleted_user_nfo2');
    1685     } 
     1782    }
    16861783    // << DISPLAY DELETED USER NFO ---------------------------------------------
    16871784
     
    16921789    {
    16931790      $template_datas["ASTAT_GENERAL_NFO"] = sprintf(l10n('AStat_tools_general_nfo_nfo'),
    1694               $nfo[0], 
     1791              $nfo[0],
    16951792              $this->formatoctet($nfo[3]+$nfo[4], "A", " ", 2, true),
    16961793              $this->formatoctet($nfo[3], "A", " ", 2, true),
    16971794              $this->formatoctet($nfo[4], "A", " ", 2, true),
    1698               date(l10n('AStat_date_time_format'), strtotime($nfo[2])), 
     1795              date(l10n('AStat_date_time_format'), strtotime($nfo[2])),
    16991796              date(l10n('AStat_date_time_format'), strtotime($nfo[1])) );
     1797      $template_datas["ASTAT_MINDATE"]=date("m/d/Y",strtotime($nfo[2]));
    17001798    }
    17011799
    17021800    $nfo=$this->purge_history_count_imageid0();
    17031801    $template_datas["ASTAT_PURGE_HISTORY_IMAGE_NFO"] = sprintf(l10n('AStat_tools_purge_history_imageid0'), $nfo);
    1704     if($nfo==0) 
    1705     { 
     1802    if($nfo==0)
     1803    {
    17061804      $template_datas["ASTAT_PURGE_HISTORY_IMAGE_DISABLED"] = " disabled ";
    17071805    }
    17081806    $nfo=$this->purge_history_count_categoryid0();
    17091807    $template_datas["ASTAT_PURGE_HISTORY_CATEGORY_NFO"] = sprintf(l10n('AStat_tools_purge_history_categoryid0'), $nfo);
    1710     if($nfo==0) 
    1711     { 
     1808    if($nfo==0)
     1809    {
    17121810      $template_datas["ASTAT_PURGE_HISTORY_CATEGORY_DISABLED"] = " disabled ";
     1811    }
     1812    $nfo=$this->purge_history_count_ipid0();
     1813    $template_datas["ASTAT_PURGE_HISTORY_IP_NFO"] = sprintf(l10n('AStat_tools_purge_history_ipid0'), $nfo[1], $nfo[0]);
     1814    if($nfo[0]==0)
     1815    {
     1816      $template_datas["ASTAT_PURGE_HISTORY_IP_DISABLED"] = " disabled ";
    17131817    }
    17141818    // << GENERAL NFO ----------------------------------------------------------
     
    17521856    allow to force HISTORY_TABLE.user_id at  2 (guest) for records with user ident
    17531857    doesn't exist anymore in the USERS_TABLE
    1754    
     1858
    17551859    Two usages :
    1756       - analyse : return infos about records wich need to be updated 
     1860      - analyse : return infos about records wich need to be updated
    17571861          * number of users
    17581862          * number of records in HISTORY_TABLE
     
    17631867  {
    17641868    $returned = array(-1,0,'');
    1765    
     1869
    17661870    if($mode=='analyse')
    17671871    {
     
    17811885          $returned[1]+=$row[0];
    17821886        }
    1783        
     1887
    17841888      }
    17851889    }
     
    17971901
    17981902  /*
    1799     tools : deleted_picture 
     1903    tools : deleted_picture
    18001904    analyse history to find deleted pictures
    18011905    Two functions :
     
    18091913  {
    18101914    $returned = array(-1,0,'');
    1811    
     1915
    18121916    if($mode=='analyse')
    18131917    {
     
    18281932          $returned[1]+=$row[0];
    18291933        }
    1830        
     1934
    18311935      }
    18321936    }
     
    18341938    {
    18351939      $sql="UPDATE ".HISTORY_TABLE."
    1836         SET image_id = 0 
    1837         WHERE ".HISTORY_TABLE.".image_id > 0 
     1940        SET image_id = 0
     1941        WHERE ".HISTORY_TABLE.".image_id > 0
    18381942          AND ".HISTORY_TABLE.".image_id NOT IN (SELECT id FROM ".IMAGES_TABLE.")";
    18391943      $result=pwg_query($sql);
     
    18611965  {
    18621966    $returned = array(-1,0,'');
    1863    
     1967
    18641968    if($mode=='analyse')
    18651969    {
     
    18801984          $returned[1]+=$row[0];
    18811985        }
    1882        
     1986
    18831987      }
    18841988    }
     
    18861990    {
    18871991      $sql="UPDATE ".HISTORY_TABLE."
    1888         SET category_id = NULL, section = 'deleted_cat' 
    1889         WHERE ".HISTORY_TABLE.".category_id > 0 
     1992        SET category_id = NULL, section = 'deleted_cat'
     1993        WHERE ".HISTORY_TABLE.".category_id > 0
    18901994          AND ".HISTORY_TABLE.".category_id NOT IN (SELECT id FROM ".CATEGORIES_TABLE.")";
    18911995      $result=pwg_query($sql);
     
    19012005
    19022006  /*
    1903     tools : general_nfo 
     2007    tools : general_nfo
    19042008    return infos about historic
    19052009      0 : nulber of records
     
    19122016  {
    19132017    $returned = array(-1,'','',0,0);
    1914  
     2018
    19152019    $sql="SELECT count(id) AS NbRecord, MAX(concat(date,' ', time)) AS LastDate, MIN(concat(date,' ', time)) AS FirstDate ";
    19162020    $sql.=" FROM ".HISTORY_TABLE;
     
    19192023    {
    19202024      $row = mysql_fetch_array($result);
    1921       if(is_array($row)) 
    1922       { 
    1923         $returned = $row; 
     2025      if(is_array($row))
     2026      {
     2027        $returned = $row;
    19242028        $sql="SHOW TABLE STATUS LIKE '".HISTORY_TABLE."';";
    19252029        $result=pwg_query($sql);
     
    19362040
    19372041  /*
    1938     tools : do_purge_history 
     2042    tools : do_purge_history
    19392043    do a purge of history table :
    19402044    - $purgetype='bydate' : purge all record wich date is less than given date
    19412045    - $purgetype='byimageid0' : with and image_id = 0
    19422046  ------------------------------------------------------------------------------------ */
    1943   private function do_purge_history($date, $purgetype)
     2047  private function do_purge_history($param, $purgetype)
    19442048  {
    19452049    if($purgetype=='bydate')
    19462050    {
    1947       $sql="DELETE FROM ".HISTORY_TABLE." WHERE date < '$date'";
     2051      $sql="DELETE FROM ".HISTORY_TABLE." WHERE date < '$param'";
    19482052    }
    19492053    elseif($purgetype=='byimageid0')
     
    19552059      $sql="DELETE FROM ".HISTORY_TABLE." WHERE category_id is null and section='deleted_cat'";
    19562060    }
    1957     else
    1958     {
     2061    elseif($purgetype=='byipid0')
     2062    {
     2063      $sql="DELETE FROM ".HISTORY_TABLE." WHERE ".$this->make_IP_where_clause($param);
     2064    }
     2065    else
     2066    {
    19592067      return(false);
    19602068    }
     
    19652073      $sql="OPTIMIZE TABLE ".HISTORY_TABLE;
    19662074      $result=pwg_query($sql);
    1967       return($result);   
     2075      return($result);
    19682076    }
    19692077    return(false);
     
    19942102  }
    19952103
    1996 
    1997   /*
    1998     tools : deleted_picture
    1999     > verify_AStat_picture_table_status :
    2000     > prepare_AStat_picture_table :
     2104  private function purge_history_count_ipid0()
     2105  {
     2106    if($this->my_config['AStat_BlackListedIP']!="")
     2107    {
     2108      $list=explode(',', $this->my_config['AStat_BlackListedIP']);
     2109    }
     2110    else
     2111    {
     2112      $list=array();
     2113    }
     2114
     2115    $returned=array(0,count($list));
     2116
     2117    if($this->my_config['AStat_BlackListedIP']!='')
     2118    {
     2119      $sql="SELECT COUNT(id)
     2120            FROM ".HISTORY_TABLE."
     2121            WHERE ".$this->make_IP_where_clause($this->my_config['AStat_BlackListedIP']);
     2122      $result=pwg_query($sql);
     2123      if($result)
     2124      {
     2125        $row=mysql_fetch_array($result);
     2126        $returned[0]=$row[0];
     2127      }
     2128    }
     2129    return($returned);
     2130  }
     2131
     2132
     2133  /*
     2134    tools : deleted_picture
     2135    > verify_AStat_picture_table_status :
     2136    > prepare_AStat_picture_table :
    20012137  */
    20022138  private function verify_AStat_picture_table_status()
     
    20202156    global $prefixeTable;
    20212157
    2022     $sql="CREATE TABLE ".$prefixeTable."AStat_picture (PRIMARY KEY (id), KEY ifile(file)) 
    2023       SELECT id, file 
     2158    $sql="CREATE TABLE ".$prefixeTable."AStat_picture (PRIMARY KEY (id), KEY ifile(file))
     2159      SELECT id, file
    20242160      FROM ".IMAGES_TABLE;
    20252161    $result=pwg_query($sql);
     
    20272163    {
    20282164      return(true);
    2029     } 
     2165    }
    20302166    return(false);
    20312167  }
     
    20352171    global $prefixeTable;
    20362172    $returned=array(false,0,0);
    2037    
     2173
    20382174    if($this->verify_AStat_picture_table_status())
    20392175    {
    20402176      $sql="SELECT count(DISTINCT ".$prefixeTable."AStat_picture.id), count(".HISTORY_TABLE.".id)
    2041         FROM ".HISTORY_TABLE.", ".$prefixeTable."AStat_picture 
    2042         WHERE ".HISTORY_TABLE.".image_id = ".$prefixeTable."AStat_picture.id 
     2177        FROM ".HISTORY_TABLE.", ".$prefixeTable."AStat_picture
     2178        WHERE ".HISTORY_TABLE.".image_id = ".$prefixeTable."AStat_picture.id
    20432179        AND ".HISTORY_TABLE.".image_id NOT IN (SELECT id FROM ".IMAGES_TABLE.")
    20442180        ORDER BY ".$prefixeTable."AStat_picture.id";
     
    20642200
    20652201    $sql="CREATE TABLE ".$prefixeTable."AStat_picture2 (PRIMARY KEY (OldId))
    2066       SELECT AStat_tmp.id as OldId , ".IMAGES_TABLE.".id as NewId, ".IMAGES_TABLE.".storage_category_id as NewCatId 
     2202      SELECT AStat_tmp.id as OldId , ".IMAGES_TABLE.".id as NewId, ".IMAGES_TABLE.".storage_category_id as NewCatId
    20672203      FROM (SELECT DISTINCT ".$prefixeTable."AStat_picture.*
    2068         FROM ".HISTORY_TABLE.", ".$prefixeTable."AStat_picture 
    2069         WHERE ".HISTORY_TABLE.".image_id = ".$prefixeTable."AStat_picture.id 
     2204        FROM ".HISTORY_TABLE.", ".$prefixeTable."AStat_picture
     2205        WHERE ".HISTORY_TABLE.".image_id = ".$prefixeTable."AStat_picture.id
    20702206        AND ".HISTORY_TABLE.".image_id NOT IN (SELECT id FROM ".IMAGES_TABLE.")
    20712207        ORDER BY ".$prefixeTable."AStat_picture.id
     
    20772213      $sql="UPDATE ".HISTORY_TABLE.", ".$prefixeTable."AStat_picture2, ".IMAGES_TABLE."
    20782214        SET ".HISTORY_TABLE.".image_id = ".$prefixeTable."AStat_picture2.NewId,
    2079             ".HISTORY_TABLE.".category_id = ".$prefixeTable."AStat_picture2.NewCatId 
     2215            ".HISTORY_TABLE.".category_id = ".$prefixeTable."AStat_picture2.NewCatId
    20802216        WHERE ".$prefixeTable."AStat_picture2.OldId = ".HISTORY_TABLE.".image_id";
    20812217      $result=pwg_query($sql);
     
    20882224      $sql="DROP TABLE IF EXISTS ".$prefixeTable."AStat_picture";
    20892225      $result=pwg_query($sql);
    2090     } 
     2226    }
    20912227    return($returned);
    20922228  }
     
    21462282
    21472283
    2148   /* 
     2284  /*
    21492285    this function make SELECT "WHERE" clause for filter list
    21502286
     
    21732309
    21742310
    2175   /* 
     2311  /*
    21762312    format text : <a href="$link">$value</a>
    21772313  */
     
    21872323  {  //basic test, maybe a pcre will be more appropriate...
    21882324    $tmp=explode('.', $ip);
    2189     if(count($tmp)!=4) 
     2325    if(count($tmp)!=4)
    21902326    { return (false); }
    21912327
    2192     for($i=0;$i<4;$i++) 
    2193     { 
    2194       if(!is_numeric($tmp[$i])) { return (false); } 
     2328    for($i=0;$i<4;$i++)
     2329    {
     2330      if(!is_numeric($tmp[$i])) { return (false); }
    21952331    }
    21962332    return (true);
     
    22032339  {  //filename can be <filename.truc.jpeg> for example
    22042340    $tmp = explode('.', $file);
    2205     if(count($tmp)>1) { $tmp[count($tmp)-1] = $newext; } 
    2206     return implode('.', $tmp);     
     2341    if(count($tmp)>1) { $tmp[count($tmp)-1] = $newext; }
     2342    return implode('.', $tmp);
    22072343  }
    22082344
    2209   /* 
     2345  /*
    22102346      format number $octets with unit
    22112347      $format = "A" : auto
     
    22292365    { $format="M"; }
    22302366    else
    2231     { $format="G"; } 
     2367    { $format="G"; }
    22322368    }
    22332369    switch($format)
     
    22442380    case "G":
    22452381      $unite="Go"; $div=1024000000;
    2246       break; 
    2247     }
    2248    
     2382      break;
     2383    }
     2384
    22492385    $retour=number_format($octets/$div, $prec, '.', $thsep);
    22502386    if($unitevis)
     
    22532389  }
    22542390
     2391  private function make_IP_where_clause($list)
     2392  {
     2393    $returned="";
     2394
     2395    $tmp=explode(",", $list);
     2396    foreach($tmp as $key=>$val)
     2397    {
     2398      if($returned!="") { $returned.=" OR "; }
     2399      $returned.=" IP LIKE '".$val."' ";
     2400    }
     2401    if($returned!="")
     2402    {
     2403      $returned ="(".$returned.")";
     2404    }
     2405    return($returned);
     2406  }
     2407
     2408  /* ---------------------------------------------------------------------------
     2409   * AJAX functions
     2410   * ------------------------------------------------------------------------- */
     2411  protected function ajax_listip($filter, $exclude)
     2412  {
     2413    $sql="SELECT IP, COUNT(id) as NbEvents FROM ".HISTORY_TABLE;
     2414
     2415    $where=array();
     2416    if($filter!="")
     2417    {
     2418      $where[]=" IP LIKE '".$filter."' ";
     2419    }
     2420    if($exclude!="")
     2421    {
     2422      $where[]=" NOT ".$this->make_IP_where_clause($exclude);
     2423    }
     2424    if(count($where)>0)
     2425    {
     2426      $sql.=" WHERE ".implode(" AND ", $where);
     2427    }
     2428    $sql.=" GROUP BY IP ORDER BY NbEvents desc, IP asc LIMIT 0,100";
     2429
     2430    $list="<select multiple id='iipsellist'>";
     2431    $result=pwg_query($sql);
     2432    if($result)
     2433    {
     2434      while($row=mysql_fetch_array($result))
     2435      {
     2436        $list.="<option value='".$row['IP']."'>".$row['IP'].str_repeat("&nbsp;", 15-strlen($row['IP']))."&nbsp;&nbsp;&nbsp;&nbsp;(".$row['NbEvents'].")</option>";
     2437      }
     2438    }
     2439    $list.="</select>";
     2440
     2441    return($list);
     2442  }
     2443
     2444
    22552445} // AStat_AI class
    22562446
  • extensions/AStat/language/en_UK/plugin.lang.php

    r3394 r3706  
    108108$lang['AStat_sortip_page'] = 'Number of pages seen';
    109109$lang['AStat_RefIPLabel'] = 'User / IP Adress';
    110 $lang['AStat_DefaultSortIP'] = 'Default sort'; 
     110$lang['AStat_DefaultSortIP'] = 'Default sort';
    111111$lang['AStat_general_config'] = 'Global settings';
    112112$lang['AStat_SeeTimeRequests'] = 'Show time execution of requests';
     
    162162$lang['AStat_tools_purge_history_nfo'] = "This function will clean the history from all past event from a given date and will optimize the table.<br><b>Operation cannot be reversed</b>.";
    163163$lang['AStat_tools_purge_history_apply'] = "Clean";
    164 $lang['AStat_tools_purge_history_date'] = "To purge all events prior (DD/MM/AAAA) ";
    165 $lang['AStat_tools_purge_history_imageid0'] = "To purge all events associated to deleted images (%s events in history)"; 
    166 $lang['AStat_tools_purge_history_categoryid0'] = "To purge events associated to deleted categories (%s events in history)"; 
     164$lang['AStat_tools_purge_history_date'] = "To purge all events prior ";
     165$lang['AStat_tools_purge_history_imageid0'] = "To purge all events associated to deleted images (%s events in history)";
     166$lang['AStat_tools_purge_history_categoryid0'] = "To purge events associated to deleted categories (%s events in history)";
    167167$lang['AStat_tools_result_ko'] = "An error has occurred. Action has not been correctly performed";
    168 $lang['AStat_tools_invalid_date'] = "Given date is not valid !"; 
    169 $lang['AStat_tools_invalid_date2'] = "Given date is upper or equal to date of the day"; 
    170 $lang['AStat_tools_deleted_picture_error0'] = "Priming has failed"; 
     168$lang['AStat_tools_invalid_date'] = "Given date is not valid !";
     169$lang['AStat_tools_invalid_date2'] = "Given date is upper or equal to date of the day";
     170$lang['AStat_tools_deleted_picture_error0'] = "Priming has failed";
    171171$lang['AStat_tools_deleted_picture_error1'] = "New association of events in the history has failed";
    172172$lang['AStat_tools_deleted_picture_ok0'] = "Priming of the table succeeded, files can be reorganized on the server";
     
    204204$lang['AStat_gpc2_not_installed'] = "Plugin 'Grum Plugins Classes 2' (release >= %s) is needed to install AStat";
    205205
     206//--- >> v2.1.0 >>
     207$lang['AStat_BlackListedIP'] = "Blacklisted IP";
     208$lang['AStat_AddIP'] = "Add to the blacklist";
     209$lang['AStat_DelIP'] = "Delete from the blacklist";
     210$lang['AStat_tools_purge_history_ipid0'] = "To purge events associated with IP from the blacklist (%s items in the blacklist, %s events in history)"
     211$lang['AStat_IP_blacklist'] = "Add to the blacklist";
    206212
    207213?>
  • extensions/AStat/language/es_ES/plugin.lang.php

    r3631 r3706  
    110110$lang['AStat_sortip_page'] = 'Número de páginas vistas';
    111111$lang['AStat_RefIPLabel'] = 'Utilizador / Dirección IP';
    112 $lang['AStat_DefaultSortIP'] = 'Selección por defecto'; 
     112$lang['AStat_DefaultSortIP'] = 'Selección por defecto';
    113113$lang['AStat_general_config'] = 'Configuración general';
    114114$lang['AStat_SeeTimeRequests'] = 'Ver la duración de ejecución de las demandas';
     
    158158$lang['AStat_section_old_deleted_cat'] = 'Antigua categoría que no ha podido ser importada';
    159159$lang['AStat_tools_general_nfo_nfo'] = "<ul><li>%s acontecimientos están presentes en la reseña histórica</li>
    160                                                 <li>La mesa pesa %s (Mesa: %s ; Índice: %s)</li>
    161                                                 <li>Data del primer acontecimiento : %s</li>
    162                                                 <li>Data del último acontecimiento : %s</li>";
     160            <li>La mesa pesa %s (Mesa: %s ; Índice: %s)</li>
     161            <li>Data del primer acontecimiento : %s</li>
     162            <li>Data del último acontecimiento : %s</li>";
    163163$lang['AStat_tools_purge_history'] = "Purga de la reseña histórica";
    164164$lang['AStat_tools_purge_history_nfo'] = "Esta función efectúa sobre la reseña histórica una purga de todos los acontecimientos anteriores a una fecha dada y optimiza la mesa. <br><b>Esta acción irreversible</b>.";
    165165$lang['AStat_tools_purge_history_apply'] = "Aplicar la purga";
    166 $lang['AStat_tools_purge_history_date'] = "Purgar los acontecimientos anteriores a (JJ/MM/AAAA) "; 
    167 $lang['AStat_tools_purge_history_imageid0'] = "Purgar los acontecimientos asociados con imágenes suprimidas  (%s acontecimientos en la reseña histórica)";
    168 $lang['AStat_tools_purge_history_categoryid0'] = "Purger les évènements associés à des catégories supprimées (%s acontecimientos en la reseña histórica)";
     166$lang['AStat_tools_purge_history_date'] = "Purgar los acontecimientos anteriores a (JJ/MM/AAAA) ";
     167$lang['AStat_tools_purge_history_imageid0'] = "Purgar los acontecimientos asociados con imágenes suprimidas (%s acontecimientos en la reseña histórica)";
     168$lang['AStat_tools_purge_history_categoryid0'] = "Purgar los acontecimientos asociados con categorías suprimidas (%s acontecimientos en la reseña histórica)";
    169169$lang['AStat_tools_result_ko'] = "Un error sobrevino, la acción no pudo ser correctamente llevada";
    170 $lang['AStat_tools_invalid_date'] = "La fecha informada es inválida !"; 
    171 $lang['AStat_tools_invalid_date2'] = "¡ La fecha informada es superior o igual a la fecha del día!"; 
    172 $lang['AStat_tools_deleted_picture_error0'] = "La preparación fue suspendido"; 
    173 $lang['AStat_tools_deleted_picture_error1'] = "El réassocation de los acontecimientos de la reseña histórica fue suspendido"; 
    174 $lang['AStat_tools_deleted_picture_ok0'] = "La preparación de la mesa tuvo éxito, usted puede proceder a la reorganización de los ficheros sobre el servidor"; 
    175 $lang['AStat_tools_deleted_picture_ok1'] = "El réassocation de los acontecimientos de la reseña histórica tuvo éxito"; 
     170$lang['AStat_tools_invalid_date'] = "La fecha informada es inválida !";
     171$lang['AStat_tools_invalid_date2'] = "¡ La fecha informada es superior o igual a la fecha del día!";
     172$lang['AStat_tools_deleted_picture_error0'] = "La preparación fue suspendido";
     173$lang['AStat_tools_deleted_picture_error1'] = "El réassocation de los acontecimientos de la reseña histórica fue suspendido";
     174$lang['AStat_tools_deleted_picture_ok0'] = "La preparación de la mesa tuvo éxito, usted puede proceder a la reorganización de los ficheros sobre el servidor";
     175$lang['AStat_tools_deleted_picture_ok1'] = "El réassocation de los acontecimientos de la reseña histórica tuvo éxito";
    176176
    177177$lang['AStat_tools_deleted_picture_nfo3'] = "Cuando imágenes son desplazadas físicamente por un repertorio, la sincronización suprime las imágenes de la base y las reinserta con una nueva referencia. Una imagen trasladada deja pues en los acontecimientos de la reseña histórica un rastro con referencias que no existen más.</p><p><i>AStat</i> Permite :<ul><li>de memorizar las referencias de imágenes <u><i>delantera</i></u> De proceder a la sincronización </li><li>de reasociar en los acontecimientos de la reseña histórica las buenas referencias de una imagen <u><i>Después</i></u> haber procedido a una sincronización</li></ul></p><p><b>Atención !</b><br><ul><li> si imágenes diferentes tienen los mismos nombres de ficheros, el resultado es imprevisible</li><li>este carácter funcional no puede tratar las imágenes para las cuales el fichero sobre el servidor fue renomé</li></ul>";
     
    183183
    184184
    185 $lang['AStat_tools_deleted_category'] = 'Poner al día en la reseña histórica las referencias de categorías'; 
     185$lang['AStat_tools_deleted_category'] = 'Poner al día en la reseña histórica las referencias de categorías';
    186186$lang['AStat_tools_deleted_category_nfo0'] = "Afecta para los acontecimientos de la reseña histórica référencants categorías que no existen más, la sección <i>Categoría suprimida</i>."; // v1.3.0
    187187$lang['AStat_tools_deleted_category_nfo1'] = "%s categorías inexistentes son presentes en los acontecimientos de la reseña histórica e impactent %s acontecimientos : <ul>%s</ul>";
     
    205205$lang['AStat_gpc2_not_installed'] = "El plugin ' Grum Plugins Classes 2' (version >= %s) es necesario para que AStat pueda estar instalado";
    206206
    207 
     207//--- >> v2.1.0 >>
     208$lang['AStat_BlackListedIP'] = "Lista negra de direcciones IP";
     209$lang['AStat_AddIP'] = "Añadir a la lista negra";
     210$lang['AStat_DelIP'] = "Eliminar de la lista negra";
     211$lang['AStat_tools_purge_history_ipid0'] = "Para purgar los acontecimientos asociados con la IP de la lista negra (%s elementos en la lista negra, %s acontecimientos en la reseña histórica)";
     212$lang['AStat_IP_blacklist'] = "Poner en lista negra";
    208213?>
  • extensions/AStat/language/fr_FR/plugin.lang.php

    r3394 r3706  
    110110$lang['AStat_sortip_page'] = 'Nombre de pages vues';
    111111$lang['AStat_RefIPLabel'] = 'Utilisateur / Adresse IP';
    112 $lang['AStat_DefaultSortIP'] = 'Tri par défaut'; 
     112$lang['AStat_DefaultSortIP'] = 'Tri par défaut';
    113113$lang['AStat_general_config'] = 'Configuration générale';
    114114$lang['AStat_SeeTimeRequests'] = 'Voir la durée d\'exécution des requêtes';
     
    158158$lang['AStat_section_old_deleted_cat'] = 'Ancienne catégorie n\'ayant pu être importée';
    159159$lang['AStat_tools_general_nfo_nfo'] = "<ul><li>%s évènements sont présents dans l'historique</li>
    160                                                 <li>La table pèse %s (Table: %s ; Index: %s)</li>
    161                                                 <li>Date du premier évènement : %s</li>
    162                                                 <li>Date du dernier évènement : %s</li>";
     160            <li>La table pèse %s (Table: %s ; Index: %s)</li>
     161            <li>Date du premier évènement : %s</li>
     162            <li>Date du dernier évènement : %s</li>";
    163163$lang['AStat_tools_purge_history'] = "Purge de l'historique";
    164164$lang['AStat_tools_purge_history_nfo'] = "Cette fonction effectue sur l'historique une purge de tous les évènements antérieurs à une date donnée et optimise la table. <br><b>Cette action irréversible</b>.";
    165165$lang['AStat_tools_purge_history_apply'] = "Appliquer la purge";
    166 $lang['AStat_tools_purge_history_date'] = "Purger les évènements antérieurs à (JJ/MM/AAAA) ";
    167 $lang['AStat_tools_purge_history_imageid0'] = "Purger les évènements associés à des images supprimées (%s évènements dans l'historique)"; 
    168 $lang['AStat_tools_purge_history_categoryid0'] = "Purger les évènements associés à des catégories supprimées (%s évènements dans l'historique)"; 
     166$lang['AStat_tools_purge_history_date'] = "Purger les évènements antérieurs à ";
     167$lang['AStat_tools_purge_history_imageid0'] = "Purger les évènements associés à des images supprimées (%s évènements dans l'historique)";
     168$lang['AStat_tools_purge_history_categoryid0'] = "Purger les évènements associés à des catégories supprimées (%s évènements dans l'historique)";
    169169$lang['AStat_tools_result_ko'] = "Une erreur est survenue, l'action n'a pu être correctement menée";
    170 $lang['AStat_tools_invalid_date'] = "La date renseignée est invalide !"; 
    171 $lang['AStat_tools_invalid_date2'] = "La date renseignée est supérieure ou égale à la date du jour !"; 
    172 $lang['AStat_tools_deleted_picture_error0'] = "La préparation a échouée"; 
    173 $lang['AStat_tools_deleted_picture_error1'] = "La réassocation des évènements de l'historique a échouée"; 
    174 $lang['AStat_tools_deleted_picture_ok0'] = "La préparation de la table a réussie, vous pouvez procéder à la réorganisation des fichiers sur le serveur"; 
    175 $lang['AStat_tools_deleted_picture_ok1'] = "La réassocation des évènements de l'historique a réussie"; 
     170$lang['AStat_tools_invalid_date'] = "La date renseignée est invalide !";
     171$lang['AStat_tools_invalid_date2'] = "La date renseignée est supérieure ou égale à la date du jour !";
     172$lang['AStat_tools_deleted_picture_error0'] = "La préparation a échouée";
     173$lang['AStat_tools_deleted_picture_error1'] = "La réassocation des évènements de l'historique a échouée";
     174$lang['AStat_tools_deleted_picture_ok0'] = "La préparation de la table a réussie, vous pouvez procéder à la réorganisation des fichiers sur le serveur";
     175$lang['AStat_tools_deleted_picture_ok1'] = "La réassocation des évènements de l'historique a réussie";
    176176
    177177$lang['AStat_tools_deleted_picture_nfo3'] = "Lorsque des images sont déplacées physiquement d'un répertoire, la synchronisation supprime les images de la base et les réinsère avec une nouvelle référence. Une image déplacée laisse donc dans les évènements de l'historique une trace avec des références qui n'existent plus.</p><p><i>AStat</i> permet :<ul><li>de mémoriser les références d'images <u><i>avant</i></u> de procéder à la synchronisation </li><li>de réassocier dans les évènements de l'historique les bonnes références d'une image <u><i>après</i></u> avoir procédé à une synchronisation</li></ul></p><p><b>Attention !</b><br><ul><li>si des images différentes ont les mêmes noms de fichiers, le résultat est imprévisible</li><li>cette fonctionnalité ne peut pas traiter les images pour lesquelles le fichier sur le serveur a été renomé</li></ul>";
     
    183183
    184184
    185 $lang['AStat_tools_deleted_category'] = 'Mettre à jour dans l\'historique les références de catégories'; 
     185$lang['AStat_tools_deleted_category'] = 'Mettre à jour dans l\'historique les références de catégories';
    186186$lang['AStat_tools_deleted_category_nfo0'] = "Affecte pour les évènements de l'historique référencants des catégories qui n'existent plus, la section <i>Catégorie supprimée</i>."; // v1.3.0
    187187$lang['AStat_tools_deleted_category_nfo1'] = "%s catégories inexistantes sont présentes dans les évènements de l'historique et impactent %s évènements : <ul>%s</ul>";
     
    205205$lang['AStat_gpc2_not_installed'] = "Le plugin 'Grum Plugins Classes 2' (version >= %s) est nécessaire pour que AStat puisse être installé";
    206206
     207//--- >> v2.1.0 >>
     208$lang['AStat_BlackListedIP'] = "Liste noire des adresses IP";
     209$lang['AStat_AddIP'] = "Ajouter à la liste";
     210$lang['AStat_DelIP'] = "Supprimer de la liste";
     211$lang['AStat_tools_purge_history_ipid0'] = "Purger les évènements associés aux IP de la liste noire (%s éléments dans la liste noire, %s évènements dans l'historique)";
     212$lang['AStat_IP_blacklist'] = "Mettre sur liste noire";
    207213
    208214?>
  • extensions/AStat/main.inc.php

    r3543 r3706  
    22/*
    33Plugin Name: AStat.2
    4 Version: 2.0.5
     4Version: 2.1.0
    55Description: Statistiques avancées / Advanced statistics
    66Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=172
     
    2121:: HISTORY
    2222
    23 2.0.0       - 13/05/07  - release for piwigo 2.0
    24 2.0.1       - 09/03/01  - bug corrected (can't open file because plugin directory
    25                           was hardcoded...)
    26 2.0.2       - 09/03/08  - bug referenced
    27                             english forum : http://piwigo.org/forum/viewtopic.php?pid=105990#p105990
    28                             french forum  : http://fr.piwigo.org/forum/viewtopic.php?pid=107205#p107205
    29                           SQL request for stat by categories works with mySQL 4.1.22 and not with mySQL 5
    30 2.0.3       - 28/03/08  - bug referenced
    31                             french forum  : http://fr.piwigo.org/forum/viewtopic.php?pid=107236#p107236
    32                           SQL request for stat by categories works with mySQL 4.1.22 and not with mySQL 5
    33 2.0.4       - 21/05/09  - bug on tools
    34                             it was not possible to use tools to manage deleted items
    35 2.0.5       - 07/07/09  - bug in code - invalid character on line 2194
     23
     24| release | date       |
     25| 2.0.0   | 2007/05/07 | * release for piwigo 2.0
     26| 2.0.1   | 2008/03/01 | * bug corrected (can't open file because plugin directory
     27|         |            |   was hardcoded...)
     28| 2.0.2   | 2008/03/09 | * bug referenced
     29|         |            |    english forum : http://piwigo.org/forum/viewtopic.php?pid=105990#p105990
     30|         |            |    french forum  : http://fr.piwigo.org/forum/viewtopic.php?pid=107205#p107205
     31|         |            |    SQL request for stat by categories works with mySQL 4.1.22 and not with mySQL 5
     32| 2.0.3   | 2008/03/28 | * bug referenced
     33|         |            |   french forum  : http://fr.piwigo.org/forum/viewtopic.php?pid=107236#p107236
     34|         |            |   SQL request for stat by categories works with mySQL 4.1.22 and not with mySQL 5
     35| 2.0.4   | 2009/05/21 | * bug on tools
     36|         |            |   it was not possible to use tools to manage deleted items
     37| 2.0.5   | 2009/07/07 | * bug in code - invalid character on line 2194
     38| 2.1.0   | 2009/07/28 | * add a blacklist for IP and use it for stats
     39|         |            | * new tools
     40|         |            |    - possibility to purge history on blacklisted IP address
     41|         |            |    - use of jQuery datepicker for purge date
     42|         |            |
     43|         |            |
     44|         |            |
     45|         |            |
     46|         |            |
     47|         |            |
     48|         |            |
     49
     50
    3651
    3752:: TO DO
     
    5570define('ASTAT_PATH' , PHPWG_PLUGINS_PATH . ASTAT_DIR . '/');
    5671
    57 define('ASTAT_VERSION' , '2.0.5'); // => ne pas oublier la version dans l'entête !!
     72define('ASTAT_VERSION' , '2.1.0'); // => ne pas oublier la version dans l'entête !!
    5873
    5974global $prefixeTable;
Note: See TracChangeset for help on using the changeset viewer.