MyBB Community Forums

Full Version: MyBB FancyBox v1.2.0
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10
Hello there, thanks for this amazing plugin Eldenroot! Just wondering if is there any way to exclude smilies? Thanks!
https://community.mybb.com/mods.php?acti...3&bid=5074

New version v1.2.0 released!

- added FancyBox on portal and announcements - thx @SvePu
- added an URL path for "watermark image" into ACP setting - thx @SvePu
- added rotate image feature - thx @SvePu
- fixed "Minimize" feature and "display thumbnails sidebox" conflict - thx @SvePu
- fixed/updated language files and clean up - thx @SvePu
- fixed PHP 8.1 compatibility issues - thx @SvePu
(2022-11-19, 10:31 PM)Eldenroot Wrote: [ -> ]https://community.mybb.com/mods.php?acti...3&bid=5074

New version v1.2.0 released!

- added FancyBox on portal and announcements - thx @SvePu
- added an URL path for "watermark image" into ACP setting - thx @SvePu
- added rotate image feature - thx @SvePu
- fixed "Minimize" feature and "display thumbnails sidebox" conflict - thx @SvePu
- fixed/updated language files and clean up - thx @SvePu
- fixed PHP 8.1 compatibility issues - thx @SvePu

I'm getting this error when trying to create a new Thread in 'most' forums:

Quote:Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /home/bomdiapo/public_html/inc/plugins/mybbfancybox.php:557 Stack trace: #0 /home/bomdiapo/public_html/inc/class_plugins.php(142): mybbfancybox_post() #1 /home/bomdiapo/public_html/inc/class_parser.php(282): pluginSystem->run_hooks() #2 /home/bomdiapo/public_html/newthread.php(1118): postParser->parse_message() #3 {main} thrown in /home/bomdiapo/public_html/inc/plugins/mybbfancybox.php on line 557

Issue did not begin at installation and only just started happening.  Do not have any other plugins installed.

Disabling FancyBox gets rid of this error, is there a quick fix??

MyBB Version
1.8.33

PHP Version
8.1.16

SQL Engine
MySQLi 10.3.36
(2023-03-24, 10:46 PM)misticjeff Wrote: [ -> ]I'm getting this error when trying to create a new Thread in 'most' forums:

That's odd. I can't see why it would be happening unless some other code is messing with the value of $mybb->settings, setting it to a string instead of the array that it should be - but you say you have no other plugins installed, so it could only[1] be core code doing that. What does file verification report (in the ACP at Tools & Maintenance » File Verification)?

[1] Unless maybe you have any plugins just present in the filesystem (but not activated) - do you?
File Verification reports that 'images/thead.png' was changed (true, i changed the color)

Regarding Plugins, I do have two others not activated but present:

Favicon 1.7
Hello World! 2.0
OK, I see what's going on now. In the line, #557, of inc/plugins/fancybox.php referenced in the error message you've shared, I'd assumed that the error referred to $mybb->settings['mybbfancybox_per_post_gallery'], but the real problem was with $post['pid'] (which I'd somehow not seen or just neglected to consider).

It looks as though the forums affected are those with rules set, and the problem occurs when the text of the rule is parsed for rendering. It's obviously not a post, and the FancyBox plugin tries to skip that sort of scenario (the parsing of non-post messages) by checking on line 506 of inc/plugins/fancybox.php for an empty global $post variable. Unfortunately, in your scenario, a global $post variable *does* exist, created on line 541 of newthread.php as a string - but it's obviously the wrong one. We need to handle that in the test.

The TL;DR:

A quick fix (untested) is to change line 506 of inc/plugins/fancybox.php from:
	if (empty($post)) return $message;
to:
	if (empty($post) || !is_array($post)) return $message;
(2023-03-25, 02:59 PM)Laird Wrote: [ -> ]OK, I see what's going on now. In the line, #557, of inc/plugins/fancybox.php referenced in the error message you've shared, I'd assumed that the error referred to $mybb->settings['mybbfancybox_per_post_gallery'], but the real problem was with $post['pid'] (which I'd somehow not seen or just neglected to consider).

It looks as though the forums affected are those with rules set, and the problem occurs when the text of the rule is parsed for rendering. It's obviously not a post, and the FancyBox plugin tries to skip that sort of scenario (the parsing of non-post messages) by checking on line 506 of inc/plugins/fancybox.php for an empty global $post variable. Unfortunately, in your scenario, a global $post variable *does* exist, created on line 541 of newthread.php as a string - but it's obviously the wrong one. We need to handle that in the test.

The TL;DR:

A quick fix (untested) is to change line 506 of inc/plugins/fancybox.php from:
	if (empty($post)) return $message;
to:
	if (empty($post) || !is_array($post)) return $message;

That did it!! Thank you very much! Appreciate your very quick and accurate response.  Jeff
So MyFancybox is now taking forever to load images, if at all. I can see the thumbnails, but when I click on them, it just spins. I have made no changes to anything. Any ideas? Thanks!
This is a very cool plugin thx
Pages: 1 2 3 4 5 6 7 8 9 10