Beispiel #1
0
function awpcp_get_extra_fields_by_category($category, $args = array())
{
    $condition = "( field_category LIKE '%%\"%d\"%%' OR field_category = 'a:0:{}' OR field_category = '' )";
    $conditions = awpcp_get_extra_fields_conditions($args);
    $conditions[] = sprintf($condition, absint($category));
    return awpcp_get_extra_fields('WHERE ' . join(' AND ', $conditions));
}
 public function get_posted_data($data = array(), $context = false)
 {
     if ($context == 'search') {
         $conditions = awpcp_get_extra_fields_conditions(array('hide_private' => true, 'context' => 'search'));
         $fields = awpcp_get_extra_fields('WHERE ' . join(' AND ', $conditions));
         $data['keywordphrase'] = stripslashes(awpcp_request_param('keywordphrase', null));
         foreach ($fields as $field) {
             $field_slug = "awpcp-{$field->field_name}";
             if (isset($_REQUEST["awpcp-{$field->field_name}-min"])) {
                 $min = $this->parse_field_posted_data($field, awpcp_request_param("awpcp-{$field->field_name}-min", null));
                 $max = $this->parse_field_posted_data($field, awpcp_request_param("awpcp-{$field->field_name}-max", null));
                 if (!is_null($min) || !is_null($max)) {
                     $data[$field_slug] = array('min' => $min, 'max' => $max);
                 }
             } else {
                 if (isset($_REQUEST["awpcp-{$field->field_name}-from"])) {
                     $from_date = $this->parse_field_posted_data($field, awpcp_request_param("awpcp-{$field->field_name}-from", null));
                     $to_date = $this->parse_field_posted_data($field, awpcp_request_param("awpcp-{$field->field_name}-to", null));
                     if (!is_null($from_date) || !is_null($to_date)) {
                         $data[$field_slug] = array('from_date' => $from_date, 'to_date' => $to_date);
                     }
                 } else {
                     $data[$field_slug] = $this->parse_field_posted_data($field, awpcp_request_param($field_slug, null));
                 }
             }
         }
     }
     return $data;
 }
 private function get_fields()
 {
     $conditions = awpcp_get_extra_fields_conditions(array('hide_private' => true, 'context' => 'search'));
     return awpcp_get_extra_fields('WHERE ' . join(' AND ', $conditions));
 }