Author Topic: Install of 1.8 failed - undefined function safe_htmlspecialchars()  (Read 3618 times)

0 Members and 1 Guest are viewing this topic.

Offline Ebby

  • Pre-Newbie
  • Posts: 2
    • View Profile
I'm trying to install a fresh copy of 1.8 on Ubuntu 16.10.

Apache/2.4.18 (Ubuntu) OpenSSL/1.0.2g
PHP Version 7.0.8-3ubuntu3
MySQL Version 5.7.16

Install Error:
PHP Fatal error: Uncaught Error: Call to undefined function safe_htmlspecialchars() in /var/www/html/4images/includes/db_myssqli.php:73
Stack trace:
#0 /var/www/html/4images/install.php(253): Db->query('CREATE TABLE ca...')
#1 {main} thrown in /var/html/4images/includes/db_mysqli.php on line 73

Stating the obvious, the safe_htmlspecialchars() function that is defined in functions.php and included by global.php is not working in the mysqli class Db.  I have no idea why it doesn't think it's defined.  PHP 7 thing with a class?

Offline qBass17

  • Addicted member
  • ******
  • Posts: 1.798
  • I ♥ 4I
    • View Profile
Re: Install of 1.8 failed - undefined function safe_htmlspecialchars()
« Reply #1 on: August 23, 2019, 11:25:06 AM »
4images is dead...

But....

search in install.php
function addslashes_array($array) {
  foreach (
$array as $key => $val) {
    
$array[$key] = (is_array($val)) ? addslashes_array($val) : addslashes($val);
  }
  return 
$array;
}


add after

function safe_htmlspecialchars($chars) {
  
// Translate all non-unicode entities
  
$chars preg_replace(
    
'/&(?!(#[0-9]+|[a-z]+);)/si',
    
'&',
    
$chars
  
);

  
$chars str_replace(">"">",   $chars);
  
$chars str_replace("<""&lt;",   $chars);
  
$chars str_replace('"'"&quot;"$chars);
  return 
$chars;
}


LG

Offline bigwave

  • Newbie
  • *
  • Posts: 36
  • stuck on the North Shore of Maui
    • View Profile
    • Maui Tropica
Re: Install of 1.8 failed - undefined function safe_htmlspecialchars()
« Reply #2 on: March 07, 2021, 10:32:26 PM »
Hi,

Installed 1.8 successfully with no changes.  Unfortunately some mods don't work which is to be expected.

Am hoping interest picks up by the brilliant coders who originally made it work!!!

Cheers,

Brian

Offline nobby

  • 4images Guru
  • *******
  • Posts: 2.872
    • View Profile
Re: Install of 1.8 failed - undefined function safe_htmlspecialchars()
« Reply #3 on: March 08, 2021, 01:25:09 PM »
Hello,

Nothing happens here in the forum anymore, everyone has withdrawn.

nobby

Offline bigwave

  • Newbie
  • *
  • Posts: 36
  • stuck on the North Shore of Maui
    • View Profile
    • Maui Tropica
Re: Install of 1.8 failed - undefined function safe_htmlspecialchars()
« Reply #4 on: March 14, 2021, 07:11:37 PM »
Hello Nobby,

Please checkout Vierstra's work here:
https://www.4homepages.de/forum/index.php?topic=33101.msg168315#msg168315

This is a brilliant approach which could keep the 4images gallery system working way into the future!!!

No need to reload your images and your hits etc. persist after "sideloading" his template system.

I checked out your alternative to 4images but it looked like too much work migrating over to there - I could always move to WordPress but again, too much work, and WordPress just lacks soul.

Jump in here and I bet you're just as impressed as I am!!!

Brian

 

Post your comments here