- list ( $from, $contsortkey ) = $cont;
- if ( intval( $from ) == 0 ) {
- $this->dieUsage( 'Invalid continue param. You should pass the original value returned '.
- 'by the previous query', '_badcontinue'
- );
- }
- $where_outer = array();
- $where_inner = array();
- $db = $this->getDB();
- $op = ( $dir === 'newer' ? '>' : '<' );
- $sortdir = ( $dir === 'newer' ? 'asc' : 'desc' );
- $where_outer[] = 'cl_sortkey ' . $op . ' ' .
- $db->addQuotes( $contsortkey );
- // OR
- $where_inner[] = 'cl_sortkey = ' .
- $db->addQuotes( $contsortkey );
- // AND
- $where_inner[] = 'cl_from ' . $op . '= '. $from;
-
- $where_outer[] = $db->makeList( $where_inner, LIST_AND );
- $this->addWhere( $db->makeList( $where_outer, LIST_OR ) );
- $this->addOption( 'ORDER BY',
- 'cl_sortkey ' . $sortdir .', cl_from ' . $sortdir );
+ $escType = $this->getDB()->addQuotes( $cont[0] );
+ $from = intval( $cont[1] );
+ $escSortkey = $this->getDB()->addQuotes( $cont[2] );
+ $op = $dir == 'newer' ? '>' : '<';
+ $this->addWhere( "cl_type $op $escType OR " .
+ "(cl_type = $escType AND " .
+ "(cl_sortkey $op $escSortkey OR " .
+ "(cl_sortkey = $escSortkey AND " .
+ "cl_from $op= $from)))"
+ );