https://www.icyphoenix.com/viewtopic.php?f=26&t=1289&p=9909#p9909
-----------------------------------
Mighty Gorgon
Sun 11 Mar, 2007 14:14

Re: [MOD] FAP Copy
-----------------------------------
Greaaaaaaaaaat! :mri:

I told you that becoming a developer would have been the next step! :icy_lol_flag:

I've modified a couple of things, fixed a bug and added this to FAP! :mri:

About the bug...

[codeblock]			for ($i = 0; $i <count($picrow); $i++)
			{
				// Though each cat entry would work off of the same pic_filename
				// we need an actual copy of the pic with a different filename in case of deletetions
				$pic_filename = $picrow[$i]['pic_filename'];
				$file_split = explode('.', $pic_filename);
				$pic_extension = $file_split[sizeof($file_split) - 1];
				$pic_filename = substr($pic_filename, 0, strlen($pic_filename) - strlen($pic_extension) -1);
				$pic_thumbnail = ($album_config['gd_version'] == 0) ? $pic_filename . '.' . $pic_extension : '';

				while (file_exists(ALBUM_UPLOAD_PATH . $pic_filename . '.' . $pic_extension))
				{
					$pic_filename = $pic_filename . '_' . time() . '_' . mt_rand(100000, 999999);
				}

				if (!copy(ALBUM_UPLOAD_PATH . $picrow[$i]['pic_filename'], ALBUM_UPLOAD_PATH . $pic_filename . '.' . $pic_extension))
				{
					message_die(GENERAL_ERROR, 'Could not copy image');
				}

				$pic_title = addslashes($picrow[$i]['pic_title']);
				$pic_desc = addslashes($picrow[$i]['pic_title']);
				$pic_time = time() + $i; // Gives each pic a different timestamp

				$sql = "INSERT INTO " . ALBUM_TABLE . " (pic_filename, pic_thumbnail, pic_title, pic_desc, pic_user_id, pic_user_ip, pic_username, pic_time, pic_cat_id, pic_approval)
				VALUES ('" . $pic_filename . '.' . $pic_extension . "', '$pic_thumbnail', '$pic_title', '$pic_desc', '".$picrow[$i]['pic_user_id']."', '".$picrow[$i]['pic_user_ip']."', '".$picrow[$i]['pic_username']."', '$pic_time', '".intval($_POST['target'])."', '".$picrow[$i]['pic_approval']."')";

				if( !$result = $db->sql_query($sql) )
				{
					message_die(GENERAL_ERROR, 'Could not update album information', '', __LINE__, __FILE__, $sql);
				}
			}[/codeblock]


Thanks for your job once again. :mri:


