Bug in content plugin : file id confused with category id

Phoca Download - download manager
AlainR
Phoca Enthusiast
Phoca Enthusiast
Posts: 52
Joined: 24 Jul 2018, 16:33

Bug in content plugin : file id confused with category id

Post by AlainR »

Hi.
We found a bug because, in filelist mode, we have other files from other categories and whatever the category.
My hypothesis is that there is confusion, at the plugin level, between the category ID and the ID of other files (which are not in the category to list).
Indeed, it is sufficient that there is a 6 (62, 68) in the ID of the file and it is also added to the list of files of category 6.

On website, 2 files from another category :
Image
In filelist, both file's ID is 6x (and another problem is that plugin does not take into account the publication status) :
Image

Tags:
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Bug in content plugin : file id confused with category id

Post by Jan »

Hi, can you paste a plugin code you are using in your content?


Jan
If you find Phoca extensions useful, please support the project
AlainR
Phoca Enthusiast
Phoca Enthusiast
Posts: 52
Joined: 24 Jul 2018, 16:33

Re: Bug in content plugin : file id confused with category id

Post by AlainR »

Code: Select all

{phocadownload view=filelist|id=6|target=b}
and I added "|limit=3" not to see more than the 3 "good" files
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Bug in content plugin : file id confused with category id

Post by Jan »

The flow is following:

Code: Select all

else if($values[0]=='id')				{$id				= $values[1];}
id stored in variable $id

Code: Select all

case 'filelist':

Code: Select all

if ((int)$id > 0) {
							$query .= ' WHERE c.id = '.(int)$id;
c.id ==>

Code: Select all

. ' LEFT JOIN #__phocadownload_categories AS c ON a.catid = c.id';
In words, the id is category ID, so the SQL query selects all items based on category ID.

I don't see any other use of ID in other part. The ID is used once in the SQL query - compared to category ID:

Image

So, I don't exactly understand what do you mean with: "the category ID and the ID of other files"?

Jan
If you find Phoca extensions useful, please support the project
AlainR
Phoca Enthusiast
Phoca Enthusiast
Posts: 52
Joined: 24 Jul 2018, 16:33

Re: Bug in content plugin : file id confused with category id

Post by AlainR »

Thank you for your answer.
It was a guess, maybe I got too far ahead in the title of the post.
However, after several tests, the fact is that documents of another category - and regardless of the category, I tried to move them, etc. - appear in the list when they should not.
I try to redo the list by hiding (CSS display:none) the extra elements in order to show you on this page (module on the right, titled "Documents"): www.yens.ch/services-communaux/dechetterie
You should recognize the documents on both screenshots sent the other day. Thank you in advance!
AlainR
Phoca Enthusiast
Phoca Enthusiast
Posts: 52
Joined: 24 Jul 2018, 16:33

Re: Bug in content plugin : file id confused with category id

Post by AlainR »

You're right, it's another problem. I change one of the id form 65 to 11 and file is always displayed even it's not the right category.

Sorry, it's because I hacked your plugin (see viewtopic.php?f=31&t=62408) and I now have where AND and OR conditions. Sorry for the inconvenience and strongly that the feature request is granted! ;)

Best regards
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Bug in content plugin : file id confused with category id

Post by Jan »

Ok
If you find Phoca extensions useful, please support the project
Post Reply