Changeset 6699 for extensions/AStat


Ignore:
Timestamp:
Jul 24, 2010, 11:24:09 AM (10 years ago)
Author:
grum
Message:

Version 2.2.2, fix bug:1774

Location:
extensions/AStat
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • extensions/AStat/astat_aip.class.inc.php

    r5546 r6699  
    569569    $returned0 = array();
    570570
    571     $sql_select="select SQL_CALC_FOUND_ROWS ";
    572 
    573     $sql= "category_id, if(category_id > 0, ".CATEGORIES_TABLE.".name, section) as IdCat,
    574   count(".HISTORY_TABLE.".id) as NbPages, MaxPages.somme, 100*(count(".HISTORY_TABLE.".id)/MaxPages.somme) as PctPages,
    575   count(".HISTORY_TABLE.".image_id) as NbImg, MaxImg.somme, 100*(count(".HISTORY_TABLE.".image_id)/MaxImg.somme) as PctImg, ic2.nb_images as NbImgCat, (count(".HISTORY_TABLE.".image_id)/ic2.nb_images) as RatioImg, greatest(100*(count(".HISTORY_TABLE.".id)/MaxPages.somme), 100*(count(".HISTORY_TABLE.".image_id)/MaxImg.somme)) as MaxPct ";
     571    $sql_select="SELECT SQL_CALC_FOUND_ROWS ";
     572
     573    $sql= "category_id, IF(category_id > 0, ".CATEGORIES_TABLE.".name, section) AS IdCat,
     574  COUNT(".HISTORY_TABLE.".id) AS NbPages, MaxPages.somme, 100*(count(".HISTORY_TABLE.".id)/MaxPages.somme) AS PctPages,
     575  COUNT(".HISTORY_TABLE.".image_id) AS NbImg, MaxImg.somme, 100*(count(".HISTORY_TABLE.".image_id)/MaxImg.somme) AS PctImg, ic2.nb_images as NbImgCat, (COUNT(".HISTORY_TABLE.".image_id)/ic2.nb_images) AS RatioImg, greatest(100*(COUNT(".HISTORY_TABLE.".id)/MaxPages.somme), 100*(COUNT(".HISTORY_TABLE.".image_id)/MaxImg.somme)) AS MaxPct ";
    576576
    577577    if($show_thumb=='true')
     
    586586    }
    587587
    588     $sql_from = " from (".HISTORY_TABLE." LEFT JOIN ".CATEGORIES_TABLE." ON ".CATEGORIES_TABLE.".id = ".HISTORY_TABLE.".category_id),
    589 (select category_id as catid, count(image_id) as nb_images, representative_picture_id
    590  from ".IMAGE_CATEGORY_TABLE.", ".CATEGORIES_TABLE."
    591  where ".CATEGORIES_TABLE.".id = ".IMAGE_CATEGORY_TABLE.".category_id group by category_id) as ic2 ";
     588    $sql_from = " FROM (".HISTORY_TABLE." LEFT JOIN ".CATEGORIES_TABLE." ON ".CATEGORIES_TABLE.".id = ".HISTORY_TABLE.".category_id),
     589(SELECT category_id AS catid, COUNT(image_id) AS nb_images, representative_picture_id
     590 FROM ".IMAGE_CATEGORY_TABLE.", ".CATEGORIES_TABLE."
     591 WHERE ".CATEGORIES_TABLE.".id = ".IMAGE_CATEGORY_TABLE.".category_id group by category_id) AS ic2 ";
    592592    $sql_where = "";
    593     $sql_group=" group by category_id, section ";
     593    $sql_group=" GROUP BY category_id, section ";
    594594    $sql_group2="";
    595     $sql_order=" order by ".$sortlist[$sortcat];
    596     $sql_limit=" limit ".(($pagenumber-1)* $nbipperpage).", ".$nbipperpage;
     595    $sql_order=" ORDER BY ".$sortlist[$sortcat];
     596    $sql_limit=" LIMIT ".(($pagenumber-1)* $nbipperpage).", ".$nbipperpage;
    597597
    598598    if($day!="")
    599599    {
    600       $sql_where=" where YEAR(date) = $year and MONTH(date) = $month and DAY(date)= $day ";
     600      $sql_where=" WHERE YEAR(date) = $year AND MONTH(date) = $month AND DAY(date)= $day ";
    601601    }
    602602    elseif($month!="")
    603603    {
    604       $sql_where=" where YEAR(date) = $year and MONTH(date) = $month ";
     604      $sql_where=" WHERE YEAR(date) = $year AND MONTH(date) = $month ";
    605605    }
    606606    elseif($year!="")
    607607    {
    608       $sql_where=" where YEAR(date) = $year ";
     608      $sql_where=" WHERE YEAR(date) = $year ";
    609609    }
    610610    else { }
     
    617617    }
    618618
    619     $sql_max=", (select count(id) as somme from ".HISTORY_TABLE.$sql_where.$sql_group2.") as MaxPages,
    620           (select count(image_id) as somme from ".HISTORY_TABLE.$sql_where.$sql_group2.") as MaxImg ";
    621 
    622     ($sql_where=="")?$sql_where=" where ":$sql_where.=" and ";
     619    $sql_max=", (SELECT COUNT(id) AS somme FROM ".HISTORY_TABLE.$sql_where.$sql_group2.") AS MaxPages,
     620          (SELECT COUNT(image_id) AS somme FROM ".HISTORY_TABLE.$sql_where.$sql_group2.") AS MaxImg ";
     621
     622    ($sql_where=="")?$sql_where=" WHERE ":$sql_where.=" AND ";
    623623    $sql_where .= "  ic2.catid = ".HISTORY_TABLE.".category_id ";
    624624
    625625    if(($this->config['AStat_UseBlackList']!="false")&&($this->config['AStat_BlackListedIP']!=""))
    626626    {
    627       ($this->config['AStat_UseBlackList']=="true")?$sql_where .= " NOT ":"";
     627      ($this->config['AStat_UseBlackList']=="true")?$sql_where .= " AND NOT ":"";
    628628      $sql_where .= $this->make_IP_where_clause($this->config['AStat_BlackListedIP']);
    629629    }
     
    632632
    633633    $result = pwg_query($sql);
    634     $sql="select FOUND_ROWS()";
     634    $sql="SELECT FOUND_ROWS()";
    635635
    636636    $i=0;
  • extensions/AStat/astat_version.inc.php

    r5801 r6699  
    1515  if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    1616
    17   define('ASTAT_VERSION',  '2.2.1');
    18   define('ASTAT_VERSION2', '02.02.01');
     17  define('ASTAT_VERSION',  '2.2.2');
     18  define('ASTAT_VERSION2', '02.02.02');
    1919?>
  • extensions/AStat/main.inc.php

    r5801 r6699  
    22/*
    33Plugin Name: AStat.2
    4 Version: 2.2.1
     4Version: 2.2.2
    55Description: Statistiques avancées / Advanced statistics
    66Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=172
     
    6060|         |            |   . it_IT
    6161|         |            |
    62 |         |            |
    63 |         |            |
     62| 2.2.2   | 2010/07/24 | * mantis: bug 1774
     63|         |            |   Stat by categories doesn't work when IP filter is activated
    6464|         |            |
    6565|         |            |
Note: See TracChangeset for help on using the changeset viewer.