コード例 #1
0
function html_page_header($db, $current_proj)
{
    $s_user_projects = session_get_user_projects();
    $s_user_properties = session_get_user_properties();
    $date = date_get_long_dt();
    $message = lang_get('error_empty_id_field');
    $username = $s_user_properties['username'];
    print "<form method=post name=navigate_to_id id=form_validate action='navigate_to_id_action.php' >" . NEWLINE;
    print "<table class=hide100>" . NEWLINE;
    print "<tr><td class=header-r>" . NEWLINE;
    print lang_get('goto_to_id') . NEWLINE;
    print "<input type=text size=6 id='validate_txt_field' name=id_txt_field>" . NEWLINE;
    #print'<a href="javascript:return ValidateForm(\''.$message.'\')">'. lang_get('go') .'</a></td>'. NEWLINE;
    print "<input type=submit value='" . lang_get('go') . "'>";
    #</td>";
    print "</td></tr>" . NEWLINE;
    print "</table>" . NEWLINE;
    print "</form>" . NEWLINE;
    print "<form method=post name=form_set_project action='login_switch_proj.php'>" . NEWLINE;
    print "<table class=hide100>" . NEWLINE;
    print "<tr>" . NEWLINE;
    print "<td class=header-l width='33%'>logged in as {$username}</td>" . NEWLINE;
    print "<td class=header-c width='33%'>{$date}</td>" . NEWLINE;
    if ($s_user_projects > 1) {
        # display the project list box
        print "<td class=header-r width='33%'>" . NEWLINE;
        # Check for Javascript
        print "<noscript>" . NEWLINE;
        print "<input type=hidden name=javascript_disabled value=true>" . NEWLINE;
        print "</noscript>" . NEWLINE;
        # login variables set, so there is no need to do if( isset($_GET[login][page]) )
        # in login_switch_proj.php
        print "<input type=hidden name='login[page]' value=''>" . NEWLINE;
        print "<input type=hidden name='login[get]' value=''>" . NEWLINE;
        print "<input type=hidden name='uname' value='{$username}'>" . NEWLINE;
        # Check for Javascript
        print "<noscript>" . NEWLINE;
        print "<input type=hidden name=non_javascript_browser value=true>" . NEWLINE;
        print "</noscript>" . NEWLINE;
        if (session_use_javascript()) {
            print lang_get('switch_project') . NEWLINE;
        } else {
            print "<input type=submit value='" . lang_get('switch_project') . "'>" . NEWLINE;
        }
        print "<select name='login[switch_project]' onchange='document.forms.form_set_project.submit();'>" . NEWLINE;
        html_print_list_box_from_array($s_user_projects, $current_proj);
        print "</select>" . NEWLINE;
        print "</td>" . NEWLINE;
    } else {
        # don't display the project list box
        print "<td class=header-r width=33%>&nbsp</td>" . NEWLINE;
    }
    print "</tr>" . NEWLINE;
    print "</table>" . NEWLINE;
    print "</form>" . NEWLINE;
}
コード例 #2
0
function project_delete($project_id)
{
    global $db;
    $tbl_project = PROJECT_TBL;
    $f_proj_id = $tbl_project . "." . PROJ_ID;
    $f_proj_deleted = $tbl_project . "." . PROJ_DELETED;
    $q = "\tUPDATE \t{$tbl_project}\n\t\t\tSET\t\t{$f_proj_deleted} = 'Y'\n\t\t\tWHERE\t{$f_proj_id} = {$project_id}";
    # get project name and remove it from the session
    $project_name = project_get_name($project_id);
    //print"project_name = $project_name<br>";
    $s_user_projects = session_get_user_projects();
    foreach ($s_user_projects as $key => $session_project) {
        if ($project_name == $session_project) {
            unset($_SESSION['s_user_projects'][$key]);
        }
    }
    // fix to remove files for project as well provided by SPKannan
    //	$project_folder_name	= str_replace(" ", "", $project_name);
    //	$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/";
    //
    //	for ($i = 1; $i <= 5; $i++)
    //	{
    //		if ($i == 1)
    //		{
    //			$dir = $req_docs;
    //		}
    //
    //		if ($i ==2)
    //		{
    //			$dir = $test_docs;
    //		}
    //
    //		if ($i == 3)
    //		{
    //			$dir = $test_run_docs;
    //		}
    //
    //		if ($i == 4)
    //		{
    //			$dir = $test_plan_docs;
    //		}
    //
    //		if($i == 5)
    //		{
    //			$dir = $defect_docs;
    //		}
    //
    //		if ($handle = opendir($dir))
    //		{
    //		$array = array();
    //
    //		    while (false !== ($file = readdir($handle))) {
    //		        if ($file != "." && $file != "..") {
    //
    //		            if(is_dir($dir.$file))
    //		            {
    //		                if(!@rmdir($dir.$file)) // Empty directory? Remove it
    //		                {
    //		                delete_directory($dir.$file.'/'); // Not empty? Delete the files inside it
    //		                }
    //		            }
    //		            else
    //		            {
    //		               @unlink($dir.$file);
    //		            }
    //		        }
    //		    }
    //		    closedir($handle);
    //
    //		    @rmdir($dir);
    //		}  # if loop end
    //
    //	} #For loop end
    //	// end fix be SPKannan
    db_query($db, $q);
}