00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00036 class Album_gallery extends Album
00037 {
00043 function loadData($dir)
00044 {
00045
00046 global $settings;
00047
00048 require_once ($settings->attribute("gallery_location")."/classes/Image.php");
00049 require_once ($settings->attribute("gallery_location")."/classes/AlbumItem.php");
00050
00051 $albumsrc = $dir."/album.dat";
00052 $photosrc = $dir."/photos.dat";
00053
00054 if (!file_exists($albumsrc) || !file_exists($photosrc))
00055 {
00056 return;
00057 }
00058
00059
00060 ob_start();
00061 readfile($albumsrc);
00062 $aser = ob_get_contents();
00063 ob_end_clean();
00064
00065 ob_start();
00066 readfile($photosrc);
00067 $pser = ob_get_contents();
00068 ob_end_clean();
00069
00070 $data = unserialize($aser);
00071 $photos = unserialize($pser);
00072
00073
00074 if ($data->version != 10)
00075 {
00076 return;
00077 }
00078
00079 $this->id = $data->fields['name'];
00080 $this->attributes['title'] = $data->fields['title'];
00081 $this->attributes['description'] = $data->fields['description'];
00082 $this->attributes['visited'] = $data->fields['clicks_date'].":".$data->fields['clicks'];
00083 $this->attributes['comments'] = "gallery://$dir";
00084
00085
00086 for ($p = 0; $p < count($photos); $p++)
00087 {
00088
00089 if ($photos[$p]->version != 10)
00090 {
00091 continue;
00092 }
00093 $tmp = $photos[$p]->image;
00094 if ($tmp->name != null)
00095 {
00096 if (!is_null($tmp->resizedName))
00097 {
00098 $this->photos[] = $tmp->resizedName.".".$tmp->type;
00099 }
00100 else
00101 {
00102 $this->photos[] = $tmp->name.".".$tmp->type;
00103 }
00104 $this->thumbnails[] = $tmp->name.".thumb.".$tmp->type;
00105 $this->captions[] = $photos[$p]->caption;
00106 $this->visited[] = $photos[$p]->uploadDate.":".$photos[$p]->clicks;
00107 }
00108 }
00109
00110
00111 foreach ($photos as $photo)
00112 {
00113 if ($photo->highlight)
00114 {
00115 $this->attributes['logo'] = $photo->highlightImage->name.".".$photo->highlightImage->type;
00116 break;
00117 }
00118 }
00119 }
00120 }
00121 ?>