Projet

Général

Profil

Révision 6f57d8c7

Ajouté par Assos Assos il y a environ 9 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/views/handlers/views_handler_filter_date.inc
158 158
  }
159 159

  
160 160
  function op_between($field) {
161
    $a = intval(strtotime($this->value['min'], 0));
162
    $b = intval(strtotime($this->value['max'], 0));
161
    // Use the substitutions to ensure a consistent timestamp.
162
    $query_substitutions = views_views_query_substitutions($this->view);
163
    $a = intval(strtotime($this->value['min'], $query_substitutions['***CURRENT_TIME***']));
164
    $b = intval(strtotime($this->value['max'], $query_substitutions['***CURRENT_TIME***']));
163 165

  
164
    if ($this->value['type'] == 'offset') {
165
      $a = '***CURRENT_TIME***' . sprintf('%+d', $a); // keep sign
166
      $b = '***CURRENT_TIME***' . sprintf('%+d', $b); // keep sign
167
    }
168 166
    // This is safe because we are manually scrubbing the values.
169 167
    // It is necessary to do it this way because $a and $b are formulas when using an offset.
170 168
    $operator = strtoupper($this->operator);
......
172 170
  }
173 171

  
174 172
  function op_simple($field) {
175
    $value = intval(strtotime($this->value['value'], 0));
176
    if (!empty($this->value['type']) && $this->value['type'] == 'offset') {
177
      $value = '***CURRENT_TIME***' . sprintf('%+d', $value); // keep sign
178
    }
173
    // Use the substitutions to ensure a consistent timestamp.
174
    $query_substitutions = views_views_query_substitutions($this->view);
175
    $value = intval(strtotime($this->value['value'], $query_substitutions['***CURRENT_TIME***']));
176

  
179 177
    // This is safe because we are manually scrubbing the value.
180 178
    // It is necessary to do it this way because $value is a formula when using an offset.
181 179
    $this->query->add_where_expression($this->options['group'], "$field $this->operator $value");

Formats disponibles : Unified diff