Hi,
(Link-6283) (Link-6285) everything on the edit page is normal created thumbnail image
no thumbnails on the topic page
"X" click
error message
The database value you're trying to insert does not exist: current_topic
Can you check in the log if there is some more details? (For example the file and the line.)
sorry,
Error type: Critical
The database value you're trying to insert does not exist: current_topic
Function: getAttachmentFromTopic
sources/subs/Attachments.subs.php
Line: 1145
Error type: Unspecified
Notice: Undefined variable: id_topic
sources/controllers/Attachment.controller.php
Line: 347
Error type: Critical
The database value you're trying to insert does not exist: current_topic
Function: getAttachmentThumbFromTopic
sources/subs/Attachments.subs.php
Line: 1191
Error type: Unspecified
Notice: Undefined variable: id_topic
sources/controllers/Attachment.controller.php
Line: 352
forum attachment folder setting: Separate by year and month
@Spuds I'm a little tired and I may be reading something wrong:
if (empty($topic) && !empty($id_attach))
{
$attachPos = getAttachmentPosition($id_attach);
if ($attachPos !== false)
{
list($id_board, $id_topic) = array_values($attachPos);
}
else
{
$id_board = 0;
}
}
else
{
$id_board = $board;
$id_topic = $topic;
}
isAllowedTo('view_attachments', $id_board);
if ($this->_req->getQuery('thumb') === null)
{
347 => $attachment = getAttachmentFromTopic($id_attach, $id_topic);
}
else
{
$this->_req->query->image = true;
352 => $attachment = getAttachmentThumbFromTopic($id_attach, $id_topic);
To have $id_topic not set, the only path I see is where it sets $id_board to 0.
But, if $id_board is set to 0, then the processing should stop at the isAllowedTo... isn't it?
But if isAllowedTo doesn't stop the processing we have some nasty stuff going around... :-\
@gevv try changing in Attachment.controller.php the following line:
isAllowedTo('view_attachments', $id_board);
to:
try
{
isAllowedTo('view_attachments', $id_board);
}
catch (\Exception $e)
{
return $this->action_no_attach();
}
I also see sometimes this error on my forum, I deleted the log yesterday and cannot give more info...
Some attachments are displayed in different topics using the bbcode "attach", could be this the cause? I only see it on my forum skoda, not on the small shark where I have the same add-ons installed but not using the bbcode to display attachments posted in different topics.
Not 100% sure about this, but IIRC I've seen once that the error was related to an avatar posted as attachment. I'll check better in the next days
From the code, I'd say that the only path leading to that error is when the attachment has been removed.
In that case getAttachmentPosition return false and only $id_board is set, leaving $id_topic not set (that would generate the error).
ohh... idiot I am.
Admins have allowedTo true by default, so we cannot rely on isAllowedTo to block the execution path in case of admins and so it passes that stage and arrives to an unset $id_topic. It's obvious.
Then I'd say my previously suggested change wouldn't make any difference, instead:
else
{
$id_board = 0;
}
should be replaced with:
else
{
$id_board = 0;
$id_topic = 0;
}
this should ensure $id_topic is set, and both getAttachmentFromTopic and getAttachmentThumbFromTopic should return an empty array making the code show an error image.
Thanks
@emanuele 2 changes?
{
isAllowedTo('view_attachments', $id_board);
}
catch (\Exception $e)
{
return $this->action_no_attach();
}
and;
else
{
$id_board = 0;
$id_topic = 0;
}
No,only the second.