blob: 2145d3a43a2309fb8b056b868a1302021a1b996e [file] [log] [blame]
droy8aedeec2008-01-25 19:04:14 +00001<?php
2/*******************************************************************************
3 * Copyright (c) 2008 Eclipse Foundation and others.
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Eclipse Foundation - Initial API and implementation
11*******************************************************************************/
12include("global.php");
13InitPage("login");
14
15global $User;
16global $App, $dbh;
17if(!$User->is_committer) {
18 exitTo("error.php?errNo=3214","error: 3214 - you must be an Eclipse committer to access this page.");
19}
20
21require(BABEL_BASE_DIR . "classes/file/file.class.php");
22
23
24$pageTitle = "Babel - Define Map Files";
25$pageKeywords = "";
26$incfile = "content/en_map_files.php";
27
28$PROJECT_ID = $App->getHTTPParameter("project_id");
29$VERSION = $App->getHTTPParameter("version");
30$LOCATION = $App->getHTTPParameter("location");
31$FILENAME = $App->getHTTPParameter("filename");
32$SUBMIT = $App->getHTTPParameter("submit");
33
34if($SUBMIT == "Save") {
35 if($PROJECT_ID != "" && $VERSION != "" && $LOCATION != "") {
36 $sql = "INSERT INTO map_files VALUES ("
37 . $App->returnQuotedString($App->sqlSanitize($PROJECT_ID, $dbh))
38 . "," . $App->returnQuotedString($App->sqlSanitize($VERSION, $dbh))
39 . "," . $App->returnQuotedString($App->sqlSanitize($FILENAME, $dbh))
40 . "," . $App->returnQuotedString($App->sqlSanitize($LOCATION, $dbh))
41 . ", 1)";
42 mysql_query($sql, $dbh);
43 $LOCATION = "";
44 $FILENAME = "";
45 }
46 else {
47 $GLOBALS['g_ERRSTRS'][0] = "Project, version and URL cannot be empty.";
48 }
49}
50if($SUBMIT == "delete") {
51 $SUBMIT = "showfiles";
52 $sql = "DELETE FROM map_files WHERE
53 project_id = " . $App->returnQuotedString($App->sqlSanitize($PROJECT_ID, $dbh)) . "
54 AND version = " . $App->returnQuotedString($App->sqlSanitize($VERSION, $dbh)) . "
55 AND filename = ". $App->returnQuotedString($App->sqlSanitize($FILENAME, $dbh)) . " LIMIT 1";
56 mysql_query($sql, $dbh);
57}
58
59if($SUBMIT == "showfiles") {
60 $incfile = "content/en_map_files_show.php";
61 $sql = "SELECT project_id, version, filename, location FROM map_files WHERE is_active = 1
62 AND project_id = " . $App->returnQuotedString($App->sqlSanitize($PROJECT_ID, $dbh)) . "
63 AND version = " . $App->returnQuotedString($App->sqlSanitize($VERSION, $dbh));
64 $rs_map_file_list = mysql_query($sql, $dbh);
65 include($incfile);
66}
67else {
68 $sql = "SELECT project_id FROM projects WHERE is_active = 1 ORDER BY project_id";
69 $rs_project_list = mysql_query($sql, $dbh);
70
71 $sql = "SELECT project_id, version FROM project_versions WHERE is_active = 1 ORDER BY project_id ASC, version DESC";
72 $rs_version_list = mysql_query($sql, $dbh);
73 include("head.php");
74 include($incfile);
75 include("foot.php");
76}
77
78
79?>