blob: 79bb73e6c595b448ac9e00c06248d3fba7351b74 [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");
gobrien1a8e02f2008-01-30 01:46:26 +000013
14InitPage("");
droy8aedeec2008-01-25 19:04:14 +000015
16global $User;
17global $App, $dbh;
gobrien1a8e02f2008-01-30 01:46:26 +000018
19if(!isset($User->userid)) {
20 exitTo("importing.php");
21}
22
droy673b24c2008-01-30 16:30:46 +000023if($User->is_committer != 1) {
gobrien1a8e02f2008-01-30 01:46:26 +000024 exitTo("login.php?errNo=3214","error: 3214 - you must be an Eclipse committer to access this page.");
droy8aedeec2008-01-25 19:04:14 +000025}
26
27require(BABEL_BASE_DIR . "classes/file/file.class.php");
28
29
30$pageTitle = "Babel - Define Map Files";
31$pageKeywords = "";
32$incfile = "content/en_map_files.php";
33
34$PROJECT_ID = $App->getHTTPParameter("project_id");
35$VERSION = $App->getHTTPParameter("version");
36$LOCATION = $App->getHTTPParameter("location");
37$FILENAME = $App->getHTTPParameter("filename");
38$SUBMIT = $App->getHTTPParameter("submit");
39
40if($SUBMIT == "Save") {
41 if($PROJECT_ID != "" && $VERSION != "" && $LOCATION != "") {
42 $sql = "INSERT INTO map_files VALUES ("
43 . $App->returnQuotedString($App->sqlSanitize($PROJECT_ID, $dbh))
44 . "," . $App->returnQuotedString($App->sqlSanitize($VERSION, $dbh))
45 . "," . $App->returnQuotedString($App->sqlSanitize($FILENAME, $dbh))
46 . "," . $App->returnQuotedString($App->sqlSanitize($LOCATION, $dbh))
47 . ", 1)";
48 mysql_query($sql, $dbh);
49 $LOCATION = "";
50 $FILENAME = "";
51 }
52 else {
53 $GLOBALS['g_ERRSTRS'][0] = "Project, version and URL cannot be empty.";
54 }
55}
56if($SUBMIT == "delete") {
57 $SUBMIT = "showfiles";
58 $sql = "DELETE FROM map_files WHERE
59 project_id = " . $App->returnQuotedString($App->sqlSanitize($PROJECT_ID, $dbh)) . "
60 AND version = " . $App->returnQuotedString($App->sqlSanitize($VERSION, $dbh)) . "
61 AND filename = ". $App->returnQuotedString($App->sqlSanitize($FILENAME, $dbh)) . " LIMIT 1";
62 mysql_query($sql, $dbh);
63}
64
65if($SUBMIT == "showfiles") {
66 $incfile = "content/en_map_files_show.php";
67 $sql = "SELECT project_id, version, filename, location FROM map_files WHERE is_active = 1
68 AND project_id = " . $App->returnQuotedString($App->sqlSanitize($PROJECT_ID, $dbh)) . "
69 AND version = " . $App->returnQuotedString($App->sqlSanitize($VERSION, $dbh));
70 $rs_map_file_list = mysql_query($sql, $dbh);
71 include($incfile);
72}
73else {
74 $sql = "SELECT project_id FROM projects WHERE is_active = 1 ORDER BY project_id";
75 $rs_project_list = mysql_query($sql, $dbh);
76
77 $sql = "SELECT project_id, version FROM project_versions WHERE is_active = 1 ORDER BY project_id ASC, version DESC";
78 $rs_version_list = mysql_query($sql, $dbh);
79 include("head.php");
80 include($incfile);
81 include("foot.php");
82}
83
84
85?>