<?php

# ---------------------------------------------------------------------
# rth is a requirement, test, and bugtracking system
# Copyright (C) 2005 George Holbrook - rth@lists.sourceforge.net
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details
#----------------------------------------------------------------------
# ---------------------------------------------------------------------
# Test Set Edit Description Page
#
# $RCSfile: testset_edit_description_action.php,v $  $Revision: 1.1.1.1 $
# ---------------------------------------------------------------------
include "./api/include_api.php";
auth_authenticate_user();
$redirect_page = 'testset_page.php';
$edit_page = 'testset_edit_description_page.php';
session_validate_form_set($_POST, $edit_page);
#### Call api function to add/update database passing in form field values ####
admin_edit_testset(util_clean_post_vars('testset_id'), session_validate_form_get_field('testset_edit_name_required'), session_validate_form_get_field('testset_edit_date'), session_validate_form_get_field('testset_edit_description'));
session_validate_form_reset();
html_print_operation_successful('release_page', $redirect_page);
# ---------------------------------------------------------------------
# $Log: testset_edit_description_action.php,v $
# Revision 1.1.1.1  2005/11/30 23:00:58  gth2
# importing initial version - gth
#
# ---------------------------------------------------------------------
# Copyright (C) 2005 George Holbrook - rth@lists.sourceforge.net
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details
#----------------------------------------------------------------------
# ------------------------------------
# Project Add Action
#
# $RCSfile: project_add_action.php,v $  $Revision: 1.5 $
# ------------------------------------
include "./api/include_api.php";
auth_authenticate_user();
$project_id = session_get_project_id();
$add_page = 'project_add_page.php';
$redirect_page = 'admin_page.php';
$proj_properties = session_get_properties("project_manage");
session_validate_form_set($_POST, $add_page);
$project_name = session_validate_form_get_field('project_name_required');
$project_folder_name = str_replace(" ", "", $project_name);
$project_description = session_validate_form_get_field('project_description');
$req_docs = FILE_UPLOAD_PATH . $project_folder_name . "_req_docs/";
$test_docs = FILE_UPLOAD_PATH . $project_folder_name . "_test_docs/";
$test_run_docs = FILE_UPLOAD_PATH . $project_folder_name . "_test_run_docs/";
$test_plan_docs = FILE_UPLOAD_PATH . $project_folder_name . "_test_plan_docs/";
$defect_docs = FILE_UPLOAD_PATH . $project_folder_name . "_defect_docs/";
# check username unique
if (!is_null(project_get_id($project_name))) {
    error_report_show($add_page, PROJECT_NOT_UNIQUE);
}
if (mkdir($req_docs, 0700) && mkdir($test_docs, 0700) && mkdir($test_run_docs, 0700) && mkdir($test_plan_docs, 0700) && mkdir($defect_docs, 0700)) {
    project_add($project_name, $project_description, $_POST['project_status'], isset($_POST['show_custom_1']) ? "Y" : "N", isset($_POST['show_custom_2']) ? "Y" : "N", isset($_POST['show_custom_3']) ? "Y" : "N", isset($_POST['show_custom_4']) ? "Y" : "N", isset($_POST['show_custom_5']) ? "Y" : "N", isset($_POST['show_custom_6']) ? "Y" : "N", isset($_POST['show_window']) ? "Y" : "N", isset($_POST['show_object']) ? "Y" : "N", isset($_POST['show_memory_stats']) ? "Y" : "N", isset($_POST['show_priority']) ? "Y" : "N", isset($_POST['show_test_input']) ? "Y" : "N", $req_docs, $test_docs, $test_run_docs, $test_plan_docs, $defect_docs);
} else {
#----------------------------------------------------------------------
# ---------------------------------------------------------------------
# Test Detail New Upload Action Page
#
# $RCSfile: test_detail_new_upload_action.php,v $  $Revision: 1.8 $
# ---------------------------------------------------------------------
include "./api/include_api.php";
auth_authenticate_user();
$page = basename(__FILE__);
$s_test_details = session_get_properties("test");
$project_prop = session_get_project_properties();
$test_id = $s_test_details['test_id'];
$project_id = $project_prop['project_id'];
$redirect_page = "test_detail_page.php?test_id={$test_id}&project_id={$project_id}&tab=2";
$redirect_on_error = "test_detail_page.php?test_id={$test_id}&project_id={$project_id}&tab=2";
session_validate_form_set($_POST, $redirect_page);
$project_properties = session_get_project_properties();
$upload_path = $project_properties['test_upload_path'];
$s_user = session_get_user_properties();
$username = $s_user['username'];
$test_name = test_get_name($test_id);
$comments = session_validate_form_get_field('comments');
$doc_type = session_validate_form_get_field('doc_type');
$upload_file_name = $_FILES['uploadfile']['name'];
$_FILES['uploadfile']['name'] = str_replace(" ", "_", $upload_file_name);
# ------------------------------------------------
# FILE UPLOAD
# ------------------------------------------------
if ($_FILES['uploadfile']['size'] != '0' && is_uploaded_file($_FILES['uploadfile']['tmp_name'])) {
    file_add_supporting_test_doc($_FILES['uploadfile']['tmp_name'], $_FILES['uploadfile']['name'], $test_id, $comments, $doc_type);
} else {
# Copyright (C) 2005 George Holbrook - rth@lists.sourceforge.net
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details
#----------------------------------------------------------------------
# ------------------------------------
# Page name
#
# $RCSfile: screen_edit_action.php,v $
# $Revision: 1.1 $
# ------------------------------------
include "./api/include_api.php";
auth_authenticate_user();
$s_project_properties = session_get_project_properties();
$project_id = $s_project_properties['project_id'];
$redirect_page = 'screen_page.php';
$redirect_on_error = 'screen_edit_page.php';
session_validate_form_set($_POST, $redirect_on_error);
# Make sure the screen name doesn't already exist for this project
$num = test_screen_name_exists($project_id, session_validate_form_get_field('screen_name_required'));
if ($num > 1) {
    error_report_show($redirect_page, DUPLICATE_SCREEN_NAME);
}
test_update_screen(session_validate_form_get_field('screen_id'), session_validate_form_get_field('screen_name_required'), session_validate_form_get_field('screen_desc'), session_validate_form_get_field('screen_order'));
session_validate_form_reset();
html_print_operation_successful('screen_page', $redirect_page);
# ------------------------------------
# $Log: screen_edit_action.php,v $
# Revision 1.1  2006/05/03 20:24:01  gth2
# no message
#
# ------------------------------------
# ---------------------------------------------------------------------
# Test Detail Update Action Page
#
# $RCSfile: test_detail_update_action.php,v $  $Revision: 1.10 $
# ---------------------------------------------------------------------
include "./api/include_api.php";
auth_authenticate_user();
$project_properties = session_get_project_properties();
$project_id = $project_properties['project_id'];
$username = session_get_username();
$s_test_details = session_get_properties("test");
$test_id = $s_test_details['test_id'];
$test_version_id = $s_test_details['test_version_id'];
$redirect_page = "test_detail_page.php?test_id={$test_id}&project_id={$project_id}";
$current_test_name = test_get_name($test_id);
session_validate_form_set($_POST, "test_detail_update_page.php");
$testname = session_validate_form_get_field('testname_required');
$testpurpose = session_validate_form_get_field('testpurpose');
$testcomments = session_validate_form_get_field('testcomments');
$testpriority = session_validate_form_get_field('testpriority');
$teststatus = session_validate_form_get_field('teststatus');
$testareatested = session_validate_form_get_field('testareatested');
$testtype = session_validate_form_get_field('testtype');
$ba_owner = session_validate_form_get_field('ba_owner');
$qa_owner = session_validate_form_get_field('qa_owner');
$tester = session_validate_form_get_field('tester');
$assigned_to = session_validate_form_get_field('assigned_to');
$assigned_by = session_validate_form_get_field('assigned_by');
$dateassigned = session_validate_form_get_field('dateassigned');
$dateexpcomplete = session_validate_form_get_field('dateexpcomplete');
$dateactcomplete = session_validate_form_get_field('dateactcomplete');
#----------------------------------------------------------------------
# ---------------------------------------------------------------------
# Test Step Edit Action Page
#
# $RCSfile: test_step_edit_action.php,v $  $Revision: 1.6 $
# ---------------------------------------------------------------------
include "./api/include_api.php";
auth_authenticate_user();
$test_id = $_POST['test_id'];
$test_step_id = $_POST['test_step_id'];
//$test_version_id	= $_POST['test_version_id'];
$project_id = session_get_project_id();
$page = 'test_step_edit_page.php';
$error_page = 'test_step_edit_page.php?test_step_id=' . $test_step_id . '&test_id=' . $test_id;
$redirect_page = 'test_detail_page.php?test_id=' . $test_id . '&project_id=' . $project_id;
session_validate_form_set($_POST, $error_page);
$info_step = "N";
if (isset($_POST['info_step'])) {
    $info_step = "Y";
}
#added to every session_validate... mysql_real_escape_string(), because it doesnt work for session_validate...(fck-textfield)
test_update_test_step($test_id, $test_step_id, session_validate_form_get_field('location'), mysql_real_escape_string(session_validate_form_get_field('step_action_required', "", session_use_FCKeditor())), mysql_real_escape_string(session_validate_form_get_field('step_input', "", session_use_FCKeditor())), mysql_real_escape_string(session_validate_form_get_field('step_expected_required', "", session_use_FCKeditor())), $info_step);
session_validate_form_reset();
html_print_operation_successful("edit_test_step_page", $redirect_page);
# ---------------------------------------------------------------------
# $Log: test_step_edit_action.php,v $
# Revision 1.6  2009/03/26 08:04:05  sca_gs
# fixed problem with wrong caption
#
# Revision 1.5  2008/07/21 07:42:34  peter_thal
# small bug fixes for test_detail_page linking parameter
auth_authenticate_user();
$page = basename(__FILE__);
$s_results = session_get_properties("results");
$release_id = $s_results['release_id'];
$build_id = $s_results['build_id'];
$testset_id = $s_results['testset_id'];
$test_run_id = $_POST['test_run_id'];
$test_id = $s_results['test_id'];
$continue_test_page = "results_continue_manual_test_page.php?test_id={$test_id}&testset_id={$testset_id}&test_run_id={$test_run_id}";
$redirect_page = "results_view_verifications_page.php?test_id={$test_id}&testset_id={$testset_id}&test_run_id={$test_run_id}";
$redirect_page_file_upload = "{$page}?test_id={$test_id}&testset_id={$testset_id}";
$project_properties = session_get_project_properties();
$project_name = $project_properties['project_name'];
$project_id = $project_properties['project_id'];
$project_id = session_get_project_id();
session_validate_form_set($_POST, $continue_test_page);
$s_user = session_get_user_properties();
$username = $s_user['username'];
$test_name = test_get_name($test_id);
//$test_run_id		= $_POST["test_run_id"];
$time_finished = date("Y-m-d H:i:s");
$time_started = '';
$comments = session_validate_form_get_field('test_run_comments');
$test_status = session_validate_form_get_field('test_run_status_required');
$root_cause = session_validate_form_get_field('root_cause');
$environment = session_validate_form_get_field('environment');
$duration = session_validate_form_get_field('duration');
$os = session_validate_form_get_field('os');
//print_r($_POST);
if ($duration != '') {
    $time_started = results_caculate_time_started($duration);
# ---------------------------------------------------------------------
# rth is a requirement, test, and bugtracking system
# Copyright (C) 2005 George Holbrook - rth@lists.sourceforge.net
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details
#----------------------------------------------------------------------
# ---------------------------------------------------------------------
# Requirement Test Assoc Action Page
#
# $RCSfile: requirement_test_assoc_action.php,v $  $Revision: 1.1.1.1 $
# ---------------------------------------------------------------------
include "./api/include_api.php";
auth_authenticate_user();
$s_project_properties = session_get_project_properties();
$project_name = $s_project_properties['project_name'];
$project_id = $s_project_properties['project_id'];
$s_properties = session_set_properties("requirements", $_GET);
$s_req_id = $s_properties['req_id'];
$s_req_version_id = $s_properties['req_version_id'];
$redirect_page = 'requirement_tests_assoc_page.php';
session_records("requirement_tests_assoc");
session_validate_form_set($_POST);
requirement_edit_assoc_tests($s_req_id, "requirement_tests_assoc", "percent_covered_");
session_validate_form_reset();
html_print_operation_successful("req_assoc_tests_page", $redirect_page);
# ---------------------------------------------------------------------
# $Log: requirement_test_assoc_action.php,v $
# Revision 1.1.1.1  2005/11/30 23:00:58  gth2
# importing initial version - gth
#
# ---------------------------------------------------------------------
# Test Detail Copy Action Page
#
# $RCSfile: test_detail_copy_action.php,v $  $Revision: 1.2 $
# ---------------------------------------------------------------------
include "./api/include_api.php";
auth_authenticate_user();
session_clear_form_values();
$redirect_page = 'test_page.php';
$test_detail_copy_page = "test_detail_copy_page.php";
# if $assoc_req==0, then the requirement is not a child of any other requirement
if (isset($_POST["assoc_req"])) {
    $assoc_req = $_POST["assoc_req"];
} else {
    $assoc_req = 0;
}
session_validate_form_set($_POST, $test_detail_copy_page);
$project_id = project_get_id(session_validate_form_get_field('copy_to_project'));
$from_test_id = session_validate_form_get_field('test_id');
$testname = session_validate_form_get_field('testname_required');
$testpurpose = session_validate_form_get_field('testpurpose');
$testcomments = session_validate_form_get_field('testcomments');
$testpriority = session_validate_form_get_field('testpriority');
$teststatus = session_validate_form_get_field('teststatus');
$testareatested = session_validate_form_get_field('testareatested_required');
$testtype = session_validate_form_get_field('testtype_required');
$ba_owner = session_validate_form_get_field('ba_owner');
$qa_owner = session_validate_form_get_field('qa_owner_required');
$tester = session_validate_form_get_field('tester');
$assigned_to = session_validate_form_get_field('assigned_to');
$assigned_by = session_validate_form_get_field('assigned_by');
$dateassigned = session_validate_form_get_field('dateassigned');
$page = basename(__FILE__);
$s_results = session_get_properties("results");
$test_id = $s_results['test_id'];
$testset_id = $s_results['testset_id'];
$run_test_page = "results_run_manual_test_page.php?test_id={$test_id}&testset_id={$testset_id}";
$redirect_page = "results_test_run_page.php?test_id={$test_id}&testset_id={$testset_id}";
$redirect_file_upload = $page . "?test_id={$test_id}&testset_id={$testset_id}";
$project_properties = session_get_project_properties();
$project_name = $project_properties['project_name'];
$project_id = $project_properties['project_id'];
$s_results = session_get_properties("results");
$release_id = $s_results['release_id'];
$build_id = $s_results['build_id'];
$testset_id = $s_results['testset_id'];
$test_id = $s_results['test_id'];
session_validate_form_set($_POST, $run_test_page);
$s_user = session_get_user_properties();
$username = $s_user['username'];
$test_name = test_get_name($test_id);
$x = microtime();
$millisecond = substr($x, 2, 3);
$test_run_id = "M" . time() . $millisecond;
$time_finished = date("Y-m-d H:i:s");
$time_started = '';
$comments = session_validate_form_get_field('test_run_comments');
$test_status = session_validate_form_get_field('test_run_status_required');
$root_cause = session_validate_form_get_field('root_cause');
$environment = session_validate_form_get_field('environment');
$duration = session_validate_form_get_field('duration');
$os = session_validate_form_get_field('os');
/*
<?php

# ---------------------------------------------------------------------
# rth is a requirement, test, and bugtracking system
# Copyright (C) 2005 George Holbrook - rth@lists.sourceforge.net
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details
#----------------------------------------------------------------------
# ---------------------------------------------------------------------
# Requirement Edit Action Page
#
# $RCSfile: requirement_edit_action.php,v $  $Revision: 1.6 $
# ---------------------------------------------------------------------
include "./api/include_api.php";
auth_authenticate_user();
session_validate_form_set($_POST, "requirement_edit_page.php");
if ($_POST['record_or_file'] == "R") {
    $detail = session_validate_form_get_field('req_detail_required', "", session_use_FCKeditor());
} else {
    $detail = "";
}
$redirect_on_error = "requirement_edit_page.php?failed=true&error=280";
$project_id = $_POST["project_id"];
$req_id = $_POST["req_id"];
$req_version_id = $_POST["req_ver_id"];
$reason_for_change = session_validate_form_get_field("req_reason_change", "", session_use_FCKeditor());
$req_name = session_validate_form_get_field('req_name_required');
$req_area = session_validate_form_get_field('req_area');
$req_type = session_validate_form_get_field('req_type');
$req_status = session_validate_form_get_field('req_status');
$req_functionality = session_validate_form_get_field("req_functionality");
# ---------------------------------------------------------------------
# rth is a requirement, test, and bugtracking system
# Copyright (C) 2005 George Holbrook - rth@lists.sourceforge.net
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details
#----------------------------------------------------------------------
# ------------------------------------
# Requirement Add New Version Action
#
# $RCSfile: requirement_add_new_version_action.php,v $  $Revision: 1.7 $
# ------------------------------------
include "./api/include_api.php";
auth_authenticate_user();
//print_r($_POST);exit;
session_validate_form_set($_POST, "requirement_add_new_version_page.php");
# if requirement is a file
if ($_POST['req_record_or_file'] == "F") {
    $uploaded_filename = file_add_requirement("requirement_add_new_version_page.php");
    //"requirement_detail_page.php");
    $detail = "";
} else {
    $uploaded_filename = "";
    $detail = session_validate_form_get_field('req_detail_required', "", session_use_FCKeditor());
}
$redirect_on_error = "requirement_add_new_version_page.php?failed=true&error=280";
$project_id = $_POST["project_id"];
$req_id = $_POST["req_id"];
$req_name = session_validate_form_get_field('req_name_required');
$req_area = session_validate_form_get_field('req_area');
$req_type = session_validate_form_get_field('req_type');