Esempio n. 1
0
     continue;
 }
 $user_id = $objAdmin->get('category' . $arrResult['category_id']);
 $objOwner = new clsUser($user_id);
 /* Create the album if we haven't already. */
 if (!isset($arrAlbums[$arrResult['category_id']])) {
     $objAlbum = new clsAlbum();
     $objAlbum->set('name', str_replace("<br />", "", html_entity_decode($arrResult['name'])));
     $objAlbum->set('caption', str_replace("<br />", "", html_entity_decode($arrResult['caption'])));
     $objAlbum->set('date', date('Y-m-d H:i:s', strtotime($arrResult['date_created']) + $i++), false);
     /* Adding '$i' here is a bit of a kludge, but it keeps dates sortable (since ospap1 didn't keep track of times). */
     $objAlbum->set('user_id', $user_id);
     $objAlbum->set('mime', 'image/jpeg');
     $objAlbum->set('max_width', '640');
     $objAlbum->set('max_height', '480');
     $objAlbum->setDefaultPolicies($objOwner);
     $objAlbum->save();
     $arrAlbums[$arrResult['category_id']] = $objAlbum;
 }
 $objAlbum = $arrAlbums[$arrResult['category_id']];
 print "Importing from '" . $objAlbum->get('name') . "'<br>";
 $i = 0;
 $pictureResult = mysql_query("SELECT * FROM pictures WHERE category_id = '" . $arrResult['category_id'] . "' ");
 while ($arrPictureResult = mysql_fetch_assoc($pictureResult)) {
     $objPicture = clsPicture::createFromFile($upload_directory . '/' . $arrPictureResult['filename'], 'image/jpeg', $objAlbum);
     $objPicture->set('user_id', $user_id);
     $objPicture->set('album_id', $objAlbum->get('id'));
     $objPicture->set('title', str_replace("<br />", "", html_entity_decode($arrPictureResult['title'])));
     $objPicture->set('caption', str_replace("<br />", "", html_entity_decode($arrPictureResult['caption'])));
     $objPicture->set('date', date('Y-m-d H:i:s', strtotime($arrPictureResult['date_added']) + $i++), false);
     $objPicture->set('confirmed', 1);