Code Duplication    Length = 5-5 lines in 8 locations

mod/gc_mobile_api/models/discussion.php 1 location

@@ 133-137 (lines=5) @@
130
			$params['owner_guid'] = $user_entity->guid;
131
		}
132
133
		if ($filter_data->name) {
134
			$db_prefix = elgg_get_config('dbprefix');
135
			$params['joins'] = array("JOIN {$db_prefix}objects_entity oe ON e.guid = oe.guid");
136
			$params['wheres'] = array("(oe.title LIKE '%" . $filter_data->name . "%' OR oe.description LIKE '%" . $filter_data->name . "%')");
137
		}
138
139
		if ($filter_data->mine) {
140
			$all_discussions = elgg_list_entities_from_relationship($params);

mod/gc_mobile_api/models/doc.php 1 location

@@ 112-116 (lines=5) @@
109
			'offset' => $offset
110
		);
111
112
		if ($filter_data->name) {
113
			$db_prefix = elgg_get_config('dbprefix');
114
			$params['joins'] = array("JOIN {$db_prefix}objects_entity oe ON e.guid = oe.guid");
115
			$params['wheres'] = array("(oe.title LIKE '%" . $filter_data->name . "%' OR oe.description LIKE '%" . $filter_data->name . "%')");
116
		}
117
118
		$all_docs = elgg_list_entities_from_metadata($params);
119
	} else {

mod/gc_mobile_api/models/group.php 1 location

@@ 339-343 (lines=5) @@
336
			$params['inverse_relationship'] = false;
337
		}
338
339
		if ($filter_data->name) {
340
			$db_prefix = elgg_get_config('dbprefix');
341
			$params['joins'] = array("JOIN {$db_prefix}groups_entity ge ON e.guid = ge.guid");
342
			$params['wheres'] = array("(ge.name LIKE '%" . $filter_data->name . "%' OR ge.description LIKE '%" . $filter_data->name . "%')");
343
		}
344
345
		if ($filter_data->mine) {
346
			$all_groups = elgg_list_entities_from_relationship($params);

mod/gc_mobile_api/models/members.php 2 locations

@@ 65-69 (lines=5) @@
62
			$params['metadata_name'] = 'user_type';
63
			$params['metadata_value'] = $filter_data->type;
64
		}
65
		if ($filter_data->name) {
66
			$db_prefix = elgg_get_config('dbprefix');
67
			$params['joins'] = array("JOIN {$db_prefix}users_entity ue ON e.guid = ue.guid");
68
			$params['wheres'] = array("(ue.username LIKE '%" . $filter_data->name . "%' OR ue.name LIKE '%" . $filter_data->name . "%')");
69
		}
70
71
		$members = elgg_get_entities_from_metadata($params);
72
	} else {
@@ 136-140 (lines=5) @@
133
			$vars['metadata_name'] = 'user_type';
134
			$vars['metadata_value'] = $filter_data->type;
135
		}
136
		if ($filter_data->name) {
137
			$db_prefix = elgg_get_config('dbprefix');
138
			$vars['joins'] = array("JOIN {$db_prefix}users_entity ue ON e.guid = ue.guid");
139
			$vars['wheres'] = array("(ue.username LIKE '%" . $filter_data->name . "%' OR ue.name LIKE '%" . $filter_data->name . "%')");
140
		}
141
	}
142
143
	$options = array_merge($defaults, $vars);

mod/gccollab_theme/views/default/forms/uservalidationbyemail/bulk_action.php 1 location

@@ 82-86 (lines=5) @@
79
	'count' => TRUE,
80
);
81
82
if( $name != "" ){
83
	$db_prefix = elgg_get_config('dbprefix');
84
	$options['joins'] = array("JOIN {$db_prefix}users_entity ue ON e.guid = ue.guid");
85
	$options['wheres'] = array_merge($wheres, array("(ue.username LIKE '%" . $name . "%' OR ue.name LIKE '%" . $name . "%')"));
86
}
87
$count = elgg_get_entities($options);
88
89
if (!$count) {

mod/gc_mobile_api/models/opportunity.php 1 location

@@ 257-261 (lines=5) @@
254
			$params['metadata_value'] = $filter_data->type;
255
		}
256
257
		if ($filter_data->name) {
258
			$db_prefix = elgg_get_config('dbprefix');
259
			$params['joins'] = array("JOIN {$db_prefix}objects_entity oe ON e.guid = oe.guid");
260
			$params['wheres'] = array("(oe.title LIKE '%" . $filter_data->name . "%' OR oe.description LIKE '%" . $filter_data->name . "%')");
261
		}
262
263
		if ($filter_data->mine) {
264
			$all_opportunities = elgg_list_entities_from_relationship($params);

mod/gc_mobile_api/models/blog.php 1 location

@@ 215-219 (lines=5) @@
212
			'offset' => $offset
213
		);
214
215
		if ($filter_data->name) {
216
			$db_prefix = elgg_get_config('dbprefix');
217
			$params['joins'] = array("JOIN {$db_prefix}objects_entity oe ON e.guid = oe.guid");
218
			$params['wheres'] = array("(oe.title LIKE '%" . $filter_data->name . "%' OR oe.description LIKE '%" . $filter_data->name . "%')");
219
		}
220
221
		$all_blog_posts = elgg_list_entities_from_metadata($params);
222
	} else {