Announcement

#1 2012-08-01 21:21:24

tota
Member
2009-02-17
5

AStat Problem with category

Hello, I found problem with AStat where was category filter.
If CategoryRank example 1.1.1
found also 1.1.10, 1.1.11, ...

Repair script Astat_aip.class.inc.php

original:

  private function make_where_clause($catfilter)
  {

    $returned=array();

    $sql="SELECT id, ".CATEGORIES_TABLE.".global_rank
          FROM ".CATEGORIES_TABLE.",
               (SELECT global_rank FROM ".CATEGORIES_TABLE." WHERE id = '".$catfilter."') as tmp1
          WHERE ".CATEGORIES_TABLE.".global_rank LIKE CONCAT(tmp1.global_rank, '%')
          ORDER BY ".CATEGORIES_TABLE.".global_rank";

    $result = pwg_query($sql);

    if($result)
    {
      while ($row = pwg_db_fetch_row($result))
      {
        $returned[]=$row[0];
      }
    }

    return(implode(',', $returned));
  }


new:


  private function make_where_clause($catfilter)
  {

    $returned=array();

    $sql="SELECT id, ".CATEGORIES_TABLE.".global_rank
          FROM ".CATEGORIES_TABLE.",
               (SELECT global_rank FROM ".CATEGORIES_TABLE." WHERE id = '".$catfilter."') as tmp1
          WHERE ".CATEGORIES_TABLE.".global_rank LIKE CONCAT(tmp1.global_rank, '.%')
            OR ".CATEGORIES_TABLE.".global_rank = tmp1.global_rank
          ORDER BY ".CATEGORIES_TABLE.".global_rank";

    $result = pwg_query($sql);

    if($result)
    {
      while ($row = pwg_db_fetch_row($result))
      {
        $returned[]=$row[0];
      }
    }

    return(implode(',', $returned));
  }

Offline

 

#2 2012-08-05 16:07:08

grum
Piwigo Team
Nantes
2007-09-10
1371

Re: AStat Problem with category

Hi


Thanks for the information.
I'll fix it as soon as I've some time for.


My pictures with Piwigo, of course !
[ www.grum.fr ] [ photos.grum.fr ]

Offline

 

#3 2014-10-21 10:18:37

tota
Member
2009-02-17
5

Re: AStat Problem with category

Hi,
the same problem in new version AStat.

Thanks T.

Offline

 

Board footer

Powered by FluxBB

github twitter facebook google+ newsletter Donate Piwigo.org © 2002-2018 · Contact