droy | 8aedeec | 2008-01-25 19:04:14 +0000 | [diff] [blame] | 1 | <?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 | *******************************************************************************/ |
| 12 | include("global.php"); |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 13 | |
| 14 | InitPage(""); |
droy | 8aedeec | 2008-01-25 19:04:14 +0000 | [diff] [blame] | 15 | |
| 16 | global $User; |
| 17 | global $App, $dbh; |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 18 | |
| 19 | if(!isset($User->userid)) { |
| 20 | exitTo("importing.php"); |
| 21 | } |
| 22 | |
droy | 673b24c | 2008-01-30 16:30:46 +0000 | [diff] [blame] | 23 | if($User->is_committer != 1) { |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 24 | exitTo("login.php?errNo=3214","error: 3214 - you must be an Eclipse committer to access this page."); |
droy | 8aedeec | 2008-01-25 19:04:14 +0000 | [diff] [blame] | 25 | } |
| 26 | |
| 27 | require(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 | |
| 40 | if($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 | } |
| 56 | if($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 | |
| 65 | if($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 | } |
| 73 | else { |
| 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 | ?> |