Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: My theme doesn't work properly on PHP7.1 and higher  (Read 800 times)

0 Members and 1 Guest are viewing this topic.

KchoPrro

  • Coppermine frequent poster
  • ***
  • Country: es
  • Offline Offline
  • Gender: Male
  • Posts: 266
    • Adolfo Ventas - Naturaleza Andaluza
My theme doesn't work properly on PHP7.1 and higher
« on: September 13, 2022, 07:53:02 pm »

Hello friends, I would like to know what my gallery would need to be able to work with Php 7.6 or Php8. Apparently, I am using an old version of Php on my hosting but I have tried to update to higher versions but the gallery does not display well, it does not even display.

I put some screenshots with different versions of Php.

I have discovered that it is a problem with my theme, when I use the "curve" theme or any other integrated in CPG, everything is displayed correctly.

With PHP8 and 8.1 I see other problems even with "curve", related to the BBCode Control or Minicms plugins, but I'd be happy if my theme could at least work on PHP7.4. Any idea of the problem?

In PHP version 7.1-7.4, I get the following message if I enter directly:

Quote
Fatal error: Uncaught ArgumentCountError: Too few arguments to function CPGPluginAPI::filter(), 1 passed in /galeria/themes/chaoticsoul/theme.php on line 1061 and at least 2 expected in /galeria/include/plugin_api.inc.php:156 Stack trace: #0 galeria/themes/chaoticsoul/theme.php(1061): CPGPluginAPI::filter('theme_thumbnail...') #1 /galeria/include/functions.inc.php(3166): theme_display_thumbnails(Array, '978', '\xC3\x9Altimas subida...', 'lastup', 0, 1, 245, false, false, 'thumb', NULL) #2 /galeria/index.php(1164): display_thumbnails('lastup', 0, 1, '4', 1, false) #3 {main} thrown in /galeria/include/plugin_api.inc.php on line 156

I guess that is the source of the problem  :'(.
Logged

KchoPrro

  • Coppermine frequent poster
  • ***
  • Country: es
  • Offline Offline
  • Gender: Male
  • Posts: 266
    • Adolfo Ventas - Naturaleza Andaluza
Re: My theme doesn't work properly on PHP7.1 and higher
« Reply #1 on: September 13, 2022, 08:13:02 pm »

In debug mode I get these errors:

Quote
/themes/chaoticsoul/theme.php

    Warning line 31: Use of undefined constant album - assumed 'album' (this will throw an Error in a future version of PHP)
    Notice line 31: Trying to access array offset on value of type null

/admin.php

    Notice line 174: Undefined index: alb_desc_thumb
    Notice line 513: Undefined index: alb_desc_thumb


I don't know if they have anything to do with the problem  :-\.
Logged

ron4mac

  • Administrator
  • Coppermine addict
  • *****
  • Country: us
  • Offline Offline
  • Posts: 1908
My theme doesn't work properly on PHP7.1 and higher
« Reply #2 on: September 13, 2022, 10:35:13 pm »

In PHP version 7.1-7.4, I get the following message if I enter directly:

In the theme's theme.php file, replace line #1061 with:
Code: [Select]
    $wrapper_start = CPGPluginAPI::filter('theme_thumbnails_wrapper_start', null);
Logged

KchoPrro

  • Coppermine frequent poster
  • ***
  • Country: es
  • Offline Offline
  • Gender: Male
  • Posts: 266
    • Adolfo Ventas - Naturaleza Andaluza
My theme doesn't work properly on PHP7.1 and higher
« Reply #3 on: September 14, 2022, 07:47:23 am »

In the theme's theme.php file, replace line #1061 with:
Code: [Select]
    $wrapper_start = CPGPluginAPI::filter('theme_thumbnails_wrapper_start', null);

Thanks ron4mac, now the last uploaded photos appear (lastup), but the menu (sidebar) still does not appear, it only appears when we enter an image. Random images are also not displayed.  :-[

Logged

ron4mac

  • Administrator
  • Coppermine addict
  • *****
  • Country: us
  • Offline Offline
  • Posts: 1908
Re: My theme doesn't work properly on PHP7.1 and higher
« Reply #4 on: September 14, 2022, 01:03:48 pm »

In trying to help you with your site, I had gotten the original ChaoticSoul version (it is very old) and made necessary changes to get it to function properly. At the time, I didn't know that you were using PHP 7.0 and I just fixed things with it to get it functioning with PHP 8.1 ... as my focus was to see whether the theme was part of the problem for FancyBox. Attached here is the theme.php file I have that is running with CPG and PHP 8.1
Logged

KchoPrro

  • Coppermine frequent poster
  • ***
  • Country: es
  • Offline Offline
  • Gender: Male
  • Posts: 266
    • Adolfo Ventas - Naturaleza Andaluza
Re: My theme doesn't work properly on PHP7.1 and higher
« Reply #5 on: September 14, 2022, 02:57:08 pm »

In trying to help you with your site, I had gotten the original ChaoticSoul version (it is very old) and made necessary changes to get it to function properly. At the time, I didn't know that you were using PHP 7.0 and I just fixed things with it to get it functioning with PHP 8.1 ... as my focus was to see whether the theme was part of the problem for FancyBox. Attached here is the theme.php file I have that is running with CPG and PHP 8.1

As always, thank you very much for the great work you do.

Now I see the web in PHP 7.4 (in 8.0 and 8.1 neither the Sidebar nor the last uploaded images and random images are shown).

Now two minor problems occur to me;

1- Under the thumbnails the description of the image appears, and not the title (I have checked the configuration, and it is correct, only the title should be visible).
2- The style sheet has changed completely, the text of the description appears in the color of the text of the categories and is not justified. This is not a major problem, I think I'll be able to put everything back in place myself.

I leave PHP7.4 on, attached a screenshot of how it looks with 8.0 and 8.1-
Logged

ron4mac

  • Administrator
  • Coppermine addict
  • *****
  • Country: us
  • Offline Offline
  • Posts: 1908
Re: My theme doesn't work properly on PHP7.1 and higher
« Reply #6 on: September 14, 2022, 03:30:15 pm »

Apparently your theme.php file had been significantly modified from the original. You might consider moving to a different theme. Here is a very nice, lightweight one that is free, has the side menu, has some responsiveness and would only need minor css adjustment to become a dark theme. ChaoticSoul tries to do too much in its theme.php file and creates problems with software updates.
« Last Edit: September 14, 2022, 06:43:00 pm by ron4mac »
Logged

KchoPrro

  • Coppermine frequent poster
  • ***
  • Country: es
  • Offline Offline
  • Gender: Male
  • Posts: 266
    • Adolfo Ventas - Naturaleza Andaluza
Re: My theme doesn't work properly on PHP7.1 and higher
« Reply #7 on: September 14, 2022, 07:30:57 pm »

Apparently your theme.php file had been significantly modified from the original. You might consider moving to a different theme. Here is a very nice, lightweight one that is free, has the side menu, has some responsiveness and would only need minor css adjustment to become a dark theme. ChaoticSoul tries to do too much in its theme.php file and creates problems with software updates.

Ohhhhh!  :'(, I fell in love with Chaoticsoul since I saw it for the first time in CPG, no other theme I liked so much  :-* :-*. I made some aesthetic adjustments to it and since 2010 it was the theme I used, to the point that I adapted the thumbnails for the theme (I replace each thumbnail generated by CPG with an adapted one, with a mirror effect and background color). In addition, I have many pages with MiniCMS, created for the Chaoticsoul theme that I would have to revise to adapt them to a new theme.

It's a shame, I'll have to think about it.

I have seen the subject of the link, I was totally unaware that designs were made (free or paid) outside the CPG forum. For 6 dollars that cost the paid designs, it seems cheap to me. Perhaps I will value one of the paid ones, for now I will download the free one and I will study some aesthetic changes that I like (I prefer dark colors)

Thank you very much, I'll take a few days off ;)
Logged

ron4mac

  • Administrator
  • Coppermine addict
  • *****
  • Country: us
  • Offline Offline
  • Posts: 1908
Re: My theme doesn't work properly on PHP7.1 and higher
« Reply #8 on: September 14, 2022, 09:27:36 pm »

I replace each thumbnail generated by CPG with an adapted one, with a mirror effect and background color
Just so you know ... that effect could happen automatically with a bit of CSS and a fairly simple plugin.
Logged

KchoPrro

  • Coppermine frequent poster
  • ***
  • Country: es
  • Offline Offline
  • Gender: Male
  • Posts: 266
    • Adolfo Ventas - Naturaleza Andaluza
Re: My theme doesn't work properly on PHP7.1 and higher
« Reply #9 on: September 15, 2022, 12:12:24 pm »

Just so you know ... that effect could happen automatically with a bit of CSS and a fairly simple plugin.

I imagine that the process that I carry out in Photoshop could be automated, but it seems to me that it will be too complicated for me (I don't want to abuse your generosity either  :-[).

Yesterday I implemented the new theme and I have already made some aesthetic adjustments only on the blue color. I've seen several problems, I guess related to the version of PHP;

A) With PHP 8.1: Some images are not displayed when clicking on the thumbnail (other images are  ???), I don't know why one or the other. Examples:

Displayed:
https://www.adolfoventas.es/galeria/displayimage.php?album=21&pid=301#top_display_media

Not displayed:
https://www.adolfoventas.es/galeria/displayimage.php?album=61&pid=525#top_display_media

With PHP 7.4 this problem does not happen.

B) With PHP 7.4 and also with PHP 8.1, the strip of images shows 5 photos (it comes out of the box that contains them), in other images 4 appear (which is how it should come out)

Examples:
4 Images: https://www.adolfoventas.es/galeria/displayimage.php?pid=105#top_display_media
5 Images: https://www.adolfoventas.es/galeria/displayimage.php?pid=298#top_display_media

For the rest, this new theme works well and I think I will continue with it, adapting it better to my tastes.

I don't know if the BB Control and MiniCMS plugins might be giving a problem on PHP8.1, many of the photos have BBCode in the text.

Any ideas?
Logged

ron4mac

  • Administrator
  • Coppermine addict
  • *****
  • Country: us
  • Offline Offline
  • Posts: 1908
Re: My theme doesn't work properly on PHP7.1 and higher
« Reply #10 on: September 15, 2022, 03:14:41 pm »

You can disable an individual plugin to see whether it may be causing a particular issue that you are seeing. If you identify an issue with a plugin (or theme, for that matter), you should first try to message the plugin (or theme) author to see if they are still supporting their work.

Ever since I have been involved with CPG, I have disliked the filmstrip ... especially how it was implemented. I have avoided doing work on it. I would rather see it gone from the core of CPG. It could better be implemented as a plugin for those who find value in the concept.
Logged

ron4mac

  • Administrator
  • Coppermine addict
  • *****
  • Country: us
  • Offline Offline
  • Posts: 1908
Re: My theme doesn't work properly on PHP7.1 and higher
« Reply #11 on: September 15, 2022, 03:30:47 pm »

For the rest, this new theme works well and I think I will continue with it, adapting it better to my tastes.
Monica did a nice job with her themes.

CPG 1.6 has features built in that make it easier for simple themes to do much more with their CSS. For instance .. the CSS can know which type of page it is on and not display the full banner at the top of the page for album thumbnails or intermediate images. Or don't display the full menu on some page types. I would add modifications to the CSS of that theme to take advantage of those concepts.
Logged

KchoPrro

  • Coppermine frequent poster
  • ***
  • Country: es
  • Offline Offline
  • Gender: Male
  • Posts: 266
    • Adolfo Ventas - Naturaleza Andaluza
Re: My theme doesn't work properly on PHP7.1 and higher
« Reply #12 on: September 19, 2022, 07:54:02 am »

Monica did a nice job with her themes.

CPG 1.6 has features built in that make it easier for simple themes to do much more with their CSS. For instance .. the CSS can know which type of page it is on and not display the full banner at the top of the page for album thumbnails or intermediate images. Or don't display the full menu on some page types. I would add modifications to the CSS of that theme to take advantage of those concepts.

I would like to have an advanced level of knowledge about php and css, but I am not able to do anything other than change a color, or the size of a font, font, etc. I dedicate myself to see the css code and how it affects the page and modify what I can understand. I guess with time I will learn more things :)

You can disable an individual plugin to see whether it may be causing a particular issue that you are seeing. If you identify an issue with a plugin (or theme, for that matter), you should first try to message the plugin (or theme) author to see if they are still supporting their work.

CPG does not show me the plugin manager with PHP8.1, I get the following message:

Code: [Select]
Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /galeria/plugins/minicms/configuration.php:38 Stack trace: #0 /galeria/plugins/minicms/configuration.php(38): in_array() #1 galeria /pluginmgr.php(146): include('/home/u41263082...') #2 /galeria/pluginmgr.php(725): display_plugin_list() #3 { main} thrown in /galeria/plugins/minicms/configuration.php on line 38
The only solution I see is to downgrade to PHP7.4, disable one of the plugins, upgrade back to 8.1 and see if anything has been resolved. If it is MiniCMS or BB Control, try to contact the author, but I think they are no longer operational. Perhaps you have no choice but to stick with PHP7.4

Ever since I have been involved with CPG, I have disliked the filmstrip ... especially how it was implemented. I have avoided doing work on it. I would rather see it gone from the core of CPG. It could better be implemented as a plugin for those who find value in the concept.

I totally agree with you, it would be more interesting to leave the filmstrip as a plugin for those who want to implement it. However, I like how it looks, but aesthetically it is more interesting without the filmstrip_background, for that reason I removed it from the chaoticsoul theme.

I will try to contact Monica, the truth is that her themes are very good, I hope I can buy her a more current theme that also works with php8.0
Logged

ron4mac

  • Administrator
  • Coppermine addict
  • *****
  • Country: us
  • Offline Offline
  • Posts: 1908
Re: My theme doesn't work properly on PHP7.1 and higher
« Reply #13 on: September 19, 2022, 04:28:31 pm »

CPG does not show me the plugin manager with PHP8.1, I get the following message:
Code: [Select]
Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /galeria/plugins/minicms/configuration.php:38 Stack trace: #0 /galeria/plugins/minicms/configuration.php(38): in_array() #1 galeria /pluginmgr.php(146): include('/home/u41263082...') #2 /galeria/pluginmgr.php(725): display_plugin_list() #3 { main} thrown in /galeria/plugins/minicms/configuration.php on line 38

Remove these 4 (consecutive) lines from the MiniCMS plugin configuration.php file:
Code: [Select]
$lang = isset($CONFIG['lang']) ? $CONFIG['lang'] : 'english';
include('plugins/minicms/lang/english.php');
if (in_array($lang, $enabled_languages_array) == TRUE && file_exists('plugins/minicms/lang/'.$lang.'.php')) {
    include('plugins/minicms/lang/'.$lang.'.php');
}
Logged

KchoPrro

  • Coppermine frequent poster
  • ***
  • Country: es
  • Offline Offline
  • Gender: Male
  • Posts: 266
    • Adolfo Ventas - Naturaleza Andaluza
Re: My theme doesn't work properly on PHP7.1 and higher
« Reply #14 on: September 20, 2022, 08:13:21 pm »

Remove these 4 (consecutive) lines from the MiniCMS plugin configuration.php file:
Code: [Select]
$lang = isset($CONFIG['lang']) ? $CONFIG['lang'] : 'english';
include('plugins/minicms/lang/english.php');
if (in_array($lang, $enabled_languages_array) == TRUE && file_exists('plugins/minicms/lang/'.$lang.'.php')) {
    include('plugins/minicms/lang/'.$lang.'.php');
}

Thanks! The problem has been solved. Was able to get into plugin management and disabled BBCode Control (bbcode_control): v1.12. It has been the solution, now there are no more errors. I used the plugin to add embedded links in the image description, or add a bold text. Now that I don't have the Plugin active, I notice that the links still exist and the bold or italics also appear in the description. I guess this was also an improvement from version 1.6x of CPG, before it couldn't use BBCode.

The unsolved problem is to know why there are times that 5 thumbnails appear in the intermediate image and other times 4 (the correct one is 4). This is not a CPG issue, it's a theme issue. I'll ask Monica if she has any ideas on the solution.

Thank you very much again! :)
Logged

ron4mac

  • Administrator
  • Coppermine addict
  • *****
  • Country: us
  • Offline Offline
  • Posts: 1908
Re: My theme doesn't work properly on PHP7.1 and higher
« Reply #15 on: September 20, 2022, 09:07:39 pm »

The unsolved problem is to know why there are times that 5 thumbnails appear in the intermediate image and other times 4 (the correct one is 4). This is not a CPG issue, it's a theme issue.

In the theme style.css file, at about line 1119, comment out the width spec.:
Code: [Select]
#film {
/* width: 100%!important; */
}
Somewhere in the same file, at an appropriate location, add the line:
Code: [Select]
#film .thumb {padding: 1px}
And part of the issue here does involve the way the film strip was (is) implemented in CPG.
« Last Edit: September 20, 2022, 09:14:17 pm by ron4mac »
Logged

KchoPrro

  • Coppermine frequent poster
  • ***
  • Country: es
  • Offline Offline
  • Gender: Male
  • Posts: 266
    • Adolfo Ventas - Naturaleza Andaluza
Re: My theme doesn't work properly on PHP7.1 and higher
« Reply #16 on: September 21, 2022, 08:38:42 am »

In the theme style.css file, at about line 1119, comment out the width spec.:
Code: [Select]
#film {
/* width: 100%!important; */
}
Somewhere in the same file, at an appropriate location, add the line:
Code: [Select]
#film .thumb {padding: 1px}
And part of the issue here does involve the way the film strip was (is) implemented in CPG.

Finally, the only thing that has managed to adapt has been this code;
Code: [Select]
#film {
width: 740px!important;
}

#film .thumb {padding: 5px}

I don't know if it can affect when we visit the page from a mobile or tablet, but only limiting the size in width pixels (in addition to the 5 px padding), has solved the problem:
https://www.adolfoventas.es/galeria/displayimage.php?album=10&pid=971#top_display_media


Thank you very much for the help, I would never have found this solution.

Interestingly, with the modification you gave me in the previous message and the deactivation of the BB Control Plugin, the Chaoticsoul theme now works perfectly with PHP8.1

Today I will also remove filmstrip_background and this theme will be ready, thank you very much for everything!!
Logged

KchoPrro

  • Coppermine frequent poster
  • ***
  • Country: es
  • Offline Offline
  • Gender: Male
  • Posts: 266
    • Adolfo Ventas - Naturaleza Andaluza
Re: My theme doesn't work properly on PHP7.1 and higher
« Reply #17 on: September 21, 2022, 01:03:55 pm »

Finally, the only thing that has managed to adapt has been this code;
Code: [Select]
#film {
width: 740px!important;
}

#film .thumb {padding: 5px}

I don't know if it can affect when we visit the page from a mobile or tablet, but only limiting the size in width pixels (in addition to the 5 px padding), has solved the problem:
https://www.adolfoventas.es/galeria/displayimage.php?album=10&pid=971#top_display_media


Thank you very much for the help, I would never have found this solution.

Interestingly, with the modification you gave me in the previous message and the deactivation of the BB Control Plugin, the Chaoticsoul theme now works perfectly with PHP8.1

Today I will also remove filmstrip_background and this theme will be ready, thank you very much for everything!!

I assumed that moving from a percentage measurement to pixels would affect display on other platforms. Attached a screenshot of the page viewed from a mobile.

It is not very important either, the images, in mobile view mode, did not come out correctly either. I can live without it ;)
Logged
Pages: [1]   Go Up
 

Page created in 0.031 seconds with 19 queries.