Beispiel #1
0
    exitTo("importing.php");
}
if ($User->is_committer != 1) {
    exitTo("login.php?errNo=3214", "error: 3214 - you must be an Eclipse committer to access this page.");
}
require dirname(__FILE__) . "/../classes/file/file.class.php";
$pageTitle = "Babel - Define Map Files or Update Sites";
$pageKeywords = "";
$incfile = "content/en_map_files.php";
$PROJECT_ID = getHTTPParameter("project_id");
$VERSION = getHTTPParameter("version");
$TRAIN_ID = getHTTPParameter("train_id");
$FILE_FLD = getHTTPParameter("fileFld");
$PATTERNS = getHTTPParameter("patterns");
$FILENAME = getHTTPParameter("filename");
$SUBMIT = getHTTPParameter("submit");
$VERSION = preg_replace("/^\\* /", "", $VERSION);
if ($SUBMIT == "Save") {
    if ($PROJECT_ID != "" && $VERSION != "" && $FILE_FLD != "") {
        # Set URL type
        $is_Map_file = 1;
        if ($_POST["urlType"] == "updateSites") {
            $is_Map_file = 0;
        }
        # Delete old map files for this project version
        $sql = "DELETE FROM map_files WHERE project_id = " . returnQuotedString(sqlSanitize($PROJECT_ID, $dbh)) . " AND version = " . returnQuotedString(sqlSanitize($VERSION, $dbh));
        mysql_query($sql, $dbh);
        # Insert new map files for this project version
        $list = explode("\n", $FILE_FLD);
        foreach ($list as $file) {
            $file = str_replace("\r", "", $file);
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Paul Colton (Aptana)- initial API and implementation
 *    Eclipse Foundation
*******************************************************************************/
error_reporting('E_NONE');
ini_set("display_errors", false);
require_once "cb_global.php";
$project_id = getHTTPParameter("proj", "POST");
$version = getHTTPParameter("version", "POST");
//THE 3 VALID STATES
//	UNSTRANSLATED (DEFUALT)
//	FLAGGED (FLAGGED INCORRECT IN DATABASE)
//	AWAITING (TRANSLATED BUT NO RAITINGS YET)
$state = getHTTPParameter("state", "POST");
if (!isset($proj_post)) {
    if (isset($_SESSION['project'])) {
        $project_id = $_SESSION['project'];
    }
    if (isset($_SESSION['version'])) {
        $version = $_SESSION['version'];
    }
    if (isset($_SESSION['language'])) {
        $language = $_SESSION['language'];
    }
    if (isset($_SESSION['file'])) {
        $file = $_SESSION['file'];
    }
    if (isset($_SESSION['string'])) {
        $string = $_SESSION['string'];
<?php

/*******************************************************************************
 * Copyright (c) 2008 Eclipse Foundation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Eclipse Foundation - initial API and implementation
*******************************************************************************/
require_once "cb_global.php";
$return = array();
$tr_string = getHTTPParameter("tr_string", "POST");
if (isset($_SESSION['language']) and isset($_SESSION['version']) and isset($_SESSION['project'])) {
    $language = $_SESSION['language'];
    $version = $_SESSION['version'];
    $project_id = $_SESSION['project'];
} else {
    return false;
}
/* $query = "SELECT DISTINCT t.value 
	FROM translations as t 
		INNER JOIN strings AS s ON s.string_id = t.string_id 
	WHERE s.value like '%" . addslashes($tr_string). "%' 
		AND t.is_active
		AND t.language_id = '".addslashes($language)."'
	ORDER BY LENGTH(t.value) ASC LIMIT 15";
*/
$train_id = "";
Beispiel #4
0
        $File->name = $FULLPATH;
        if (!$File->save()) {
            $GLOBALS['g_ERRSTRS'][0] = "An error occurred while saving the file.";
        } else {
            # Start importing the strings!
            $fh = fopen($_FILES['name']['tmp_name'], 'r');
            $size = filesize($_FILES['name']['tmp_name']);
            $content = fread($fh, $size);
            fclose($fh);
            $filename = $_FILES['name']['name'];
            if (stristr($filename, ".properties")) {
                $strings = $File->parseProperties($content);
                $aStrings = explode(",", $strings);
                $FULLPATH = "";
            }
        }
        $filename = $_FILES['name']['name'];
        $fullpath = getHTTPParameter("fullpath", "POST");
        if (!get_magic_quotes_gpc()) {
            $filename = addslashes($filename);
        }
        $content = addslashes($content);
    } else {
        $GLOBALS['g_ERRSTRS'][0] = "You must specify a file to import.";
    }
}
global $addon;
$addon->callHook("head");
include "content/en_import.php";
global $addon;
$addon->callHook("footer");
/*******************************************************************************
 * Copyright (c) 2007 Eclipse Foundation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Paul Colton (Aptana)- initial API and implementation
 *    Eclipse Foundation
 *    Kit Lo (IBM) - [281434] Syncup overuses the "possibly incorrect" flag
*******************************************************************************/
require_once "cb_global.php";
$string_id = getHTTPParameter("string_id", "POST");
$stringTableIndex = getHTTPParameter("stringTableIndex", "POST");
if (isset($_SESSION['language']) and isset($_SESSION['version']) and isset($_SESSION['project'])) {
    $language = $_SESSION['language'];
    $version = $_SESSION['version'];
    $project_id = $_SESSION['project'];
} else {
    return false;
}
$query = "select \n\t\t\tstrings.string_id,\n\t\t\tstrings.non_translatable,\n\t\t\tstrings.value as string_value,\n\t\t\ttranslations.value as translation_value,\n\t\t\ttranslations.possibly_incorrect as fuzzy,\n\t\t\tfiles.name,\n\t\t\tstrings.name as token,\n\t\t\tmax(translations.version)\n\t\t  from\n\t\t  \tfiles,\n\t\t  \tstrings\n\t\t  \tleft join translations on\n\t\t  \t\t(strings.string_id = translations.string_id \n\t\t  \t\t and \n\t\t  \t\t translations.is_active != 0 \n\t\t  \t\t and \n\t\t  \t\t translations.language_id = '" . addslashes($language) . "')\n\t\t  where\n\t\t  \tstrings.is_active != 0\n\t\t  and\n\t\t\t  strings.string_id = '" . addslashes($string_id) . "'\n\t\t  and\n\t\t  \t  strings.file_id = files.file_id\n\t\t  and\n\t\t  \t  files.version = '" . addslashes($version) . "'\n\t\t  group by translations.version\n\t\t  order by translations.version desc\n\t\t  limit 1\n\t\t\t";
//print $query;
$res = mysql_query($query, $dbh);
$line = mysql_fetch_array($res, MYSQL_ASSOC);
//print_r($line);
$trans = "";
if ($line['translation_value']) {
    $trans = " AND translations.value = '" . addslashes($line['translation_value']) . "'  \t\t\t\n\t\t\t\tAND \n\t\t\t  translations.is_active = 1\n\t";
Beispiel #6
0
<?php

/*******************************************************************************
 * Copyright (c) 2009-2013 Eclipse Foundation, IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Eclipse Foundation - Initial API and implementation
 *    Kit Lo (IBM) - Bug 299402, Extract properties files from Eclipse project update sites for translation
 *    Kit Lo (IBM) - [402192] Extract project source files from Git repositories for translation
 *******************************************************************************/
require_once "cb_global.php";
$return = array();
$project_id = getHTTPParameter("project_id", "POST");
$version = getHTTPParameter("version", "POST");
$query = "SELECT m.project_id, m.version, r.train_id, m.location, m.filename FROM map_files m\n\tLEFT JOIN release_train_projects r ON m.project_id = r.project_id AND m.version = r.version\n\tWHERE m.is_active = 1 \n\tAND m.project_id = " . returnQuotedString(sqlSanitize($project_id, $dbh)) . "\n\tAND m.version = " . returnQuotedString(sqlSanitize($version, $dbh));
$res = mysql_query($query, $dbh);
if (mysql_affected_rows($dbh) > 0) {
    while ($line = mysql_fetch_array($res, MYSQL_ASSOC)) {
        echo $line['location'] . "\n";
    }
} else {
    echo "No map files or update sites found for {$project_id} {$version}";
}
<?php

/*******************************************************************************
 * Copyright (c) 2007 Eclipse Foundation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Paul Colton (Aptana)- initial API and implementation
 *    Eclipse Foundation
*******************************************************************************/
require_once "cb_global.php";
$_SESSION['version'] = getHTTPParameter("version", "POST");
<?php

/*******************************************************************************
 * Copyright (c) 2007 Eclipse Foundation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Paul Colton (Aptana)- initial API and implementation
 *    Eclipse Foundation
*******************************************************************************/
require_once "cb_global.php";
$_SESSION['project'] = getHTTPParameter("project", "POST");
Beispiel #9
0
<?php

/*******************************************************************************
 * Copyright (c) 2007 Eclipse Foundation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Paul Colton (Aptana)- initial API and implementation
 *    Eclipse Foundation
*******************************************************************************/
require_once "cb_global.php";
$_SESSION['file'] = getHTTPParameter("file", "POST");
//print_r($_SESSION);
<?php

require_once "cb_global.php";
$string_id = getHTTPParameter("string_id", "POST");
$checked_state = getHTTPParameter("check", "POST");
$query = "select\n\t\t\tstrings.value, \n\t\t\tstrings.name as string_name, \n\t\t\tfiles.name as file_name \n\t\t  from\n\t\t  \tstrings,\n\t\t  \tfiles\n\t\t  where\n\t\t  \tfiles.file_id = strings.file_id\n\t\t  AND\n\t\t  \tstrings.string_id = '" . addslashes($string_id) . "\n\t\t '";
$res = mysql_query($query, $dbh);
$row = mysql_fetch_assoc($res);
if ($checked_state == "true") {
    $checked_state = 1;
} else {
    $checked_state = 0;
}
$query = "update \n\t\t\tstrings,files\n\t\t  set\n\t\t\tstrings.non_translatable = '" . addslashes($checked_state) . "' \n\t\t  where \t\t  \t\n\t\t\tfiles.name = '" . addslashes($row['file_name']) . "'\n\t\t\tAND strings.name = '" . addslashes($row['string_name']) . "'\n\t\t\tAND strings.file_id = files.file_id\n\t\t  ";
$res = mysql_query($query, $dbh);
$updated_rows = mysql_affected_rows();
if ($updated_rows < 0) {
    $message = "An error has occurred in processing your request, please file a bug.";
} elseif ($checked_state == 1) {
    $message = "'" . $row['value'] . "' has been marked as non-translatable in " . $updated_rows . " file(s).";
} else {
    $message = "'" . $row['value'] . "' has been marked as translatable in " . $updated_rows . " file(s).";
}
print "<br><br><br><center><b>{$message}</b></center>";
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Eclipse Foundation - Initial API and implementation
 *******************************************************************************/
require_once "cb_global.php";
$return = array();
if (!isset($_SESSION['project']) or !isset($_SESSION['version'])) {
    return $return;
}
$language = "";
if (isset($_SESSION['language'])) {
    $language = $_SESSION['language'];
}
$parameter = getHTTPParameter("order", "POST");
if ($parameter == "name" or $parameter == "completion") {
    $_SESSION['filesOrder'] = $parameter;
}
if (!isset($_SESSION['filesOrder'])) {
    $_SESSION['filesOrder'] = "name";
}
if ($_SESSION['filesOrder'] == "name") {
    $order = "f.name";
} else {
    $order = "pct_complete";
}
$query = "SELECT \n        f.name, \n        IF(ISNULL(pct_complete),0,pct_complete) AS pct_complete\nFROM\n        files AS f\n        LEFT JOIN project_versions AS v ON v.project_id = f.project_id \n        AND v.version = f.version\n        LEFT JOIN file_progress as p ON p.file_id = f.file_id\n          AND p.language_id = '" . addslashes($language) . "'\nWHERE\n        v.is_active = 1\n        AND f.is_active = 1\n        AND v.project_id = '" . addslashes($_SESSION['project']) . "'\n        AND f.version = '" . addslashes($_SESSION['version']) . "'\n        GROUP BY f.name\n        ORDER BY " . $order;
# print $query."\n";
$res = mysql_query($query, $dbh);
while ($line = mysql_fetch_array($res, MYSQL_ASSOC)) {
<?php

/*******************************************************************************
 * Copyright (c) 2007 Eclipse Foundation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Paul Colton (Aptana)- initial API and implementation
 *    Eclipse Foundation
*******************************************************************************/
require_once "cb_global.php";
$_SESSION['language'] = getHTTPParameter("lang", "POST");
/*******************************************************************************
 * Copyright (c) 2007 Eclipse Foundation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Paul Colton (Aptana)- initial API and implementation
 *    Eclipse Foundation
 * 	  Eclipse Contributors (bug 217257)
*******************************************************************************/
require_once "cb_global.php";
$string_id = getHTTPParameter("string_id", "POST");
$translation = getHTTPParameter("translation", "POST");
$fuzzy_state = getHTTPParameter("fuzzy", "POST");
$language_id = $_SESSION["language"];
$project_id = $_SESSION['project'];
$version = $_SESSION["version"];
$user_id = $User->userid;
# TODO: refactor these ifs
$do_nothing = false;
$affected_rows = 0;
if (empty($translation) || trim($translation) == '') {
    $do_nothing = true;
} else {
    if ($_POST['translate_action'] != "all") {
        $query = "update \r\n\t\t\t\ttranslations \r\n\t\t\t  set\r\n\t\t\t\tis_active = 0 \r\n\t\t\t  where \t\t  \t\r\n\t\t\t\tstring_id = '" . addslashes($string_id) . "'\r\n\t\t\t  and\r\n\t\t\t  \tlanguage_id = '" . addslashes($language_id) . "'\r\n\t\t\t  and \r\n\t\t\t  \tis_active = 1\r\n\t\t\t  ";
        $res = mysql_query($query, $dbh);
        $query = "insert into \r\n\t\t\t\t\ttranslations\r\n\t\t\t\t  set\r\n\t\t\t\t  \tstring_id = '" . addslashes($string_id) . "',\r\n\t\t\t\t  \tlanguage_id = '" . addslashes($language_id) . "',\r\n\t\t\t\t  \tvalue = '" . addslashes($translation) . "',\r\n\t\t\t\t  \tuserid = '" . addslashes($user_id) . "',\r\n\t\t\t\t  \tpossibly_incorrect = '" . addslashes($fuzzy_state) . "',\r\n\t\t\t\t  \tcreated_on = NOW()\r\n\t\t\t\t  \t";
        $res = mysql_query($query, $dbh);