Code Duplication    Length = 15-16 lines in 2 locations

includes/api/ApiQueryFilearchive.php 1 location

@@ 81-95 (lines=15) @@
78
		$this->addFieldsIf( 'fa_bits', $fld_bitdepth );
79
		$this->addFieldsIf( 'fa_archive_name', $fld_archivename );
80
81
		if ( !is_null( $params['continue'] ) ) {
82
			$cont = explode( '|', $params['continue'] );
83
			$this->dieContinueUsageIf( count( $cont ) != 3 );
84
			$op = $params['dir'] == 'descending' ? '<' : '>';
85
			$cont_from = $db->addQuotes( $cont[0] );
86
			$cont_timestamp = $db->addQuotes( $db->timestamp( $cont[1] ) );
87
			$cont_id = (int)$cont[2];
88
			$this->dieContinueUsageIf( $cont[2] !== (string)$cont_id );
89
			$this->addWhere( "fa_name $op $cont_from OR " .
90
				"(fa_name = $cont_from AND " .
91
				"(fa_timestamp $op $cont_timestamp OR " .
92
				"(fa_timestamp = $cont_timestamp AND " .
93
				"fa_id $op= $cont_id )))"
94
			);
95
		}
96
97
		// Image filters
98
		$dir = ( $params['dir'] == 'descending' ? 'older' : 'newer' );

includes/api/ApiQueryProtectedTitles.php 1 location

@@ 70-85 (lines=16) @@
67
		$this->addWhereRange( 'pt_namespace', $params['dir'], null, null );
68
		$this->addWhereRange( 'pt_title', $params['dir'], null, null );
69
70
		if ( !is_null( $params['continue'] ) ) {
71
			$cont = explode( '|', $params['continue'] );
72
			$this->dieContinueUsageIf( count( $cont ) != 3 );
73
			$op = ( $params['dir'] === 'newer' ? '>' : '<' );
74
			$db = $this->getDB();
75
			$continueTimestamp = $db->addQuotes( $db->timestamp( $cont[0] ) );
76
			$continueNs = (int)$cont[1];
77
			$this->dieContinueUsageIf( $continueNs != $cont[1] );
78
			$continueTitle = $db->addQuotes( $cont[2] );
79
			$this->addWhere( "pt_timestamp $op $continueTimestamp OR " .
80
				"(pt_timestamp = $continueTimestamp AND " .
81
				"(pt_namespace $op $continueNs OR " .
82
				"(pt_namespace = $continueNs AND " .
83
				"pt_title $op= $continueTitle)))"
84
			);
85
		}
86
87
		if ( isset( $prop['user'] ) ) {
88
			$this->addTables( 'user' );