Announcement

#1 2022-10-22 19:03:23

martin00
Member
2022-10-18
4

[resolved] piwigo 13 and 13.1 ; smarty errors; unable to browse on mobile devices

Hi,

as $subj says, I can't use piwigo with the mobile devices (either iOS or Android). I'm left with the error:

[php:error] [pid 64561] [client xxx:55361] PHP Fatal error:  Uncaught  --> Smarty Compiler: Syntax error in template "file:/pw/themes/smartpocket/template/footer.tpl"  on line 20 "document.cookie = 'screen_size='+jQuery(document).width()+'x'+jQuery(document).height()+';path={isset($COOKIE_PATH) ? $COOKIE_PATH : ''}';"  - Unexpected " ? ", expected one of: "}" <-- \n  thrown in /pw/include/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php on line 20, referer: xxxx

I see this error on freshly installed 13.0 or even on upgraded 13.1 version.
System is FreeBSD 12.3/13.1 with the

php80-8.0.24
mysql80-server-8.0.30

I've googled around with the similar messages but neither solutions works (clearing the cache, etc.). Also seems to be a problem in the template itself.
Any suggestions?
thanks.

Offline

 

#2 2022-10-22 22:21:55

Katryne
Member
2016-12-03
401

Re: [resolved] piwigo 13 and 13.1 ; smarty errors; unable to browse on mobile devices

Hello,
SmartPocket is somewhat obsolete and I was told it was not meant to be updated.
I uninstalled it completely and keeps only Bootstrap Darkroom for both desktop and mobile browsing.
I tested this with Piwigo 13.1 and php 8.0.24.


https://album.chauvigne.info/ v.13.8.0 - https://balades.comoni.org/ v.14.5.0
Système d'exploitation: Linux - Hébergeur 1&1-Ionos PHP: 8.1.29 - MySQL: 5.7.38
Bibliothèque graphique: External ImageMagick 6.9.10-23

Offline

 

#3 2022-10-23 14:01:58

martin00
Member
2022-10-18
4

Re: [resolved] piwigo 13 and 13.1 ; smarty errors; unable to browse on mobile devices

While I'd rather stick to the default theme on PC this bootstrap darkroom is not that bad (I guess I hate changes:) ). While it's not a solution it's definitely nice workaround.

Thanks Katryne.

Offline

 

#4 2022-10-23 14:17:21

erAck
Only trying to help
2015-09-06
2128

Re: [resolved] piwigo 13 and 13.1 ; smarty errors; unable to browse on mobile devices

Indeed SmartPocket appears broken, on Android (Firefox, Fennec and Browser) it displays only albums for me, but no content; works in desktop browser. However, I got the same error message in the PHP log. Now deinstalled SmartPocket.

Piwigo Android from F-Droid, even if old, works so far (haven't tried adding content).
https://f-droid.org/en/packages/org.piwigo.android/
Probably same from GPlay.

I now use Bootstrap Darkroom as mobile theme only (note this is not necessary if you use it as default theme anyway), by having patched its themes/bootstrap_darkroom/themeconf.inc.php to insert the 'mobile' => true property

Code:

--- themes/bootstrap_darkroom/themeconf.inc.php.orig  2022-09-21 15:19:52.000000000 +0200
+++ themes/bootstrap_darkroom/themeconf.inc.php   2022-10-23 13:09:01.777985525 +0200
@@ -11,6 +11,7 @@ require_once(PHPWG_THEMES_PATH . 'bootst
 require_once(PHPWG_THEMES_PATH . 'bootstrap_darkroom/include/config.php');
 
 $themeconf = array(
+    'mobile' => true,
     'name' => 'bootstrap_darkroom',
     'parent' => 'default',
     'load_parent_css' => false,

and after that deactivate/activate the theme again to have it registered in table piwigo_config as mobile_theme bootstrap_darkroom.


Running Piwigo at https://erack.net/gallery/

Offline

 

#5 2022-10-23 15:37:55

MiPi
Member
2022-10-23
6

Re: [resolved] piwigo 13 and 13.1 ; smarty errors; unable to browse on mobile devices

I like SmartPocket on mobile device, so for now I simply put back smartpocket/template/footer.tpl from 13.0.0. And hopefully the next update will fix it more properly.
The only change is after this line

Code:

{footer_script require='jquery'}

The previous version contained:

Code:

document.cookie = 'screen_size='+jQuery(document).width()+'x'+jQuery(document).height()+';path={$COOKIE_PATH}';

So you can simply replace the new version with this one. I know the change was made for some reason, but for me this is better than nothing, for now.

Last edited by MiPi (2022-10-23 15:38:33)

Offline

 

#6 2022-10-23 19:47:26

erAck
Only trying to help
2015-09-06
2128

Re: [resolved] piwigo 13 and 13.1 ; smarty errors; unable to browse on mobile devices

So the update changed code from

Code:

+';path={$COOKIE_PATH}';

to

Code:

+';path={isset($COOKIE_PATH) ? $COOKIE_PATH : ''}';

that obviously is wrong for the levels of single quotes forming string literals to assemble.

That might have to be instead

Code:

+';path='{isset($COOKIE_PATH) ? $COOKIE_PATH : ''};

placing the actual $COOKIE_PATH if set as value, if a path= value without any quotes can actually be handled by document.cookie.

The tempting "escape the quotes" like

Code:

+';path={isset($COOKIE_PATH) ? $COOKIE_PATH : \'\'}';

IMHO doesn't make sense as that would have to evaluate the entire {} braced expression within the literal.

Let the Piwigo devs decide..
There's [Github] Piwigo issue #1766 for this.


Running Piwigo at https://erack.net/gallery/

Offline

 

#7 2022-10-30 16:24:39

erAck
Only trying to help
2015-09-06
2128

Re: [resolved] piwigo 13 and 13.1 ; smarty errors; unable to browse on mobile devices

Fwiw, the changes of commit [Github] piwigo-smartpocket commit 738dcde3 fix the problem for me.
You can apply the patch on the command line with

Code:

cd YourPiwigoDirectory/themes/smartpocket
curl https://github.com/Piwigo/piwigo-smartpocket/commit/738dcde354d73fad6b08442dcebdc9b5e8fbc002.patch | patch -p1

Edit: I erroneously stated patch -p0, corrected to patch -p1
Sorry for the inconvenience..

Last edited by erAck (2022-10-31 14:57:05)


Running Piwigo at https://erack.net/gallery/

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact