Menu

#3 category filter not working properly

v0.x
open
7
2014-08-23
2003-10-02
No

I found this problem on version 0.6 - can't seem to
find version 0.7 anywhere in sourceforge (even though
you already mention 0.7 in your blog)

The category filtering only checks whether a category
name exists in the directory path.

if (strpos($checkDirs[$ck], $categoryFilter) == true) {
$filteredPaths[] = $checkDirs[$ck];
}

This will cause trouble if a category name exists as
part of the datadir.

E.g. if datadir is /dev/sites/phposxom
and this datadir has several categories named: abc,
tools, dev, family

when the category filter is dev, it will not filter
anything because dev is part of the full directory path
name to check ($checkDirs[$ck]).

I suggest instead of checking the category filter
anywhere in the path, it should really check whether
the category name is at the end of the path.

This could be a patch:
if ((strpos($checkDirs[$ck], $categoryFilter) == true) &&
((strlen($checkDirs[$ck]) -
strlen($categoryFilter)) == strrpos($checkDirs[$ck],
$categoryFilter))) {
$filteredPaths[] = $checkDirs[$ck];
}

I'm sure the above code can be simplified, but you
get the idea.

Discussion

  • Robert Daeley

    Robert Daeley - 2003-10-02
    • milestone: --> v0.x
     
  • Robert Daeley

    Robert Daeley - 2003-10-02

    Logged In: YES
    user_id=682120

    Thanks for the input -- I'll have a looksee at the current code and
    see what's what.

    (0.7 is in non-public alpha at the moment, with a public beta
    happening Real Soon Now.)

     
  • Robert Daeley

    Robert Daeley - 2003-10-02
    • priority: 5 --> 7
     

Log in to post a comment.

Monday.com Logo