/** * Overloaded Function handling property sets * * @param string $p_name Property name. * @param string $p_value Value to set. * @private * @return void */ public function __set($p_name, $p_value) { switch ($p_name) { # integer types case 'id': case 'project_id': case 'reporter_id': case 'handler_id': case 'duplicate_id': case 'priority': case 'severity': case 'reproducibility': case 'status': case 'resolution': case 'projection': case 'category_id': $p_value = (int) $p_value; break; case 'target_version': if (!$this->loading && $this->{$p_name} != $p_value) { # Only set target_version if user has access to do so if (!access_has_project_level(config_get('roadmap_update_threshold'))) { trigger_error(ERROR_ACCESS_DENIED, ERROR); } } break; case 'due_date': if (!is_numeric($p_value)) { $p_value = strtotime($p_value); } break; case 'summary': # MySQL 4-bytes UTF-8 chars workaround #21101 $p_value = db_mysql_fix_utf8($p_value); # Fall through # Fall through case 'build': if (!$this->loading) { $p_value = trim($p_value); } break; case 'description': case 'steps_to_reproduce': case 'additional_information': # MySQL 4-bytes UTF-8 chars workaround #21101 $p_value = db_mysql_fix_utf8($p_value); break; } $this->{$p_name} = $p_value; }
/** * Set the bugnote text * @param integer $p_bugnote_id A bugnote identifier. * @param string $p_bugnote_text The bugnote text to set. * @return boolean * @access public */ function bugnote_set_text($p_bugnote_id, $p_bugnote_text) { $t_old_text = bugnote_get_text($p_bugnote_id); if ($t_old_text == $p_bugnote_text) { return true; } # MySQL 4-bytes UTF-8 chars workaround #21101 $p_bugnote_text = db_mysql_fix_utf8($p_bugnote_text); $t_bug_id = bugnote_get_field($p_bugnote_id, 'bug_id'); $t_bugnote_text_id = bugnote_get_field($p_bugnote_id, 'bugnote_text_id'); # insert an 'original' revision if needed if (bug_revision_count($t_bug_id, REV_BUGNOTE, $p_bugnote_id) < 1) { $t_user_id = bugnote_get_field($p_bugnote_id, 'reporter_id'); $t_timestamp = bugnote_get_field($p_bugnote_id, 'last_modified'); bug_revision_add($t_bug_id, $t_user_id, REV_BUGNOTE, $t_old_text, $p_bugnote_id, $t_timestamp); } db_param_push(); $t_query = 'UPDATE {bugnote_text} SET note=' . db_param() . ' WHERE id=' . db_param(); db_query($t_query, array($p_bugnote_text, $t_bugnote_text_id)); # updated the last_updated date bugnote_date_update($p_bugnote_id); bug_update_date($t_bug_id); # insert a new revision $t_user_id = auth_get_current_user_id(); $t_revision_id = bug_revision_add($t_bug_id, $t_user_id, REV_BUGNOTE, $p_bugnote_text, $p_bugnote_id); # log new bugnote history_log_event_special($t_bug_id, BUGNOTE_UPDATED, bugnote_format_id($p_bugnote_id), $t_revision_id); return true; }