/** * Fetch an array of albums with no parents * * @param string $path Path to albums directory * @return array GalleryStatus a status code, * array of albumnames */ function getRootAlbums($path) { list($ret, $albumOrder) = Gallery1DataParser::loadFile($path . 'albumdb.dat'); if ($ret) { return array($ret, null); } foreach ($albumOrder as $albumName) { list($ret, $albumFields) = Gallery1DataParser::loadAlbumFields($path . $albumName . DIRECTORY_SEPARATOR); if ($ret) { return array($ret, ''); } if ($albumFields['parentAlbumName'] == '.root') { $rootAlbums[] = $albumName; } } return array(null, $rootAlbums); }
/** * Transfer over all the values from a G1 album to a G3 album. */ static function set_album_values($album, $g1_album) { $albumDir = self::$album_dir; if (substr($albumDir, -1) != DIRECTORY_SEPARATOR) { $albumDir .= DIRECTORY_SEPARATOR; } $albumDir .= $g1_album; if (substr($albumDir, -1) != DIRECTORY_SEPARATOR) { $albumDir .= DIRECTORY_SEPARATOR; } require_once 'Gallery1DataParser.php'; list($result, $fields) = Gallery1DataParser::loadAlbumFields($albumDir); $album->name = $fields['name']; $album->slug = item::convert_filename_to_slug($fields['name']); // <= verification fails if this property has not been set!!! $album->title = utf8_encode(self::_decode_html_special_chars(trim($fields['title']))); $album->title or $album->title = $album->name; $album->description = utf8_encode(self::_decode_html_special_chars(trim($fields['description']))); //$album->owner_id = self::map($g1_album->getOwnerId()); if (strlen($album->title) > 255) { if (strlen($album->description) == 0) { $album->description = $album->title; } $album->title = substr($album->title, 0, 252) . '...'; } try { $album->view_count = (int) $fields['clicks']; } catch (Exception $e) { // @todo log $album->view_count = 0; } $album->created = $fields['clicks_date']; $album->sort_column = 'weight'; //G1 was always sorted manually $album->sort_order = 'ASC'; }