blob: aff3e04fda625df5d3075d233c834ccb0a714a39 [file] [log] [blame]
droy81777472007-11-28 21:35:58 +00001<?php
2/*******************************************************************************
3 * Copyright (c) 2007 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*******************************************************************************/
droy5c123fc2008-02-01 21:56:40 +000012
13/**
14 * @deprecated - need to tie to project/versions
15 */
16
17exit;
18
droy81777472007-11-28 21:35:58 +000019include("global.php");
20InitPage("login");
21
droy8da30b32007-11-29 21:00:26 +000022global $User;
23if(!$User->is_committer) {
droyaa626d02007-11-29 21:03:17 +000024 exitTo("error.php?errNo=3214","error: 3214 - you must be an Eclipse committer to access this page.");
droy8da30b32007-11-29 21:00:26 +000025}
26
atoulme12882d52009-01-26 18:39:17 +000027require(dirname(__FILE__) . "/../classes/file/file.class.php");
droy81777472007-11-28 21:35:58 +000028
29
30$pageTitle = "Babel - Import file";
31$pageKeywords = "import,properties,translation,language,nlpack,pack,eclipse,babel";
32
atoulme3e5e9342009-01-23 17:34:30 +000033$FILE_ID = getHTTPParameter("file_id");
34$PROJECT_ID = getHTTPParameter("project_id");
35$FULLPATH = getHTTPParameter("fullpath");
36$SUBMIT = getHTTPParameter("submit");
droy81777472007-11-28 21:35:58 +000037$strings = "";
38
39if($SUBMIT == "Import") {
40# Scanned document details
41 if(isset($_FILES)
42 && $_FILES['name']['size'] > 0
43 && $_FILES['name']['size'] < 16777216) {
44
45 $File = new File();
46 $File->project_id = $PROJECT_ID;
47 $File->name = $FULLPATH;
48 if(!$File->save()) {
49 $GLOBALS['g_ERRSTRS'][0] = "An error occurred while saving the file.";
50 }
51 else {
52 # Start importing the strings!
53 $fh = fopen($_FILES['name']['tmp_name'], 'r');
54 $size = filesize($_FILES['name']['tmp_name']);
55
56 $content = fread($fh, $size);
57 fclose($fh);
58
59 $filename = $_FILES['name']['name'];
60 if(stristr($filename, ".properties")) {
61 $strings = $File->parseProperties($content);
62 $aStrings = explode(",", $strings);
63 $FULLPATH = "";
64 }
65 }
66 $filename = $_FILES['name']['name'];
atoulme3e5e9342009-01-23 17:34:30 +000067 $fullpath = getHTTPParameter("fullpath", "POST");
droy81777472007-11-28 21:35:58 +000068
69 if(!get_magic_quotes_gpc()){
70 $filename = addslashes($filename);
71 }
72 $content = addslashes($content);
73 }
74 else {
75 $GLOBALS['g_ERRSTRS'][0] = "You must specify a file to import.";
76 }
77}
78
atoulmea4adf8e2009-01-27 19:01:35 +000079global $addon;
80$addon->callHook("head");
droy81777472007-11-28 21:35:58 +000081
82include("content/en_import.php");
83
atoulmea4adf8e2009-01-27 19:01:35 +000084global $addon;
85$addon->callHook("footer");
droy81777472007-11-28 21:35:58 +000086
87?>