Code Duplication    Length = 8-8 lines in 2 locations

action.php 2 locations

@@ 133-140 (lines=8) @@
130
	header('Location: admin_media.php?files=unused');
131
	break;
132
133
case 'create-note-object':
134
	// Create a note, and return parameters needed by Select2
135
	header('Content-type: application/json');
136
	$note        = Filter::post('note');
137
	$gedcom      = "0 @new@ NOTE " . str_replace("\n", "\n1 CONT ", $note);
138
	$note_object = $WT_TREE->createRecord($gedcom);
139
	echo json_encode(['id' => $note_object->getXref(), 'text' => View::make('selects/note', ['note' => $note_object])]);
140
	break;
141
142
case 'create-repository':
143
	// Create a repository, and return parameters needed by Select2
@@ 142-149 (lines=8) @@
139
	echo json_encode(['id' => $note_object->getXref(), 'text' => View::make('selects/note', ['note' => $note_object])]);
140
	break;
141
142
case 'create-repository':
143
	// Create a repository, and return parameters needed by Select2
144
	header('Content-type: application/json');
145
	$repository_name = Filter::post('repository_name');
146
	$gedcom          = "0 @new@ REPO\n1 NAME " . $repository_name;
147
	$repository      = $WT_TREE->createRecord($gedcom);
148
	echo json_encode(['id' => $repository->getXref(), 'text' => View::make('selects/repository', ['repository' => $repository])]);
149
	break;
150
151
case 'create-source':
152
	// Create a source, and return parameters needed by Select2