本文整理汇总了PHP中bug_monitor函数的典型用法代码示例。如果您正苦于以下问题:PHP bug_monitor函数的具体用法?PHP bug_monitor怎么用?PHP bug_monitor使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bug_monitor函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mci_issue_set_monitors
/**
* Sets the monitors of the specified issue
*
* <p>This functions performs access level checks and only performs operations which would
* modify the existing monitors list.</p>
*
* @param integer $p_issue_id The issue id to set the monitors for.
* @param integer $p_requesting_user_id The user which requests the monitor change.
* @param array $p_monitors An array of arrays with the <em>id</em> field set to the id
* of the users which should monitor this issue.
* @return mixed
*/
function mci_issue_set_monitors($p_issue_id, $p_requesting_user_id, array $p_monitors)
{
if (bug_is_readonly($p_issue_id)) {
return mci_soap_fault_access_denied($p_requesting_user_id, 'Issue \'' . $p_issue_id . '\' is readonly');
}
# 1. get existing monitor ids
$t_existing_monitor_ids = bug_get_monitors($p_issue_id);
# 2. build new monitors ids
$t_new_monitor_ids = array();
foreach ($p_monitors as $t_monitor) {
$t_monitor = SoapObjectsFactory::unwrapObject($t_monitor);
$t_new_monitor_ids[] = $t_monitor['id'];
}
# 3. for each of the new monitor ids, add it if it does not already exist
foreach ($t_new_monitor_ids as $t_user_id) {
if ($p_requesting_user_id == $t_user_id) {
if (!access_has_bug_level(config_get('monitor_bug_threshold'), $p_issue_id)) {
continue;
}
} else {
if (!access_has_bug_level(config_get('monitor_add_others_bug_threshold'), $p_issue_id)) {
continue;
}
}
if (in_array($t_user_id, $t_existing_monitor_ids)) {
continue;
}
bug_monitor($p_issue_id, $t_user_id);
}
# 4. for each of the existing monitor ids, remove it if it is not found in the new monitor ids
foreach ($t_existing_monitor_ids as $t_user_id) {
if ($p_requesting_user_id == $t_user_id) {
if (!access_has_bug_level(config_get('monitor_bug_threshold'), $p_issue_id)) {
continue;
}
} else {
if (!access_has_bug_level(config_get('monitor_delete_others_bug_threshold'), $p_issue_id)) {
continue;
}
}
if (in_array($t_user_id, $t_new_monitor_ids)) {
continue;
}
bug_unmonitor($p_issue_id, $t_user_id);
}
}
示例2: addBugMonitor
function addBugMonitor($p_user_id, $p_bug_id)
{
bug_monitor($p_bug_id, $p_user_id);
}
示例3: access_ensure_bug_level
if ( bug_is_readonly( $f_bug_id ) ) {
error_parameters( $f_bug_id );
trigger_error( ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR );
}
access_ensure_bug_level( config_get( 'bug_reminder_threshold' ), $f_bug_id );
# Automically add recipients to monitor list if they are above the monitor
# threshold, option is enabled, and not reporter or handler.
foreach ( $f_to as $t_recipient )
{
if ( ON == config_get( 'reminder_recipients_monitor_bug' ) &&
access_has_bug_level( config_get( 'monitor_bug_threshold' ), $f_bug_id ) &&
!bug_is_user_handler( $f_bug_id, $t_recipient ) &&
!bug_is_user_reporter( $f_bug_id, $t_recipient ) ) {
bug_monitor( $f_bug_id, $t_recipient );
}
}
$result = email_bug_reminder( $f_to, $f_bug_id, $f_body );
# Add reminder as bugnote if store reminders option is ON.
if ( ON == config_get( 'store_reminders' ) ) {
if ( count( $f_to ) > 50 ) { # too many recipients to log, truncate the list
$t_to = array();
for ( $i=0; $i<50; $i++ ) {
$t_to[] = $f_to[$i];
}
$f_to = $t_to;
}
$t_attr = '|' . implode( '|', $f_to ) . '|';
示例4: sponsorship_set
/**
* if sponsorship contains a non-zero id, then update the corresponding record.
* if sponsorship contains a zero id, search for bug_id/user_id, if found, then update the entry
* otherwise add a new entry
* @param int $p_sponsorship
* @return int
*/
function sponsorship_set($p_sponsorship)
{
$t_min_sponsorship = config_get('minimum_sponsorship_amount');
if ($p_sponsorship->amount < $t_min_sponsorship) {
error_parameters($p_sponsorship->amount, $t_min_sponsorship);
trigger_error(ERROR_SPONSORSHIP_AMOUNT_TOO_LOW, ERROR);
}
# if id == 0, check if the specified user is already sponsoring the bug, if so, overwrite
if ($p_sponsorship->id == 0) {
$t_sponsorship_id = sponsorship_get_id($p_sponsorship->bug_id, $p_sponsorship->user_id);
if ($t_sponsorship_id !== false) {
$p_sponsorship->id = $t_sponsorship_id;
}
}
$t_sponsorship_table = db_get_table('sponsorship');
$c_id = db_prepare_int($p_sponsorship->id);
$c_bug_id = db_prepare_int($p_sponsorship->bug_id);
$c_user_id = db_prepare_int($p_sponsorship->user_id);
$c_amount = db_prepare_int($p_sponsorship->amount);
$c_logo = $p_sponsorship->logo;
$c_url = $p_sponsorship->url;
$c_now = db_now();
# if new sponsorship
if ($c_id == 0) {
# Insert
$query = "INSERT INTO {$t_sponsorship_table}\n\t\t\t\t ( bug_id, user_id, amount, logo, url, date_submitted, last_updated )\n\t\t\t\t VALUES\n\t\t\t\t (" . db_param() . ',' . db_param() . ',' . db_param() . ',' . db_param() . ',' . db_param() . ',' . db_param() . ',' . db_param() . ')';
db_query_bound($query, array($c_bug_id, $c_user_id, $c_amount, $c_logo, $c_url, $c_now, $c_now));
$t_sponsorship_id = db_insert_id($t_sponsorship_table);
history_log_event_special($c_bug_id, BUG_ADD_SPONSORSHIP, $c_user_id, $c_amount);
} else {
$t_old_amount = sponsorship_get_amount($c_id);
$t_sponsorship_id = $c_id;
if ($t_old_amount == $c_amount) {
return $t_sponsorship_id;
}
# Update
$query = "UPDATE {$t_sponsorship_table}\n\t\t\t\t\tSET\tbug_id = " . db_param() . ",\n\t\t\t\t\t\tuser_id = " . db_param() . ",\n\t\t\t\t\t\tamount = " . db_param() . ",\n\t\t\t\t\t\tlogo = " . db_param() . ",\n\t\t\t\t\t\turl = " . db_param() . ",\n\t\t\t\t\t\tlast_updated = " . db_param() . "\n\t\t\t\t\tWHERE\tid = " . db_param();
sponsorship_clear_cache($c_id);
db_query_bound($query, array($c_bug_id, $c_user_id, $c_amount, $c_logo, $c_url, $c_now, $c_id));
history_log_event_special($c_bug_id, BUG_UPDATE_SPONSORSHIP, $c_user_id, $c_amount);
}
sponsorship_update_bug($c_bug_id);
bug_monitor($c_bug_id, $c_user_id);
if ($c_id == 0) {
email_sponsorship_added($c_bug_id);
} else {
email_sponsorship_updated($c_bug_id);
}
return $t_sponsorship_id;
}
示例5: custom_field_set_value
custom_field_set_value($t_custom_field_to_set['id'], $f_bug_id, $t_custom_field_to_set['value']);
}
# Add a bug note if there is one.
if ($t_bug_note->note || helper_duration_to_minutes($t_bug_note->time_tracking) > 0) {
bugnote_add($f_bug_id, $t_bug_note->note, $t_bug_note->time_tracking, $t_bug_note->view_state == VS_PRIVATE, 0, '', null, false);
}
# Add a duplicate relationship if requested.
if ($t_updated_bug->duplicate_id !== 0) {
relationship_add($f_bug_id, $t_updated_bug->duplicate_id, BUG_DUPLICATE);
history_log_event_special($f_bug_id, BUG_ADD_RELATIONSHIP, BUG_DUPLICATE, $t_updated_bug->duplicate_id);
history_log_event_special($t_updated_bug->duplicate_id, BUG_ADD_RELATIONSHIP, BUG_HAS_DUPLICATE, $f_bug_id);
if (user_exists($t_existing_bug->reporter_id)) {
bug_monitor($f_bug_id, $t_existing_bug->reporter_id);
}
if (user_exists($t_existing_bug->handler_id)) {
bug_monitor($f_bug_id, $t_existing_bug->handler_id);
}
bug_monitor_copy($f_bug_id, $t_updated_bug->duplicate_id);
}
event_signal('EVENT_UPDATE_BUG', array($t_existing_bug, $t_updated_bug));
# Allow a custom function to respond to the modifications made to the bug. Note
# that custom functions are being deprecated in MantisBT. You should migrate to
# the new plugin system instead.
helper_call_custom_function('issue_update_notify', array($f_bug_id));
# Send a notification of changes via email.
if ($t_resolve_issue) {
email_resolved($f_bug_id);
email_relationship_child_resolved($f_bug_id);
} else {
if ($t_close_issue) {
email_close($f_bug_id);
示例6: mci_issue_set_monitors
/**
* Sets the monitors of the specified issue
*
* <p>This functions performs access level checks and only performs operations which would
* modify the existing monitors list.</p>
*
* @param int $p_issue_id the issue id to set the monitors for
* @param int $p_user_id the user which requests the monitor change
* @param array $p_monitors An array of arrays with the <em>id</em> field set to the id
* of the users which should monitor this issue.
*/
function mci_issue_set_monitors( $p_issue_id , $p_user_id, $p_monitors ) {
$t_existing_monitors = bug_get_monitors( $p_issue_id );
$t_monitors = array();
foreach ( $p_monitors as $t_monitor )
$t_monitors[] = $t_monitor['id'];
foreach ( $t_monitors as $t_user_id ) {
if ( $p_user_id == $t_user_id ) {
if ( ! access_has_bug_level( config_get( 'monitor_bug_threshold' ), $p_issue_id ) )
continue;
} else {
if ( !access_has_bug_level( config_get( 'monitor_add_others_bug_threshold' ), $p_issue_id ) )
continue;
}
if ( in_array( $p_user_id, $t_existing_monitors) )
continue;
bug_monitor( $p_issue_id, $t_user_id);
}
foreach ( $t_existing_monitors as $t_user_id ) {
if ( $p_user_id == $t_user_id ) {
if ( ! access_has_bug_level( config_get( 'monitor_bug_threshold' ), $p_issue_id ) )
continue;
} else {
if ( !access_has_bug_level( config_get( 'monitor_delete_others_bug_threshold' ), $p_issue_id ) )
continue;
}
if ( in_array( $p_user_id, $t_monitors) )
continue;
bug_unmonitor( $p_issue_id, $t_user_id);
}
}
示例7: bug_resolve
/**
* resolve the given bug
* @return bool (alawys true)
* @access public
*/
function bug_resolve($p_bug_id, $p_resolution, $p_fixed_in_version = '', $p_bugnote_text = '', $p_duplicate_id = null, $p_handler_id = null, $p_bugnote_private = false, $p_time_tracking = '0:00')
{
$c_resolution = (int) $p_resolution;
$p_bugnote_text = trim($p_bugnote_text);
# Add bugnote if supplied
# Moved bugnote_add before bug_set_field calls in case time_tracking_no_note is off.
# Error condition stopped execution but status had already been changed
bugnote_add($p_bug_id, $p_bugnote_text, $p_time_tracking, $p_bugnote_private, 0, '', NULL, FALSE);
$t_duplicate = !is_blank($p_duplicate_id) && $p_duplicate_id != 0;
if ($t_duplicate) {
if ($p_bug_id == $p_duplicate_id) {
trigger_error(ERROR_BUG_DUPLICATE_SELF, ERROR);
# never returns
}
# the related bug exists...
bug_ensure_exists($p_duplicate_id);
# check if there is other relationship between the bugs...
$t_id_relationship = relationship_same_type_exists($p_bug_id, $p_duplicate_id, BUG_DUPLICATE);
if ($t_id_relationship > 0) {
# Update the relationship
relationship_update($t_id_relationship, $p_bug_id, $p_duplicate_id, BUG_DUPLICATE);
# Add log line to the history (both bugs)
history_log_event_special($p_bug_id, BUG_REPLACE_RELATIONSHIP, BUG_DUPLICATE, $p_duplicate_id);
history_log_event_special($p_duplicate_id, BUG_REPLACE_RELATIONSHIP, BUG_HAS_DUPLICATE, $p_bug_id);
} else {
if ($t_id_relationship != -1) {
# Add the new relationship
relationship_add($p_bug_id, $p_duplicate_id, BUG_DUPLICATE);
# Add log line to the history (both bugs)
history_log_event_special($p_bug_id, BUG_ADD_RELATIONSHIP, BUG_DUPLICATE, $p_duplicate_id);
history_log_event_special($p_duplicate_id, BUG_ADD_RELATIONSHIP, BUG_HAS_DUPLICATE, $p_bug_id);
}
}
# else relationship is -1 - same type exists, do nothing
# Copy list of users monitoring the duplicate bug to the original bug
$t_old_reporter_id = bug_get_field($p_bug_id, 'reporter_id');
$t_old_handler_id = bug_get_field($p_bug_id, 'handler_id');
if (user_exists($t_old_reporter_id)) {
bug_monitor($p_duplicate_id, $t_old_reporter_id);
}
if (user_exists($t_old_handler_id)) {
bug_monitor($p_duplicate_id, $t_old_handler_id);
}
bug_monitor_copy($p_bug_id, $p_duplicate_id);
bug_set_field($p_bug_id, 'duplicate_id', (int) $p_duplicate_id);
}
bug_set_field($p_bug_id, 'status', config_get('bug_resolved_status_threshold'));
bug_set_field($p_bug_id, 'fixed_in_version', $p_fixed_in_version);
bug_set_field($p_bug_id, 'resolution', $c_resolution);
# only set handler if specified explicitly or if bug was not assigned to a handler
if (null == $p_handler_id) {
if (bug_get_field($p_bug_id, 'handler_id') == 0) {
$p_handler_id = auth_get_current_user_id();
bug_set_field($p_bug_id, 'handler_id', $p_handler_id);
}
} else {
bug_set_field($p_bug_id, 'handler_id', $p_handler_id);
}
email_resolved($p_bug_id);
email_relationship_child_resolved($p_bug_id);
if ($c_resolution >= config_get('bug_resolution_fixed_threshold') && $c_resolution < config_get('bug_resolution_not_fixed_threshold')) {
twitter_issue_resolved($p_bug_id);
}
return true;
}
示例8: gpc_get_string
$f_username = gpc_get_string('username', '');
$t_logged_in_user_id = auth_get_current_user_id();
if (is_blank($f_username)) {
$t_user_id = $t_logged_in_user_id;
} else {
$t_user_id = user_get_id_by_name($f_username);
if ($t_user_id === false) {
$t_user_id = user_get_id_by_realname($f_username);
if ($t_user_id === false) {
error_parameters($f_username);
trigger_error(ERROR_USER_BY_NAME_NOT_FOUND, E_USER_ERROR);
}
}
}
if (user_is_anonymous($t_user_id)) {
trigger_error(ERROR_PROTECTED_ACCOUNT, E_USER_ERROR);
}
bug_ensure_exists($f_bug_id);
if ($t_bug->project_id != helper_get_current_project()) {
# in case the current project is not the same project of the bug we are viewing...
# ... override the current project. This to avoid problems with categories and handlers lists etc.
$g_project_override = $t_bug->project_id;
}
if ($t_logged_in_user_id == $t_user_id) {
access_ensure_bug_level(config_get('monitor_bug_threshold'), $f_bug_id);
} else {
access_ensure_bug_level(config_get('monitor_add_others_bug_threshold'), $f_bug_id);
}
bug_monitor($f_bug_id, $t_user_id);
form_security_purge('bug_monitor_add');
print_successful_redirect_to_bug($f_bug_id);
示例9: add_monitors
private function add_monitors($p_bug_id, $p_email)
{
if ($this->_mail_add_users_from_cc_to) {
$t_emails = array_merge($p_email['To'], $p_email['Cc']);
foreach ($t_emails as $t_email) {
$t_user_id = $this->get_userid_from_email($t_email);
if ($t_user_id !== FALSE) {
// Make sure that mail_reporter_id and reporter_id are not added as a monitors.
if ($this->_mail_reporter_id != $t_user_id && $p_email['Reporter_id'] != $t_user_id) {
bug_monitor($p_bug_id, $t_user_id);
$this->custom_error('Monitor: ' . $t_user_id . ' - ' . $t_email . ' --> Issue ID: #' . $p_bug_id, FALSE);
}
}
}
}
}
示例10: sponsorship_set
/**
* if sponsorship contains a non-zero id, then update the corresponding record.
* if sponsorship contains a zero id, search for bug_id/user_id, if found, then update the entry
* otherwise add a new entry
* @param SponsorshipData $p_sponsorship The sponsorship data object to set.
* @return integer
*/
function sponsorship_set(SponsorshipData $p_sponsorship)
{
$t_min_sponsorship = config_get('minimum_sponsorship_amount');
if ($p_sponsorship->amount < $t_min_sponsorship) {
error_parameters($p_sponsorship->amount, $t_min_sponsorship);
trigger_error(ERROR_SPONSORSHIP_AMOUNT_TOO_LOW, ERROR);
}
# if id == 0, check if the specified user is already sponsoring the bug, if so, overwrite
if ($p_sponsorship->id == 0) {
$t_sponsorship_id = sponsorship_get_id($p_sponsorship->bug_id, $p_sponsorship->user_id);
if ($t_sponsorship_id !== false) {
$p_sponsorship->id = $t_sponsorship_id;
}
}
$c_id = (int) $p_sponsorship->id;
$c_bug_id = (int) $p_sponsorship->bug_id;
$c_user_id = (int) $p_sponsorship->user_id;
$c_amount = (int) $p_sponsorship->amount;
$c_logo = $p_sponsorship->logo;
$c_url = $p_sponsorship->url;
$c_now = db_now();
# if new sponsorship
if ($c_id == 0) {
# Insert
$t_query = 'INSERT INTO {sponsorship}
( bug_id, user_id, amount, logo, url, date_submitted, last_updated )
VALUES
(' . db_param() . ',' . db_param() . ',' . db_param() . ',' . db_param() . ',' . db_param() . ',' . db_param() . ',' . db_param() . ')';
db_query($t_query, array($c_bug_id, $c_user_id, $c_amount, $c_logo, $c_url, $c_now, $c_now));
$t_sponsorship_id = db_insert_id(db_get_table('sponsorship'));
history_log_event_special($c_bug_id, BUG_ADD_SPONSORSHIP, $c_user_id, $c_amount);
} else {
$t_old_amount = sponsorship_get_amount($c_id);
$t_sponsorship_id = $c_id;
if ($t_old_amount == $c_amount) {
return $t_sponsorship_id;
}
# Update
$t_query = 'UPDATE {sponsorship}
SET bug_id = ' . db_param() . ',
user_id = ' . db_param() . ',
amount = ' . db_param() . ',
logo = ' . db_param() . ',
url = ' . db_param() . ',
last_updated = ' . db_param() . '
WHERE id = ' . db_param();
sponsorship_clear_cache($c_id);
db_query($t_query, array($c_bug_id, $c_user_id, $c_amount, $c_logo, $c_url, $c_now, $c_id));
history_log_event_special($c_bug_id, BUG_UPDATE_SPONSORSHIP, $c_user_id, $c_amount);
}
sponsorship_update_bug($c_bug_id);
bug_monitor($c_bug_id, $c_user_id);
if ($c_id == 0) {
email_sponsorship_added($c_bug_id);
} else {
email_sponsorship_updated($c_bug_id);
}
return $t_sponsorship_id;
}
示例11: config_get
# Mantis is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Mantis. If not, see <http://www.gnu.org/licenses/>.
# --------------------------------------------------------
# $Id: bug_monitor.php,v 1.28.16.1 2007-10-13 22:32:42 giallu Exp $
# --------------------------------------------------------
# This file turns monitoring on or off for a bug for the current user
require_once 'core.php';
$t_core_path = config_get('core_path');
require_once $t_core_path . 'bug_api.php';
# helper_ensure_post();
$f_bug_id = gpc_get_int('bug_id');
$t_bug = bug_get($f_bug_id, true);
if ($t_bug->project_id != helper_get_current_project()) {
# in case the current project is not the same project of the bug we are viewing...
# ... override the current project. This to avoid problems with categories and handlers lists etc.
$g_project_override = $t_bug->project_id;
}
$f_action = gpc_get_string('action');
access_ensure_bug_level(config_get('monitor_bug_threshold'), $f_bug_id);
if ('delete' == $f_action) {
bug_unmonitor($f_bug_id, auth_get_current_user_id());
} else {
# should be 'add' but we have to account for other values
bug_monitor($f_bug_id, auth_get_current_user_id());
}
print_successful_redirect_to_bug($f_bug_id);
示例12: mci_issue_set_monitors
/**
* Sets the monitors of the specified issue
*
* <p>This functions performs access level checks and only performs operations which would
* modify the existing monitors list.</p>
*
* @param int $p_issue_id the issue id to set the monitors for
* @param int $p_user_id the user which requests the monitor change
* @param array $p_monitors An array of arrays with the <em>id</em> field set to the id
* of the users which should monitor this issue.
*/
function mci_issue_set_monitors($p_issue_id, $p_user_id, $p_monitors)
{
if (bug_is_readonly($p_issue_id)) {
return mci_soap_fault_access_denied($p_user_id, "Issue '{$p_issue_id}' is readonly");
}
$t_existing_monitors = bug_get_monitors($p_issue_id);
$t_monitors = array();
foreach ($p_monitors as $t_monitor) {
$t_monitors[] = $t_monitor['id'];
}
foreach ($t_monitors as $t_user_id) {
if ($p_user_id == $t_user_id) {
if (!access_has_bug_level(config_get('monitor_bug_threshold'), $p_issue_id)) {
continue;
}
} else {
if (!access_has_bug_level(config_get('monitor_add_others_bug_threshold'), $p_issue_id)) {
continue;
}
}
if (in_array($p_user_id, $t_existing_monitors)) {
continue;
}
bug_monitor($p_issue_id, $t_user_id);
}
foreach ($t_existing_monitors as $t_user_id) {
if ($p_user_id == $t_user_id) {
if (!access_has_bug_level(config_get('monitor_bug_threshold'), $p_issue_id)) {
continue;
}
} else {
if (!access_has_bug_level(config_get('monitor_delete_others_bug_threshold'), $p_issue_id)) {
continue;
}
}
if (in_array($p_user_id, $t_monitors)) {
continue;
}
bug_unmonitor($p_issue_id, $t_user_id);
}
}