moved from windows to linux - Album::loadFromFile() fix

mstr

Joined: 2004-06-29
Posts: 3
Posted: Tue, 2004-06-29 10:13

After I've moved to windows, all galleries were reported broken.
I just fixed Album::loadFromFile() to handle this:

// $Id: Album.php,v 1.164 2004/03/22 22:58:27 cryptographite Exp $
    689         function loadFromFile($filename) {
    690         $tmp = getFile($filename);
    691         $tmp = str_replace("\n", '', $tmp); // <- That's new
    692         $tmp = unserialize($tmp);
    693         if (strcasecmp(get_class($tmp), "album")) {
    694             /* Dunno what we unserialized .. but it wasn't an album! */
    695                 $tmp = unserialize(getFile($filename, true));
    696             if (strcasecmp(get_class($tmp), "album")) {
    697                 return 0;
    698             }
    699         }
    700
    701         foreach ($tmp as $k => $v) {
    702             $this->$k = $v;
    703         }
    704         return 1;
    705     }