Code Duplication    Length = 5-5 lines in 6 locations

engine/classes/Elgg/Database/EntityTable.php 1 location

@@ 464-468 (lines=5) @@
461
			$query .= " ORDER BY {$options['order_by']}";
462
		}
463
464
		if ($options['limit']) {
465
			$limit = sanitise_int($options['limit'], false);
466
			$offset = sanitise_int($options['offset'], false);
467
			$query .= " LIMIT $offset, $limit";
468
		}
469
470
		if ($options['callback'] === 'entity_row_to_elggstar') {
471
			if ( isset($options['wetcustom:messages']) )

engine/lib/metastrings.php 1 location

@@ 324-328 (lines=5) @@
321
			$query .= " ORDER BY {$options['order_by']}, n_table.id";
322
		}
323
324
		if ($options['limit']) {
325
			$limit = sanitise_int($options['limit']);
326
			$offset = sanitise_int($options['offset'], false);
327
			$query .= " LIMIT $offset, $limit";
328
		}
329
330
		$dt = get_data($query, $options['callback']);
331

engine/lib/river.php 1 location

@@ 429-433 (lines=5) @@
426
		$options['order_by'] = sanitise_string($options['order_by']);
427
		$query .= " ORDER BY {$options['order_by']}";
428
429
		if ($options['limit']) {
430
			$limit = sanitise_int($options['limit']);
431
			$offset = sanitise_int($options['offset'], false);
432
			$query .= " LIMIT $offset, $limit";
433
		}
434
435
		$river_items = get_data($query, '_elgg_row_to_elgg_river_item');
436
		_elgg_prefetch_river_entities($river_items);

mod/elgg_solr/lib/functions.php 2 locations

@@ 1378-1382 (lines=5) @@
1375
			$query .= " ORDER BY {$options['order_by']}";
1376
		}
1377
1378
		if ($options['limit']) {
1379
			$limit = sanitise_int($options['limit'], false);
1380
			$offset = sanitise_int($options['offset'], false);
1381
			$query .= " LIMIT $offset, $limit";
1382
		}
1383
1384
		$dt = get_data($query);
1385
@@ 1530-1534 (lines=5) @@
1527
			$query .= " ORDER BY {$options['order_by']}";
1528
		}
1529
1530
		if ($options['limit']) {
1531
			$limit = sanitise_int($options['limit'], false);
1532
			$offset = sanitise_int($options['offset'], false);
1533
			$query .= " LIMIT $offset, $limit";
1534
		}
1535
1536
		if ($options['callback'] === 'entity_row_to_elggstar') {
1537
			$dt = _elgg_fetch_entities_from_sql($query, $options['__ElggBatch']);

mod/wet4/lib/custom_core.php 1 location

@@ 392-396 (lines=5) @@
389
		$options['order_by'] = sanitise_string($options['order_by']);
390
		$GOL .= " ORDER BY {$options['order_by']}";
391
392
		if ($options['limit']) {
393
			$limit = sanitise_int($options['limit']);
394
			$offset = sanitise_int($options['offset'], false);
395
			$GOL .= " LIMIT $offset, $limit";
396
		}
397
// custom UNION - based query
398
		$query = "SELECT u.* FROM ( ( SELECT rv.* FROM {$CONFIG->dbprefix}river rv {$join1} WHERE {$w1} {$object_access_where} ) UNION ".
399
			"( SELECT rv.* FROM {$CONFIG->dbprefix}river rv {$join2} WHERE {$w2} ($target_access_where OR te.guid IS NULL) ) ) u {$GOL}";