Пример #1
0
                $t_result[0]['error'] = 0;
            }
        } else {
            if (func_num_args() > 1) {
                # check for a default passed in (allowing null)
                $t_result = $p_default;
            } else {
                error_parameters($p_var_name);
                trigger_error(ERROR_GPC_VAR_NOT_FOUND, ERROR);
            }
        }
    }
    return $t_result;
}
$f_bug_id = gpc_get_int('bug_id', -1);
$f_files = gpc_get_fileCustom('ufile', -1);
if ($f_bug_id == -1 && $f_files == -1) {
    # _POST/_FILES does not seem to get populated if you exceed size limit so check if bug_id is -1
    trigger_error(ERROR_FILE_TOO_BIG, ERROR);
}
form_security_validate('bug_file_add');
$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;
}
if (!file_allow_bug_upload($f_bug_id)) {
    access_denied();
}
access_ensure_bug_level(config_get('upload_bug_file_threshold'), $f_bug_id);
                $t_result[0]['type'] = "image/png";
                $t_result[0]['size'] = strlen($data);
                $t_result[0]['tmp_name'] = $fn;
                $t_result[0]['error'] = 0;
            }
        } else {
            if (func_num_args() > 1) {
                # check for a default passed in (allowing null)
                $t_result = $p_default;
            } else {
                error_parameters($p_var_name);
                trigger_error(ERROR_GPC_VAR_NOT_FOUND, ERROR);
            }
        }
    }
    return $t_result;
}
$f_bug_id = gpc_get_int('bug_id', -1);
$f_files = gpc_get_fileCustom('pic', -1);
if ($f_bug_id == -1 && $f_files == -1) {
    # _POST/_FILES does not seem to get populated if you exceed size limit so check if bug_id is -1
    trigger_error(ERROR_FILE_TOO_BIG, ERROR);
}
$t_bug = bug_get($f_bug_id, true);
if (!file_allow_bug_upload($f_bug_id)) {
    access_denied();
}
access_ensure_bug_level(config_get('upload_bug_file_threshold'), $f_bug_id);
file_add($f_bug_id, $f_files, 'bug', '', '', 1);
#Message de succès d'envoi
exit_status(plugin_lang_get('file_was_uploaded_successfuly'));