• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP history_log_event_special函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中history_log_event_special函数的典型用法代码示例。如果您正苦于以下问题:PHP history_log_event_special函数的具体用法?PHP history_log_event_special怎么用?PHP history_log_event_special使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了history_log_event_special函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: custom_function_default_checkin

function custom_function_default_checkin($p_issue_id, $p_comment, $p_file, $p_new_version, $p_fixed)
{
    if (bug_exists($p_issue_id)) {
        history_log_event_special($p_issue_id, CHECKIN, $p_file, $p_new_version);
        bugnote_add($p_issue_id, $p_comment, VS_PRIVATE == config_get('source_control_notes_view_status'));
        $t_status = config_get('source_control_set_status_to');
        if (OFF != $t_status && $p_fixed) {
            bug_set_field($p_issue_id, 'status', $t_status);
            bug_set_field($p_issue_id, 'resolution', config_get('source_control_set_resolution_to'));
        }
    }
}
开发者ID:centaurustech,项目名称:BenFund,代码行数:12,代码来源:custom_function_api.php


示例2: tag_bug_detach

/**
 * Detach a tag from a bug.
 * @param integer Tag ID
 * @param integer Bug ID
 * @param boolean Add history entries to bug
 * @param integer User Id (or null for current logged in user)
 */
function tag_bug_detach($p_tag_id, $p_bug_id, $p_add_history = true, $p_user_id = null)
{
    if ($p_user_id === null) {
        $t_user_id = auth_get_current_user_id();
    } else {
        $t_user_id = $p_user_id;
    }
    if (!tag_bug_is_attached($p_tag_id, $p_bug_id)) {
        trigger_error(TAG_NOT_ATTACHED, ERROR);
    }
    $t_tag_row = tag_bug_get_row($p_tag_id, $p_bug_id);
    if ($t_user_id == tag_get_field($p_tag_id, 'user_id') || $t_user_id == $t_tag_row['user_id']) {
        $t_detach_level = config_get('tag_detach_own_threshold');
    } else {
        $t_detach_level = config_get('tag_detach_threshold');
    }
    access_ensure_bug_level($t_detach_level, $p_bug_id, $t_user_id);
    $c_tag_id = db_prepare_int($p_tag_id);
    $c_bug_id = db_prepare_int($p_bug_id);
    $t_bug_tag_table = db_get_table('bug_tag');
    $query = "DELETE FROM {$t_bug_tag_table}\n\t\t\t\t\tWHERE tag_id=" . db_param() . ' AND bug_id=' . db_param();
    db_query_bound($query, array($c_tag_id, $c_bug_id));
    if ($p_add_history) {
        $t_tag_name = tag_get_field($p_tag_id, 'name');
        history_log_event_special($p_bug_id, TAG_DETACHED, $t_tag_name);
    }
    # updated the last_updated date
    bug_update_date($p_bug_id);
    return true;
}
开发者ID:Kirill,项目名称:mantisbt,代码行数:37,代码来源:tag_api.php


示例3: foreach

# Commit the bug updates to the database.
$t_text_field_update_required = $t_existing_bug->description !== $t_updated_bug->description || $t_existing_bug->additional_information !== $t_updated_bug->additional_information || $t_existing_bug->steps_to_reproduce !== $t_updated_bug->steps_to_reproduce;
$t_updated_bug->update($t_text_field_update_required, true);
# Update custom field values.
foreach ($t_custom_fields_to_set as $t_custom_field_to_set) {
    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) {
开发者ID:Kirill,项目名称:mantisbt,代码行数:31,代码来源:bug_update.php


示例4: save_bug


//.........这里部分代码省略.........
     $t_bug_data->steps_to_reproduce = gpc_get_string('LOGCAT', "");
     $t_bug_data->additional_information = gpc_get_string('CRASH_CONFIGURATION', "");
     $t_bug_data->due_date = gpc_get_string('USER_CRASH_DATE', '');
     if (is_blank($t_bug_data->due_date)) {
         $t_bug_data->due_date = date_get_null();
     }
     $f_files = gpc_get_file('ufile', null);
     /** @todo (thraxisp) Note that this always returns a structure */
     $f_report_stay = gpc_get_bool('report_stay', false);
     $f_copy_notes_from_parent = gpc_get_bool('copy_notes_from_parent', false);
     helper_call_custom_function('issue_create_validate', array($t_bug_data));
     # Validate the custom fields before adding the bug.
     $t_related_custom_field_ids = custom_field_get_linked_ids($t_bug_data->project_id);
     foreach ($t_related_custom_field_ids as $t_id) {
         $t_def = custom_field_get_definition($t_id);
         # Produce an error if the field is required but wasn't posted
         if (!gpc_isset_custom_field($t_id, $t_def['type']) && $t_def['require_report']) {
             error_parameters(lang_get_defaulted(custom_field_get_field($t_id, 'name')));
             trigger_error(ERROR_EMPTY_FIELD, ERROR);
         }
         if (!custom_field_validate($t_id, gpc_get_custom_field("custom_field_{$t_id}", $t_def['type'], NULL))) {
             error_parameters(lang_get_defaulted(custom_field_get_field($t_id, 'name')));
             trigger_error(ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR);
         }
     }
     # Allow plugins to pre-process bug data
     $t_bug_data = event_signal('EVENT_REPORT_BUG_DATA', $t_bug_data);
     # Ensure that resolved bugs have a handler
     if ($t_bug_data->handler_id == NO_USER && $t_bug_data->status >= config_get('bug_resolved_status_threshold')) {
         $t_bug_data->handler_id = $this->get_user_id();
     }
     # Create the bug
     $t_bug_id = $t_bug_data->create();
     # Mark the added issue as visited so that it appears on the last visited list.
     last_visited_issue($t_bug_id);
     # Handle the file upload
     if ($f_files != null) {
         $t_files = helper_array_transpose($f_files);
         if ($t_files != null) {
             foreach ($t_files as $t_file) {
                 if (!empty($t_file['name'])) {
                     file_add($t_bug_id, $t_file, 'bug');
                 }
             }
         }
     }
     # Handle custom field submission
     foreach ($t_related_custom_field_ids as $t_id) {
         # Do not set custom field value if user has no write access
         if (!custom_field_has_write_access($t_id, $t_bug_id)) {
             continue;
         }
         $t_def = custom_field_get_definition($t_id);
         if (!custom_field_set_value($t_id, $t_bug_id, gpc_get_custom_field("custom_field_{$t_id}", $t_def['type'], $t_def['default_value']), false)) {
             error_parameters(lang_get_defaulted(custom_field_get_field($t_id, 'name')));
             trigger_error(ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR);
         }
     }
     $f_master_bug_id = gpc_get_int('m_id', 0);
     $f_rel_type = gpc_get_int('rel_type', -1);
     if ($f_master_bug_id > 0) {
         # it's a child generation... let's create the relationship and add some lines in the history
         # update master bug last updated
         bug_update_date($f_master_bug_id);
         # Add log line to record the cloning action
         history_log_event_special($t_bug_id, BUG_CREATED_FROM, '', $f_master_bug_id);
         history_log_event_special($f_master_bug_id, BUG_CLONED_TO, '', $t_bug_id);
         if ($f_rel_type >= 0) {
             # Add the relationship
             relationship_add($t_bug_id, $f_master_bug_id, $f_rel_type);
             # Add log line to the history (both issues)
             history_log_event_special($f_master_bug_id, BUG_ADD_RELATIONSHIP, relationship_get_complementary_type($f_rel_type), $t_bug_id);
             history_log_event_special($t_bug_id, BUG_ADD_RELATIONSHIP, $f_rel_type, $f_master_bug_id);
             # update relationship target bug last updated
             bug_update_date($t_bug_id);
             # Send the email notification
             email_relationship_added($f_master_bug_id, $t_bug_id, relationship_get_complementary_type($f_rel_type));
         }
         # copy notes from parent
         if ($f_copy_notes_from_parent) {
             $t_parent_bugnotes = bugnote_get_all_bugnotes($f_master_bug_id);
             foreach ($t_parent_bugnotes as $t_parent_bugnote) {
                 $t_private = $t_parent_bugnote->view_state == VS_PRIVATE;
                 bugnote_add($t_bug_id, $t_parent_bugnote->note, $t_parent_bugnote->time_tracking, $t_private, $t_parent_bugnote->note_type, $t_parent_bugnote->note_attr, $t_parent_bugnote->reporter_id, FALSE, FALSE);
             }
         }
     }
     helper_call_custom_function('issue_create_notify', array($t_bug_id));
     # Allow plugins to post-process bug data with the new bug ID
     event_signal('EVENT_REPORT_BUG', array($t_bug_data, $t_bug_id));
     email_new_bug($t_bug_id);
     // log status and resolution changes if they differ from the default
     if ($t_bug_data->status != config_get('bug_submit_status')) {
         history_log_event($t_bug_id, 'status', config_get('bug_submit_status'));
     }
     if ($t_bug_data->resolution != config_get('default_bug_resolution')) {
         history_log_event($t_bug_id, 'resolution', config_get('default_bug_resolution'));
     }
     return $t_bug_id;
 }
开发者ID:since2014,项目名称:MantisAcra,代码行数:101,代码来源:MantisAcra.php


示例5: mci_file_add

function mci_file_add($p_id, $p_name, $p_content, $p_file_type, $p_table, $p_title = '', $p_desc = '', $p_user_id = null)
{
    if (!file_type_check($p_name)) {
        return new soap_fault('Client', '', 'File type not allowed.');
    }
    if (!file_is_name_unique($p_name, $p_id)) {
        return new soap_fault('Client', '', 'Duplicate filename.');
    }
    $t_file_size = strlen($p_content);
    $t_max_file_size = (int) min(ini_get_number('upload_max_filesize'), ini_get_number('post_max_size'), config_get('max_file_size'));
    if ($t_file_size > $t_max_file_size) {
        return new soap_fault('Client', '', 'File is too big.');
    }
    if ('bug' == $p_table) {
        $t_project_id = bug_get_field($p_id, 'project_id');
        $t_issue_id = bug_format_id($p_id);
    } else {
        $t_project_id = $p_id;
        $t_issue_id = 0;
    }
    # prepare variables for insertion
    $c_issue_id = db_prepare_int($t_issue_id);
    $c_project_id = db_prepare_int($t_project_id);
    $c_file_type = db_prepare_string($p_file_type);
    $c_title = db_prepare_string($p_title);
    $c_desc = db_prepare_string($p_desc);
    if ($p_user_id === null) {
        $c_user_id = auth_get_current_user_id();
    } else {
        $c_user_id = (int) $p_user_id;
    }
    if ($t_project_id == ALL_PROJECTS) {
        $t_file_path = config_get('absolute_path_default_upload_folder');
    } else {
        $t_file_path = project_get_field($t_project_id, 'file_path');
        if ($t_file_path == '') {
            $t_file_path = config_get('absolute_path_default_upload_folder');
        }
    }
    $c_file_path = db_prepare_string($t_file_path);
    $c_new_file_name = db_prepare_string($p_name);
    $t_file_hash = $t_issue_id;
    $t_disk_file_name = $t_file_path . file_generate_unique_name($t_file_hash . '-' . $p_name, $t_file_path);
    $c_disk_file_name = db_prepare_string($t_disk_file_name);
    $t_file_size = strlen($p_content);
    $c_file_size = db_prepare_int($t_file_size);
    $t_method = config_get('file_upload_method');
    switch ($t_method) {
        case FTP:
        case DISK:
            if (!file_exists($t_file_path) || !is_dir($t_file_path) || !is_writable($t_file_path) || !is_readable($t_file_path)) {
                return new soap_fault('Server', '', "Upload folder '{$t_file_path}' doesn't exist.");
            }
            file_ensure_valid_upload_path($t_file_path);
            if (!file_exists($t_disk_file_name)) {
                mci_file_write_local($t_disk_file_name, $p_content);
                if (FTP == $t_method) {
                    $conn_id = file_ftp_connect();
                    file_ftp_put($conn_id, $t_disk_file_name, $t_disk_file_name);
                    file_ftp_disconnect($conn_id);
                    file_delete_local($t_disk_file_name);
                } else {
                    chmod($t_disk_file_name, config_get('attachments_file_permissions'));
                }
                $c_content = "''";
            }
            break;
        case DATABASE:
            $c_content = db_prepare_binary_string($p_content);
            break;
    }
    $t_file_table = db_get_table($p_table . '_file');
    $c_id = 'bug' == $p_table ? $c_issue_id : $c_project_id;
    $query = "INSERT INTO {$t_file_table}\n\t\t\t(" . $p_table . "_id, title, description, diskfile, filename, folder, filesize, file_type, date_added, content, user_id)\n\t\tVALUES\n\t\t\t({$c_id}, '{$c_title}', '{$c_desc}', '{$c_disk_file_name}', '{$c_new_file_name}', '{$c_file_path}', {$c_file_size}, '{$c_file_type}', '" . db_now() . "', {$c_content}, {$c_user_id})";
    db_query($query);
    # get attachment id
    $t_attachment_id = db_insert_id($t_file_table);
    if ('bug' == $p_table) {
        # updated the last_updated date
        $result = bug_update_date($c_issue_id);
        # log new bug
        history_log_event_special($c_issue_id, FILE_ADDED, $c_new_file_name);
    }
    return $t_attachment_id;
}
开发者ID:nextgens,项目名称:mantisbt,代码行数:85,代码来源:mc_file_api.php


示例6: relationship_same_type_exists

    }
    # check if there is other relationship between the bugs...
    $t_old_id_relationship = relationship_same_type_exists($f_src_bug_id, $f_dest_bug_id, $f_rel_type);
    if ($t_old_id_relationship == -1) {
        # the relationship type is exactly the same of the new one. No sense to proceed
        trigger_error(ERROR_RELATIONSHIP_ALREADY_EXISTS, ERROR);
    } else {
        if ($t_old_id_relationship > 0) {
            # there is already a relationship between them -> we have to update it and not to add a new one
            helper_ensure_confirmed(lang_get('replace_relationship_sure_msg'), lang_get('replace_relationship_button'));
            # Update the relationship
            relationship_update($t_old_id_relationship, $f_src_bug_id, $f_dest_bug_id, $f_rel_type);
            # Add log line to the history (both bugs)
            history_log_event_special($f_src_bug_id, BUG_REPLACE_RELATIONSHIP, $f_rel_type, $f_dest_bug_id);
            history_log_event_special($f_dest_bug_id, BUG_REPLACE_RELATIONSHIP, relationship_get_complementary_type($f_rel_type), $f_src_bug_id);
        } else {
            # Add the new relationship
            relationship_add($f_src_bug_id, $f_dest_bug_id, $f_rel_type);
            # Add log line to the history (both bugs)
            history_log_event_special($f_src_bug_id, BUG_ADD_RELATIONSHIP, $f_rel_type, $f_dest_bug_id);
            history_log_event_special($f_dest_bug_id, BUG_ADD_RELATIONSHIP, relationship_get_complementary_type($f_rel_type), $f_src_bug_id);
        }
    }
    # update bug last updated (just for the src bug)
    bug_update_date($f_src_bug_id);
    # send email notification to the users addressed by both the bugs
    email_relationship_added($f_src_bug_id, $f_dest_bug_id, $f_rel_type);
    email_relationship_added($f_dest_bug_id, $f_src_bug_id, relationship_get_complementary_type($f_rel_type));
}
form_security_purge('bug_relationship_add');
print_header_redirect_view($f_src_bug_id);
开发者ID:kaos,项目名称:mantisbt,代码行数:31,代码来源:bug_relationship_add.php


示例7: file_add


//.........这里部分代码省略.........
{
    file_ensure_uploaded($p_file);
    $t_file_name = $p_file['name'];
    $t_tmp_file = $p_file['tmp_name'];
    if (!file_type_check($t_file_name)) {
        trigger_error(ERROR_FILE_NOT_ALLOWED, ERROR);
    }
    $t_org_filename = $t_file_name;
    $t_suffix_id = 1;
    while (!file_is_name_unique($t_file_name, $p_bug_id)) {
        $t_suffix_id++;
        $t_dot_index = strripos($t_org_filename, '.');
        if ($t_dot_index === false) {
            $t_file_name = $t_org_filename . '-' . $t_suffix_id;
        } else {
            $t_extension = substr($t_org_filename, $t_dot_index, strlen($t_org_filename) - $t_dot_index);
            $t_file_name = substr($t_org_filename, 0, $t_dot_index) . '-' . $t_suffix_id . $t_extension;
        }
    }
    antispam_check();
    $t_file_size = filesize($t_tmp_file);
    if (0 == $t_file_size) {
        trigger_error(ERROR_FILE_NO_UPLOAD_FAILURE, ERROR);
    }
    $t_max_file_size = (int) min(ini_get_number('upload_max_filesize'), ini_get_number('post_max_size'), config_get('max_file_size'));
    if ($t_file_size > $t_max_file_size) {
        trigger_error(ERROR_FILE_TOO_BIG, ERROR);
    }
    if ('bug' == $p_table) {
        $t_project_id = bug_get_field($p_bug_id, 'project_id');
        $t_id = (int) $p_bug_id;
    } else {
        $t_project_id = helper_get_current_project();
        $t_id = $t_project_id;
    }
    if ($p_user_id === null) {
        $p_user_id = auth_get_current_user_id();
    }
    if ($p_date_added <= 0) {
        $p_date_added = db_now();
    }
    if ($t_project_id == ALL_PROJECTS) {
        $t_file_path = config_get('absolute_path_default_upload_folder');
    } else {
        $t_file_path = project_get_field($t_project_id, 'file_path');
        if (is_blank($t_file_path)) {
            $t_file_path = config_get('absolute_path_default_upload_folder');
        }
    }
    $t_unique_name = file_generate_unique_name($t_file_path);
    $t_method = config_get('file_upload_method');
    switch ($t_method) {
        case DISK:
            file_ensure_valid_upload_path($t_file_path);
            $t_disk_file_name = $t_file_path . $t_unique_name;
            if (!file_exists($t_disk_file_name)) {
                if (!move_uploaded_file($t_tmp_file, $t_disk_file_name)) {
                    trigger_error(ERROR_FILE_MOVE_FAILED, ERROR);
                }
                chmod($t_disk_file_name, config_get('attachments_file_permissions'));
                $c_content = '';
            } else {
                trigger_error(ERROR_FILE_DUPLICATE, ERROR);
            }
            break;
        case DATABASE:
            $c_content = db_prepare_binary_string(fread(fopen($t_tmp_file, 'rb'), $t_file_size));
            $t_file_path = '';
            break;
        default:
            trigger_error(ERROR_GENERIC, ERROR);
    }
    $t_file_table = db_get_table($p_table . '_file');
    $t_id_col = $p_table . '_id';
    $t_param = array($t_id_col => $t_id, 'title' => $p_title, 'description' => $p_desc, 'diskfile' => $t_unique_name, 'filename' => $t_file_name, 'folder' => $t_file_path, 'filesize' => $t_file_size, 'file_type' => $p_file['type'], 'date_added' => $p_date_added, 'user_id' => (int) $p_user_id);
    # Oracle has to update BLOBs separately
    if (!db_is_oracle()) {
        $t_param['content'] = $c_content;
    }
    $t_query_param = db_param();
    for ($i = 1; $i < count($t_param); $i++) {
        $t_query_param .= ', ' . db_param();
    }
    $t_query = 'INSERT INTO ' . $t_file_table . '
		( ' . implode(', ', array_keys($t_param)) . ' )
	VALUES
		( ' . $t_query_param . ' )';
    db_query($t_query, array_values($t_param));
    if (db_is_oracle()) {
        db_update_blob($t_file_table, 'content', $c_content, "diskfile='{$t_unique_name}'");
    }
    if ('bug' == $p_table) {
        # update the last_updated date
        if (!$p_skip_bug_update) {
            bug_update_date($p_bug_id);
        }
        # log file added to bug history
        history_log_event_special($p_bug_id, FILE_ADDED, $t_file_name);
    }
}
开发者ID:martijnveen,项目名称:mantisbt,代码行数:101,代码来源:file_api.php


示例8: file_add

/**
 * Add a file to the system using the configured storage method
 *
 * @param integer $p_bug_id          The bug id (should be 0 when adding project doc).
 * @param array   $p_file            The uploaded file info, as retrieved from gpc_get_file().
 * @param string  $p_table           Either 'bug' or 'project' depending on attachment type.
 * @param string  $p_title           File title.
 * @param string  $p_desc            File description.
 * @param integer $p_user_id         User id (defaults to current user).
 * @param integer $p_date_added      Date added.
 * @param boolean $p_skip_bug_update Skip bug last modification update (useful when importing bug attachments).
 * @return void
 */
function file_add($p_bug_id, array $p_file, $p_table = 'bug', $p_title = '', $p_desc = '', $p_user_id = null, $p_date_added = 0, $p_skip_bug_update = false)
{
    file_ensure_uploaded($p_file);
    $t_file_name = $p_file['name'];
    $t_tmp_file = $p_file['tmp_name'];
    if (!file_type_check($t_file_name)) {
        trigger_error(ERROR_FILE_NOT_ALLOWED, ERROR);
    }
    if (!file_is_name_unique($t_file_name, $p_bug_id)) {
        trigger_error(ERROR_FILE_DUPLICATE, ERROR);
    }
    $t_file_size = filesize($t_tmp_file);
    if (0 == $t_file_size) {
        trigger_error(ERROR_FILE_NO_UPLOAD_FAILURE, ERROR);
    }
    $t_max_file_size = (int) min(ini_get_number('upload_max_filesize'), ini_get_number('post_max_size'), config_get('max_file_size'));
    if ($t_file_size > $t_max_file_size) {
        trigger_error(ERROR_FILE_TOO_BIG, ERROR);
    }
    if ('bug' == $p_table) {
        $t_project_id = bug_get_field($p_bug_id, 'project_id');
        $t_id = (int) $p_bug_id;
        $t_bug_id = bug_format_id($p_bug_id);
    } else {
        $t_project_id = helper_get_current_project();
        $t_id = $t_project_id;
        $t_bug_id = 0;
    }
    if ($p_user_id === null) {
        $p_user_id = auth_get_current_user_id();
    }
    if ($p_date_added <= 0) {
        $p_date_added = db_now();
    }
    if ($t_project_id == ALL_PROJECTS) {
        $t_file_path = config_get('absolute_path_default_upload_folder');
    } else {
        $t_file_path = project_get_field($t_project_id, 'file_path');
        if (is_blank($t_file_path)) {
            $t_file_path = config_get('absolute_path_default_upload_folder');
        }
    }
    $t_unique_name = file_generate_unique_name($t_file_path);
    $t_method = config_get('file_upload_method');
    switch ($t_method) {
        case DISK:
            file_ensure_valid_upload_path($t_file_path);
            $t_disk_file_name = $t_file_path . $t_unique_name;
            if (!file_exists($t_disk_file_name)) {
                if (!move_uploaded_file($t_tmp_file, $t_disk_file_name)) {
                    trigger_error(ERROR_FILE_MOVE_FAILED, ERROR);
                }
                chmod($t_disk_file_name, config_get('attachments_file_permissions'));
                $c_content = '';
            } else {
                trigger_error(ERROR_FILE_DUPLICATE, ERROR);
            }
            break;
        case DATABASE:
            $c_content = db_prepare_binary_string(fread(fopen($t_tmp_file, 'rb'), $t_file_size));
            $t_file_path = '';
            break;
        default:
            trigger_error(ERROR_GENERIC, ERROR);
    }
    $t_file_table = db_get_table($p_table . '_file');
    $t_id_col = $p_table . '_id';
    $t_query = 'INSERT INTO ' . $t_file_table . ' ( ' . $t_id_col . ', title, description, diskfile, filename, folder,
		filesize, file_type, date_added, user_id )
	VALUES
		( ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ' )';
    db_query($t_query, array($t_id, $p_title, $p_desc, $t_unique_name, $t_file_name, $t_file_path, $t_file_size, $p_file['type'], $p_date_added, (int) $p_user_id));
    $t_attachment_id = db_insert_id($t_file_table);
    if (db_is_oracle()) {
        db_update_blob($t_file_table, 'content', $c_content, 'diskfile=\'$t_unique_name\'');
    } else {
        $t_query = 'UPDATE ' . $t_file_table . ' SET content=' . db_param() . ' WHERE id = ' . db_param();
        db_query($t_query, array($c_content, $t_attachment_id));
    }
    if ('bug' == $p_table) {
        # update the last_updated date
        if (!$p_skip_bug_update) {
            bug_update_date($p_bug_id);
        }
        # log file added to bug history
        history_log_event_special($p_bug_id, FILE_ADDED, $t_file_name);
    }
//.........这里部分代码省略.........
开发者ID:derrickweaver,项目名称:mantisbt,代码行数:101,代码来源:file_api.php


示例9: mci_file_add

/**
 * Add a file
 * @param integer $p_id        File id.
 * @param string  $p_name      File name.
 * @param string  $p_content   File content to write.
 * @param string  $p_file_type File type.
 * @param string  $p_table     Database table name.
 * @param string  $p_title     Title.
 * @param string  $p_desc      Description.
 * @param string  $p_user_id   User id.
 * @return mixed
 */
function mci_file_add($p_id, $p_name, $p_content, $p_file_type, $p_table, $p_title = '', $p_desc = '', $p_user_id = null)
{
    if (!file_type_check($p_name)) {
        return SoapObjectsFactory::newSoapFault('Client', 'File type not allowed.');
    }
    if (!file_is_name_unique($p_name, $p_id)) {
        return SoapObjectsFactory::newSoapFault('Client', 'Duplicate filename.');
    }
    $t_file_size = strlen($p_content);
    $t_max_file_size = (int) min(ini_get_number('upload_max_filesize'), ini_get_number('post_max_size'), config_get('max_file_size'));
    if ($t_file_size > $t_max_file_size) {
        return SoapObjectsFactory::newSoapFault('Client', 'File is too big.');
    }
    if ('bug' == $p_table) {
        $t_project_id = bug_get_field($p_id, 'project_id');
        $t_id = (int) $p_id;
        $t_issue_id = bug_format_id($p_id);
    } else {
        $t_project_id = $p_id;
        $t_id = $t_project_id;
        $t_issue_id = 0;
    }
    if ($p_user_id === null) {
        $p_user_id = auth_get_current_user_id();
    }
    if ($t_project_id == ALL_PROJECTS) {
        $t_file_path = config_get('absolute_path_default_upload_folder');
    } else {
        $t_file_path = project_get_field($t_project_id, 'file_path');
        if (is_blank($t_file_path)) {
            $t_file_path = config_get('absolute_path_default_upload_folder');
        }
    }
    $t_unique_name = file_generate_unique_name($t_file_path);
    $t_disk_file_name = $t_file_path . $t_unique_name;
    $t_method = config_get('file_upload_method');
    switch ($t_method) {
        case DISK:
            if (!file_exists($t_file_path) || !is_dir($t_file_path) || !is_writable($t_file_path) || !is_readable($t_file_path)) {
                return SoapObjectsFactory::newSoapFault('Server', 'Upload folder \'' . $t_file_path . '\' doesn\'t exist.');
            }
            file_ensure_valid_upload_path($t_file_path);
            if (!file_exists($t_disk_file_name)) {
                mci_file_write_local($t_disk_file_name, $p_content);
                chmod($t_disk_file_name, config_get('attachments_file_permissions'));
                $c_content = "''";
            }
            break;
        case DATABASE:
            $c_content = db_prepare_binary_string($p_content);
            $t_file_path = '';
            break;
    }
    $t_file_table = db_get_table($p_table . '_file');
    $t_id_col = $p_table . '_id';
    $t_param = array($t_id_col => $t_id, 'title' => $p_title, 'description' => $p_desc, 'diskfile' => $t_unique_name, 'filename' => $p_name, 'folder' => $t_file_path, 'filesize' => $t_file_size, 'file_type' => $p_file_type, 'date_added' => db_now(), 'user_id' => (int) $p_user_id);
    # Oracle has to update BLOBs separately
    if (!db_is_oracle()) {
        $t_param['content'] = $c_content;
    }
    $t_query_param = db_param();
    for ($i = 1; $i < count($t_param); $i++) {
        $t_query_param .= ', ' . db_param();
    }
    $t_query = 'INSERT INTO ' . $t_file_table . '
		( ' . implode(', ', array_keys($t_param)) . ' )
	VALUES
		( ' . $t_query_param . ' )';
    db_query($t_query, array_values($t_param));
    # get attachment id
    $t_attachment_id = db_insert_id($t_file_table);
    if (db_is_oracle()) {
        db_update_blob($t_file_table, 'content', $c_content, "diskfile='{$t_unique_name}'");
    }
    if ('bug' == $p_table) {
        # bump the last_updated date
        bug_update_date($t_issue_id);
        # add history entry
        history_log_event_special($t_issue_id, FILE_ADDED, $p_name);
    }
    return $t_attachment_id;
}
开发者ID:martijnveen,项目名称:mantisbt,代码行数:94,代码来源:mc_file_api.php


示例10: tag_bug_detach

/**
 * Detach a tag from a bug.
 * @param integer Tag ID
 * @param integer Bug ID
 * @param boolean Add history entries to bug
 * @param integer User Id (or null for current logged in user)	 
 */
function tag_bug_detach($p_tag_id, $p_bug_id, $p_add_history = true, $p_user_id = null)
{
    if ($p_user_id === null) {
        $t_user_id = auth_get_current_user_id();
    } else {
        $t_user_id = $p_user_id;
    }
    if (!tag_bug_is_attached($p_tag_id, $p_bug_id)) {
        trigger_error(TAG_NOT_ATTACHED, ERROR);
    }
    $t_tag_row = tag_bug_get_row($p_tag_id, $p_bug_id);
    if ($t_user_id == tag_get_field($p_tag_id, 'user_id') || $t_user_id == $t_tag_row['user_id']) {
        $t_detach_level = config_get('tag_detach_own_threshold');
    } else {
        $t_detach_level = config_get('tag_detach_threshold');
    }
    access_ensure_bug_level($t_detach_level, $p_bug_id, $t_user_id);
    $c_tag_id = db_prepare_int($p_tag_id);
    $c_bug_id = db_prepare_int($p_bug_id);
    $t_bug_tag_table = config_get('mantis_bug_tag_table');
    $query = "DELETE FROM {$t_bug_tag_table} \r\n\t\t\t\t\tWHERE tag_id='{$c_tag_id}' AND bug_id='{$c_bug_id}'";
    db_query($query);
    if ($p_add_history) {
        $t_tag_name = tag_get_field($p_tag_id, 'name');
        history_log_event_special($p_bug_id, TAG_DETACHED, $t_tag_name);
    }
    return true;
}
开发者ID:amjadtbssm,项目名称:website,代码行数:35,代码来源:tag_api.php


示例11: bugnote_set_view_state

function bugnote_set_view_state($p_bugnote_id, $p_private)
{
    $c_bugnote_id = db_prepare_int($p_bugnote_id);
    $t_bug_id = bugnote_get_field($p_bugnote_id, 'bug_id');
    if ($p_private) {
        $t_view_state = VS_PRIVATE;
    } else {
        $t_view_state = VS_PUBLIC;
    }
    $t_bugnote_table = config_get('mantis_bugnote_table');
    # update view_state
    $query = "UPDATE {$t_bugnote_table}\r\n\t\t          \tSET view_state='{$t_view_state}'\r\n\t\t          \tWHERE id='{$c_bugnote_id}'";
    db_query($query);
    history_log_event_special($t_bug_id, BUGNOTE_STATE_CHANGED, bugnote_format_id($t_view_state), $p_bugnote_id);
    return true;
}
开发者ID:amjadtbssm,项目名称:website,代码行数:16,代码来源:bugnote_api.php


示例12: sponsorship_update_paid

function sponsorship_update_paid($p_sponsorship_id, $p_paid)
{
    $c_sponsorship_id = db_prepare_int($p_sponsorship_id);
    $t_sponsorship = sponsorship_get($c_sponsorship_id);
    $c_paid = db_prepare_int($p_paid);
    $t_sponsorship_table = config_get('mantis_sponsorship_table');
    $query = "UPDATE {$t_sponsorship_table}\r\n\t\t\t\t  SET last_updated= " . db_now() . ", paid={$c_paid}\r\n\t\t\t\t  WHERE id='{$c_sponsorship_id}'";
    db_query($query);
    history_log_event_special($t_sponsorship->bug_id, BUG_PAID_SPONSORSHIP, $t_sponsorship->user_id, $p_paid);
    sponsorship_clear_cache($p_sponsorship_id);
    return true;
}
开发者ID:amjadtbssm,项目名称:website,代码行数:12,代码来源:sponsorship_api.php


示例13: mc_issue_relationship_delete

/**
 * Delete the relationship with the specified target id.
 *
 * @param string $p_username  The name of the user trying to add a note to an issue.
 * @param string $p_password  The password of the user.
 * @param integer $p_issue_id  The id of the source issue for the relationship
 * @param integer $p_relationship_id  The id of relationship to delete.
 * @return true: success, false: failure
 */
function mc_issue_relationship_delete($p_username, $p_password, $p_issue_id, $p_relationship_id)
{
    $t_user_id = mci_check_login($p_username, $p_password);
    if ($t_user_id === false) {
        return new soap_fault('Client', '', 'Access Denied');
    }
    $t_project_id = bug_get_field($p_issue_id, 'project_id');
    if (!mci_has_readwrite_access($t_user_id, $t_project_id)) {
        return new soap_fault('Client', '', 'Access Denied');
    }
    # user has access to update the bug...
    if (!access_has_bug_level(config_get('update_bug_threshold'), $p_issue_id, $t_user_id)) {
        return new soap_fault('Client', '', "Active user does not have access level required to remove a relationship from this issue.");
    }
    # bug is not read-only...
    if (bug_is_readonly($p_issue_id)) {
        return new soap_fault('Client', '', "Issue '{$p_issue_id}' is readonly.");
    }
    # retrieve the destination bug of the relationship
    $t_dest_issue_id = relationship_get_linked_bug_id($p_relationship_id, $p_issue_id);
    # user can access to the related bug at least as viewer, if it's exist...
    if (bug_exists($t_dest_issue_id)) {
        if (!access_has_bug_level(VIEWER, $t_dest_issue_id, $t_user_id)) {
            return new soap_fault('Client', '', "The issue '{$t_dest_issue_id}' requires higher access level.");
        }
    }
    $t_bug_relationship_data = relationship_get($p_relationship_id);
    $t_rel_type = $t_bug_relationship_data->type;
    # delete relationship from the DB
    relationship_delete($p_relationship_id);
    # update bug last updated (just for the src bug)
    bug_update_date($p_issue_id);
    # set the rel_type for both bug and dest_bug based on $t_rel_type and on who is the dest bug
    if ($p_issue_id == $t_bug_relationship_data->src_bug_id) {
        $t_bug_rel_type = $t_rel_type;
        $t_dest_bug_rel_type = relationship_get_complementary_type($t_rel_type);
    } else {
        $t_bug_rel_type = relationship_get_complementary_type($t_rel_type);
        $t_dest_bug_rel_type = $t_rel_type;
    }
    # send email and update the history for the src issue
    history_log_event_special($p_issue_id, BUG_DEL_RELATIONSHIP, $t_bug_rel_type, $t_dest_issue_id);
    email_relationship_deleted($p_issue_id, $t_dest_issue_id, $t_bug_rel_type);
    if (bug_exists($t_dest_issue_id)) {
        # send email and update the history for the dest issue
        history_log_event_special($t_dest_issue_id, BUG_DEL_RELATIONSHIP, $t_dest_bug_rel_type, $p_issue_id);
        email_relationship_deleted($t_dest_issue_id, $p_issue_id, $t_dest_bug_rel_type);
    }
    return true;
}
开发者ID:jin255ff,项目名称:company_website,代码行数:59,代码来源:mc_issue_api.php


示例14: bug_unmonitor

function bug_unmonitor($p_bug_id, $p_user_id)
{
    $c_bug_id = db_prepare_int($p_bug_id);
    $c_user_id = db_prepare_int($p_user_id);
    $t_bug_monitor_table = config_get('mantis_bug_monitor_table');
    # Delete monitoring record
    $query = "DELETE " . "FROM {$t_bug_monitor_table} " . "WHERE bug_id = '{$c_bug_id}'";
    if ($p_user_id !== null) {
        $query .= " AND user_id = '{$c_user_id}'";
    }
    db_query($query);
    # log new un-monitor action
    history_log_event_special($p_bug_id, BUG_UNMONITOR, $p_user_id);
    return true;
}
开发者ID:jin255ff,项目名称:company_website,代码行数:15,代码来源:bug_api.php


示例15: sponsorship_update_paid

/**
 * updates the paid field
 * @param integer $p_sponsorship_id The sponsorship identifier to update.
 * @param integer $p_paid           The value to set to paid database field to.
 * @return boolean
 */
function sponsorship_update_paid($p_sponsorship_id, $p_paid)
{
    $t_sponsorship = sponsorship_get($p_sponsorship_id);
    $t_query = 'UPDATE {sponsorship} SET last_updated=' . db_param() . ', paid=' . db_param() . ' WHERE id=' . db_param();
    db_query($t_query, array(db_now(), (int) $p_paid, (int) $p_sponsorship_id));
    history_log_event_special($t_sponsorship->bug_id, BUG_PAID_SPONSORSHIP, $t_sponsorship->user_id, $p_paid);
    sponsorship_clear_cache($p_sponsorship_id);
    return true;
}
开发者ID:gtn,项目名称:mantisbt,代码行数:15,代码来源:sponsorship_api.php


示例16: file_add

/**
 * Add a file to the system using the configured storage method
 *
 * @param integer $p_bug_id the bug id
 * @param array $p_file the uploaded file info, as retrieved from gpc_get_file()
 */
function file_add($p_bug_id, $p_file, $p_table = 'bug', $p_title = '', $p_desc = '', $p_user_id = null)
{
    file_ensure_uploaded($p_file);
    $t_file_name = $p_file['name'];
    $t_tmp_file = $p_file['tmp_name'];
    if (!file_type_check($t_file_name)) {
        trigger_error(ERROR_FILE_NOT_ALLOWED, ERROR);
    }
    if (!file_is_name_unique($t_file_name, $p_bug_id)) {
        trigger_error(ERROR_FILE_DUPLICATE, ERROR);
    }
    if ('bug' == $p_table) {
        $t_project_id = bug_get_field($p_bug_id, 'project_id');
        $t_bug_id = bug_format_id($p_bug_id);
    } else {
        $t_project_id = helper_get_current_project();
        $t_bug_id = 0;
    }
    if ($p_user_id === null) {
        $c_user_id = auth_get_current_user_id();
    } else {
        $c_user_id = (int) $p_user_id;
    }
    # prepare variables for insertion
    $c_bug_id = db_prepare_int($p_bug_id);
    $c_project_id = db_prepare_int($t_project_id);
    $c_file_type = db_prepare_string($p_file['type']);
    $c_title = db_prepare_string($p_title);
    $c_desc = db_prepare_string($p_desc);
    if ($t_project_id == ALL_PROJECTS) {
        $t_file_path = config_get('absolute_path_default_upload_folder');
    } else {
        $t_file_path = project_get_field($t_project_id, 'file_path');
        if (is_blank($t_file_path)) {
            $t_file_path = config_get('absolute_path_default_upload_folder');
        }
    }
    $c_file_path = db_prepare_string($t_file_path);
    $c_new_file_name = db_prepare_string($t_file_name);
    $t_file_hash = 'bug' == $p_table ? $t_bug_id : config_get('document_files_prefix') . '-' . $t_project_id;
    $t_unique_name = file_generate_unique_name($t_file_hash . '-' . $t_file_name, $t_file_path);
    $t_disk_file_name = $t_file_path . $t_unique_name;
    $c_unique_name = db_prepare_string($t_unique_name);
    $t_file_size = filesize($t_tmp_file);
    if (0 == $t_file_size) {
        trigger_error(ERROR_FILE_NO_UPLOAD_FAILURE, ERROR);
    }
    $t_max_file_size = (int) min(ini_get_number('upload_max_filesize'), ini_get_number('post_max_size'), config_get('max_file_size'));
    if ($t_file_size > $t_max_file_size) {
        trigger_error(ERROR_FILE_TOO_BIG, ERROR);
    }
    $c_file_size = db_prepare_int($t_file_size);
    $t_method = config_get('file_upload_method');
    switch ($t_method) {
        case FTP:
        case DISK:
            file_ensure_valid_upload_path($t_file_path);
            if (!file_exists($t_disk_file_name)) {
                if (FTP == $t_method) {
                    $conn_id = file_ftp_connect();
                    file_ftp_put($conn_id, $t_disk_file_name, $t_tmp_file);
                    file_ftp_disconnect($conn_id);
                }
                if (!move_uploaded_file($t_tmp_file, $t_disk_file_name)) {
                    trigger_error(ERROR_FILE_MOVE_FAILED, ERROR);
                }
                chmod($t_disk_file_name, config_get('attachments_file_permissions'));
                $c_content = "''";
            } else {
                trigger_error(ERROR_FILE_DUPLICATE, ERROR);
            }
            break;
        case DATABASE:
            $c_content = db_prepare_binary_string(fread(fopen($t_tmp_file, 'rb'), $t_file_size));
            break;
        default:
            trigger_error(ERROR_GENERIC, ERROR);
    }
    $t_file_table = db_get_table('mantis_' . $p_table . '_file_table');
    $c_id = 'bug' == $p_table ? $c_bug_id : $c_project_id;
    $query = "INSERT INTO {$t_file_table}\n\t\t\t\t\t\t(" . $p_table . "_id, title, description, diskfile, filename, folder, filesize, file_type, date_added, content, user_id)\n\t\t\t\t\t  VALUES\n\t\t\t\t\t\t({$c_id}, '{$c_title}', '{$c_desc}', '{$c_unique_name}', '{$c_new_file_name}', '{$c_file_path}', {$c_file_size}, '{$c_file_type}', '" . db_now() . "', {$c_content}, {$c_user_id})";
    db_query($query);
    if ('bug' == $p_table) {
        # updated the last_updated date
        $result = bug_update_date($p_bug_id);
        # log new bug
        history_log_event_special($p_bug_id, FILE_ADDED, $t_file_name);
    }
}
开发者ID:fur81,项目名称:zofaxiopeu,代码行数:95,代码来源:file_api.php


示例17: error_parameters

if (bug_exists($t_dest_bug_id)) {
    if (!access_has_bug_level(VIEWER, $t_dest_bug_id)) {
        error_parameters($t_dest_bug_id);
        trigger_error(ERROR_RELATIONSHIP_ACCESS_LEVEL_TO_DEST_BUG_TOO_LOW, ERROR);
    }
}
helper_ensure_confirmed(lang_get('delete_relationship_sure_msg'), lang_get('delete_relationship_button'));
$t_bug_relationship_data = relationship_get($f_rel_id);
$t_rel_type = $t_bug_relationship_data->type;
# delete relationship from the DB
relationship_delete($f_rel_id);
# update bug last updated (just for the src bug)
bug_update_date($f_bug_id);
# set the rel_type for both bug and dest_bug based on $t_rel_type and on who is the dest bug
if ($f_bug_id == $t_bug_relationship_data->src_bug_id) {
    $t_bug_rel_type = $t_rel_type;
    $t_dest_bug_rel_type = relationship_ 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP hm函数代码示例发布时间:2022-05-15
下一篇:
PHP history_log_event_direct函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap