/** * @dataProvider user_update_images_data */ public function test_user_update_images($user_id, $entry_exists, $update, $expected_values) { $db = $this->new_dbal(); $user = new phpbb_gallery_user($db, $user_id); $this->assertEquals($entry_exists, $user->entry_exists); $this->assertEquals(true, $user->update_images($update)); $fetch_user = new phpbb_gallery_user($db, $user_id); foreach ($expected_values as $key => $value) { $this->assertEquals($value, $user->get_data($key)); $this->assertEquals($value, $fetch_user->get_data($key)); } $this->assertEquals(true, $user->entry_exists); $this->assertEquals(true, $fetch_user->entry_exists); }
$image_name = request_var('image_name', '', true); if (empty($image_name)) { trigger_error('MISSING_IMAGE_NAME'); } $message_parser = new parse_message(); $message_parser->message = utf8_normalize_nfc($image_desc); if ($message_parser->message) { $message_parser->parse(true, true, true, true, false, true, true, true); } $sql_ary = array('image_name' => $image_name, 'image_name_clean' => utf8_clean_string($image_name), 'image_desc' => $message_parser->message, 'image_desc_uid' => $message_parser->bbcode_uid, 'image_desc_bitfield' => $message_parser->bbcode_bitfield); $move_to_personal = request_var('move_to_personal', 0); if ($move_to_personal) { $personal_album_id = 0; if ($user->data['user_id'] != $image_data['image_user_id']) { $image_user = new phpbb_gallery_user($db, $image_data['image_user_id']); $personal_album_id = $image_user->get_data('personal_album_id'); // The User has no personal album, moderators can created that without the need of permissions if (!$personal_album_id) { $personal_album_id = phpbb_gallery_album::generate_personal_album($image_data['image_username'], $image_data['image_user_id'], $image_data['image_user_colour'], $image_user); } } else { $personal_album_id = phpbb_gallery::$user->get_data('personal_album_id'); if (!$personal_album_id && phpbb_gallery::$auth->acl_check('i_upload', phpbb_gallery_auth::OWN_ALBUM)) { $personal_album_id = phpbb_gallery_album::generate_personal_album($image_data['image_username'], $image_data['image_user_id'], $image_data['image_user_colour'], phpbb_gallery::$user); } } if ($personal_album_id) { $sql_ary['image_album_id'] = $personal_album_id; } } else { if ($album_data['album_last_image_id'] == $image_id) {