Exemplo n.º 1
0
 protected function _get_query_condition($key, $value)
 {
     if ($key == 'handler') {
         return "b.handler_id = " . ($value ? User::get_mantis_id_from_url($value) : 0);
     } elseif ($key == 'reporter') {
         return "b.reporter_id = " . User::get_mantis_id_from_url($value);
     } elseif ($key == 'duplicate') {
         return "b.duplicate_id = " . Bug::get_mantis_id_from_url($value);
     } elseif (in_array($key, array('priority', 'severity', 'reproducibility', 'status', 'resolution', 'projection', 'eta'))) {
         return "b.{$key} = " . get_string_to_enum(config_get($key . "_enum_string"), $value);
     } elseif ($key == "project_id") {
         return "b.project_id = " . (int) $value;
     }
     return NULL;
 }
Exemplo n.º 2
0
 protected function _get_mantis_attr($attr_name)
 {
     if ($attr_name == 'bug_id') {
         return Bug::get_mantis_id_from_url($this->rsrc_data['bug']);
     } elseif ($attr_name == 'reporter_id') {
         return User::get_mantis_id_from_url($this->rsrc_data['reporter']);
     } elseif ($attr_name == 'view_state') {
         return $this->rsrc_data['private'] ? VS_PRIVATE : VS_PUBLIC;
     } elseif ($attr_name == 'date_submitted' || $attr_name == 'last_modified') {
         return date_to_sql_date($this->rsrc_data[$attr_name]);
     } elseif ($attr_name == 'note') {
         return $this->rsrc_data['text'];
     } elseif (in_array($attr_name, Bugnote::$mantis_attrs)) {
         return $this->rsrc_data[$attr_name];
     }
 }
Exemplo n.º 3
0
 public function put($request)
 {
     /*
      *      Replaces the bug resource using the representation provided.
      *
      *      @param $request - The HTTP request we're responding to
      */
     $this->bug_id = Bug::get_mantis_id_from_url($request->url);
     $this->populate_from_repr($request->body);
     # Access checks are from Mantis's bug_update.php
     if (!(access_has_bug_level(access_get_status_threshold($f_new_status, bug_get_field($this->bug_id, 'project_id')), $this->bug_id) || access_has_bug_level(config_get('update_bug_threshold'), $this->bug_id) || bug_get_field($this->bug_id, 'reporter_id') == auth_get_current_user_id() && (ON == config_get('allow_reporter_reopen') || ON == config_get('allow_reporter_close')))) {
         throw new HTTPException(403, "Access denied to update bug");
     }
     bug_update($this->bug_id, $this->to_bugdata(), TRUE);
     $resp = new Response();
     $resp->status = 204;
     return $resp;
 }