Page 1 of 1

Bug in content plugin : file id confused with category id

Posted: 04 May 2021, 16:55
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

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

Posted: 07 May 2021, 12:45
by Jan
Hi, can you paste a plugin code you are using in your content?


Jan

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

Posted: 07 May 2021, 13:04
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

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

Posted: 07 May 2021, 13:26
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

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

Posted: 07 May 2021, 13:55
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!

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

Posted: 07 May 2021, 15:22
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

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

Posted: 12 May 2021, 16:31
by Jan
Ok