Project

General

Profile

Bug #1278 » 1278.cb.core.php.patch

beat, 13 February 2010 03:14

View differences:

components/com_comprofiler/plugin/user/plug_cbcore/cb.core.php (working copy)
list( $y, $c, $d ) = sscanf( date( 'Y-m-d' ), '%d-%d-%d' );
$minValIn = (int) cbGetParam( $postdata, $minNam, 0 );
$maxValIn = (int) cbGetParam( $postdata, $maxNam, 0 );
if ( $minValIn && ( $minValIn > $yMinMin ) ) {
if ( $maxValIn && ( $maxValIn < $yMaxMax ) ) {
$yMin = $y - $maxValIn -1; // yes, crossed: the more years back, the smaller the date... add 1 year for searches from 24 to 24 (INCLUDED)
$minVal = sprintf( '%04d-%02d-%02d', $yMin, $c, $d );
} else {
$minVal = null;
}
if ( $maxValIn && ( $maxValIn < $yMaxMax ) ) {
if ( $minValIn && ( $minValIn > $yMinMin ) ) {
$yMax = $y - $minValIn;
$maxVal = sprintf( '%04d-%02d-%02d', $yMax, $c, $d );
} else {
......
}
if ( $minVal && ( $minVal !== '0000-00-00' ) ) {
$searchVals->$minNam = $minValIn;
$query[] = $this->_dateToSql( $field, $col, $minVal, '>=', $searchMode );
}
if ( $maxVal && ( $maxVal !== '0000-00-00' ) ) {
$searchVals->$maxNam = $maxValIn;
$query[] = $this->_dateToSql( $field, $col, $maxVal, '<=', $searchMode );
if ( ( ! ( $minVal && ( $minVal !== '0000-00-00' ) ) ) && ( ! in_array( $field->name, array( 'lastupdatedate', 'lastvisitDate' ) ) ) ) {
$query[] = $this->_dateToSql( $field, $col, '0000-00-00', '>', $searchMode );
}
}
// Finally store the selected drop-down values so they can be pre-selected on display:
$searchVals->$minNam = $minValIn;
$searchVals->$maxNam = $maxValIn;
}
}
return $query;
(2-2/2)