Code Duplication    Length = 5-5 lines in 8 locations

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/discussion.php 1 location

@@ 166-170 (lines=5) @@
163
			$params['owner_guid'] = $user_entity->guid;
164
		}
165
166
		if ($filter_data->name) {
167
			$db_prefix = elgg_get_config('dbprefix');
168
			$params['joins'] = array("JOIN {$db_prefix}objects_entity oe ON e.guid = oe.guid");
169
			$params['wheres'] = array("(oe.title LIKE '%" . $filter_data->name . "%' OR oe.description LIKE '%" . $filter_data->name . "%')");
170
		}
171
172
		if ($filter_data->mine) {
173
			$all_discussions = elgg_list_entities_from_relationship($params);

mod/gc_mobile_api/models/blog.php 1 location

@@ 230-234 (lines=5) @@
227
			'offset' => $offset
228
		);
229
230
		if ($filter_data->name) {
231
			$db_prefix = elgg_get_config('dbprefix');
232
			$params['joins'] = array("JOIN {$db_prefix}objects_entity oe ON e.guid = oe.guid");
233
			$params['wheres'] = array("(oe.title LIKE '%" . $filter_data->name . "%' OR oe.description LIKE '%" . $filter_data->name . "%')");
234
		}
235
236
		$all_blog_posts = elgg_list_entities_from_metadata($params);
237
	} else {

mod/gc_mobile_api/models/opportunity.php 1 location

@@ 312-316 (lines=5) @@
309
			$params['metadata_value'] = $filter_data->type;
310
		}
311
312
		if ($filter_data->name) {
313
			$db_prefix = elgg_get_config('dbprefix');
314
			$params['joins'] = array("JOIN {$db_prefix}objects_entity oe ON e.guid = oe.guid");
315
			$params['wheres'] = array("(oe.title LIKE '%" . $filter_data->name . "%' OR oe.description LIKE '%" . $filter_data->name . "%')");
316
		}
317
318
		if ($filter_data->mine) {
319
			$all_opportunities = elgg_list_entities_from_relationship($params);