forked from Public/pics
		
	Import photo ownership.
This commit is contained in:
		
							parent
							
								
									2f86231e61
								
							
						
					
					
						commit
						2c4277790b
					
				
							
								
								
									
										1
									
								
								TODO.md
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								TODO.md
									
									
									
									
									
								
							@ -1,7 +1,6 @@
 | 
				
			|||||||
TODO:
 | 
					TODO:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* Draaiing van foto's bij importeren goedzetten
 | 
					* Draaiing van foto's bij importeren goedzetten
 | 
				
			||||||
* Import asset ownership
 | 
					 | 
				
			||||||
* Pagina om één foto te bekijken
 | 
					* Pagina om één foto te bekijken
 | 
				
			||||||
* Taggen door gebruikers
 | 
					* Taggen door gebruikers
 | 
				
			||||||
* Uploaden door gebruikers
 | 
					* Uploaden door gebruikers
 | 
				
			||||||
 | 
				
			|||||||
@ -155,7 +155,7 @@ for ($i = 0; $i < $num_photos; $i += 50)
 | 
				
			|||||||
	echo 'Offset ' . $i . "...\n";
 | 
						echo 'Offset ' . $i . "...\n";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$photos = $pdb->query('
 | 
						$photos = $pdb->query('
 | 
				
			||||||
		SELECT id, parent_id, captured, created, name, title, description, relative_url_cache, width, height, mime_type, weight
 | 
							SELECT id, owner_id, parent_id, captured, created, name, title, description, relative_url_cache, width, height, mime_type, weight
 | 
				
			||||||
		FROM items
 | 
							FROM items
 | 
				
			||||||
		WHERE type = {string:photo}
 | 
							WHERE type = {string:photo}
 | 
				
			||||||
		ORDER BY id ASC
 | 
							ORDER BY id ASC
 | 
				
			||||||
@ -166,13 +166,14 @@ for ($i = 0; $i < $num_photos; $i += 50)
 | 
				
			|||||||
	{
 | 
						{
 | 
				
			||||||
		$res = $db->query('
 | 
							$res = $db->query('
 | 
				
			||||||
			INSERT INTO assets
 | 
								INSERT INTO assets
 | 
				
			||||||
			(subdir, filename, title, slug, mimetype, image_width, image_height, date_captured, priority)
 | 
								(id_user_uploaded, subdir, filename, title, slug, mimetype, image_width, image_height, date_captured, priority)
 | 
				
			||||||
			VALUES
 | 
								VALUES
 | 
				
			||||||
			({string:subdir}, {string:filename}, {string:title}, {string:slug}, {string:mimetype},
 | 
								({int:id_user_uploaded}, {string:subdir}, {string:filename}, {string:title}, {string:slug}, {string:mimetype},
 | 
				
			||||||
			 {int:image_width}, {int:image_height},
 | 
								 {int:image_width}, {int:image_height},
 | 
				
			||||||
			 IF({int:date_captured} > 0, FROM_UNIXTIME({int:date_captured}), NULL),
 | 
								 IF({int:date_captured} > 0, FROM_UNIXTIME({int:date_captured}), NULL),
 | 
				
			||||||
			 {int:priority})',
 | 
								 {int:priority})',
 | 
				
			||||||
			[
 | 
								[
 | 
				
			||||||
 | 
									'id_user_uploaded' => $old_user_id_to_new_user_id[$photo['owner_id']],
 | 
				
			||||||
				'subdir' => $dirnames_by_old_album_id[$photo['parent_id']],
 | 
									'subdir' => $dirnames_by_old_album_id[$photo['parent_id']],
 | 
				
			||||||
				'filename' => $photo['name'],
 | 
									'filename' => $photo['name'],
 | 
				
			||||||
				'title' => $photo['title'],
 | 
									'title' => $photo['title'],
 | 
				
			||||||
 | 
				
			|||||||
@ -9,6 +9,7 @@
 | 
				
			|||||||
class Asset
 | 
					class Asset
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	protected $id_asset;
 | 
						protected $id_asset;
 | 
				
			||||||
 | 
						protected $id_user_uploaded;
 | 
				
			||||||
	protected $subdir;
 | 
						protected $subdir;
 | 
				
			||||||
	protected $filename;
 | 
						protected $filename;
 | 
				
			||||||
	protected $title;
 | 
						protected $title;
 | 
				
			||||||
@ -186,13 +187,14 @@ class Asset
 | 
				
			|||||||
		$db = Registry::get('db');
 | 
							$db = Registry::get('db');
 | 
				
			||||||
		$res = $db->query('
 | 
							$res = $db->query('
 | 
				
			||||||
			INSERT INTO assets
 | 
								INSERT INTO assets
 | 
				
			||||||
			(subdir, filename, title, slug, mimetype, image_width, image_height, date_captured, priority)
 | 
								(id_user_uploaded, subdir, filename, title, slug, mimetype, image_width, image_height, date_captured, priority)
 | 
				
			||||||
			VALUES
 | 
								VALUES
 | 
				
			||||||
			({string:subdir}, {string:filename}, {string:title}, {string:slug}, {string:mimetype},
 | 
								({int:id_user_uploaded}, {string:subdir}, {string:filename}, {string:title}, {string:slug}, {string:mimetype},
 | 
				
			||||||
			 {int:image_width}, {int:image_height},
 | 
								 {int:image_width}, {int:image_height},
 | 
				
			||||||
			 IF({int:date_captured} > 0, FROM_UNIXTIME({int:date_captured}), NULL),
 | 
								 IF({int:date_captured} > 0, FROM_UNIXTIME({int:date_captured}), NULL),
 | 
				
			||||||
			 {int:priority})',
 | 
								 {int:priority})',
 | 
				
			||||||
			[
 | 
								[
 | 
				
			||||||
 | 
									'id_user_uploaded' => isset($id_user) ? $id_user : Registry::get('user')->getUserId(),
 | 
				
			||||||
				'subdir' => $preferred_subdir,
 | 
									'subdir' => $preferred_subdir,
 | 
				
			||||||
				'filename' => $new_filename,
 | 
									'filename' => $new_filename,
 | 
				
			||||||
				'title' => $title,
 | 
									'title' => $title,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user