blob: d8daf67694ea620e72b78fa97b6f8a22958bd295 [file] [log] [blame]
droy7fcffa72008-06-02 20:33: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
kitlo47df0c62009-01-22 15:16:18 +000011 * Kit Lo (IBM) - patch, bug 261739, Inconsistent use of language names
droy7fcffa72008-06-02 20:33:14 +000012*******************************************************************************/
13include("global.php");
14
15InitPage("");
16
17global $User;
atoulme3e5e9342009-01-23 17:34:30 +000018global $dbh;
droy7fcffa72008-06-02 20:33:14 +000019
20$pageTitle = "Babel - Recent Translations";
21$pageKeywords = "";
droyaddb32f2008-06-03 15:11:51 +000022$incfile = "content/en_recent_html_list.php";
droy7fcffa72008-06-02 20:33:14 +000023
atoulme3e5e9342009-01-23 17:34:30 +000024$PROJECT_VERSION = getHTTPParameter("project_version");
droy7fcffa72008-06-02 20:33:14 +000025$PROJECT_ID = "";
26$VERSION = "";
27
28if($PROJECT_VERSION != "") {
droy7fcffa72008-06-02 20:33:14 +000029 $items = explode("|", $PROJECT_VERSION);
30 $PROJECT_ID = $items[0];
31 $VERSION = $items[1];
32}
atoulme3e5e9342009-01-23 17:34:30 +000033$LANGUAGE_ID= getHTTPParameter("language_id");
droy7fcffa72008-06-02 20:33:14 +000034if($LANGUAGE_ID == "") {
35 $LANGUAGE_ID = $_SESSION["language"];
36}
droye3dc1112008-11-19 18:21:28 +000037
atoulme3e5e9342009-01-23 17:34:30 +000038$FUZZY = getHTTPParameter("fuzzy");
droye3dc1112008-11-19 18:21:28 +000039if($FUZZY == "" || $FUZZY != 1) {
40 $FUZZY = 0;
41}
42
droy7fcffa72008-06-02 20:33:14 +000043if($LANGUAGE_ID == "All") {
44 $LANGUAGE_ID = "";
45}
atoulme3e5e9342009-01-23 17:34:30 +000046$LIMIT = getHTTPParameter("limit");
droye3dc1112008-11-19 18:21:28 +000047if($LIMIT == "" || $LIMIT <= 0 || $LIMIT > 20000) {
droy7fcffa72008-06-02 20:33:14 +000048 $LIMIT = 200;
49}
atoulme3e5e9342009-01-23 17:34:30 +000050$LAYOUT = getHTTPParameter("layout");
droyaddb32f2008-06-03 15:11:51 +000051if($LAYOUT == "list" || $LAYOUT == "table") {
52 $incfile = "content/en_recent_html_" . $LAYOUT . ".php";
53}
atoulme3e5e9342009-01-23 17:34:30 +000054$FORMAT = getHTTPParameter("format");
droy7fcffa72008-06-02 20:33:14 +000055if($FORMAT == "rss") {
56 $incfile = "content/en_recent_rss.php";
57}
atoulme3e5e9342009-01-23 17:34:30 +000058$USERID = getHTTPParameter("userid");
59$SUBMIT = getHTTPParameter("submit");
droy7fcffa72008-06-02 20:33:14 +000060
61$sql = "SELECT DISTINCT pv.project_id, pv.version FROM project_versions AS pv INNER JOIN map_files as m ON pv.project_id = m.project_id AND pv.version = m.version WHERE pv.is_active ORDER BY pv.project_id ASC, pv.version DESC";
62$rs_p_list = mysql_query($sql, $dbh);
63
kitlo47df0c62009-01-22 15:16:18 +000064$sql = "SELECT language_id, IF(locale <> '', CONCAT(CONCAT(CONCAT(name, ' ('), locale), ')'), name) as name FROM languages WHERE is_active AND iso_code != 'en' ORDER BY name";
droy7fcffa72008-06-02 20:33:14 +000065$rs_l_list = mysql_query($sql, $dbh);
66
67$where = " t.is_active ";
68
69if($PROJECT_ID != "") {
atoulme3e5e9342009-01-23 17:34:30 +000070 $where = addAndIfNotNull($where) . " f.project_id = ";
71 $where .= returnQuotedString(sqlSanitize($PROJECT_ID, $dbh));
droy7fcffa72008-06-02 20:33:14 +000072}
73if($LANGUAGE_ID != "") {
atoulme3e5e9342009-01-23 17:34:30 +000074 $where = addAndIfNotNull($where) . " t.language_id = ";
75 $where .= returnQuotedString(sqlSanitize($LANGUAGE_ID, $dbh));
droy7fcffa72008-06-02 20:33:14 +000076}
77if($VERSION != "") {
atoulme3e5e9342009-01-23 17:34:30 +000078 $where = addAndIfNotNull($where) . "f.version = ";
79 $where .= returnQuotedString(sqlSanitize($VERSION, $dbh));
droy7fcffa72008-06-02 20:33:14 +000080}
droy8ad08be2008-11-12 19:49:33 +000081if($USERID != "") {
atoulme3e5e9342009-01-23 17:34:30 +000082 $where = addAndIfNotNull($where) . "u.userid = ";
83 $where .= sqlSanitize($USERID, $dbh);
droy8ad08be2008-11-12 19:49:33 +000084}
droye3dc1112008-11-19 18:21:28 +000085if($FUZZY == 1) {
atoulme3e5e9342009-01-23 17:34:30 +000086 $where = addAndIfNotNull($where) . "t.possibly_incorrect = 1 ";
droye3dc1112008-11-19 18:21:28 +000087}
droy7fcffa72008-06-02 20:33:14 +000088
89if($where != "") {
90 $where = " WHERE " . $where;
91}
92
93
94$sql = "SELECT
droyaddb32f2008-06-03 15:11:51 +000095 s.name AS string_key, s.value as string_value,
droye3dc1112008-11-19 18:21:28 +000096 t.value as translation,
97 t.possibly_incorrect as fuzzy,
droy35598f02008-06-03 15:16:48 +000098 IF(u.last_name <> '' AND u.first_name <> '',
99 CONCAT(CONCAT(first_name, ' '), u.last_name),
droy8ad08be2008-11-12 19:49:33 +0000100 IF(u.first_name <> '', u.first_name, u.last_name)) AS who,
101 u.userid,
droyab4eaa12008-11-11 14:19:38 +0000102 t.created_on, l.iso_code as language,
droyaddb32f2008-06-03 15:11:51 +0000103 f.project_id, f.version, f.name
droy7fcffa72008-06-02 20:33:14 +0000104FROM
105 translations as t
106 LEFT JOIN strings as s on s.string_id = t.string_id
107 LEFT JOIN files as f on s.file_id = f.file_id
droyab4eaa12008-11-11 14:19:38 +0000108 LEFT JOIN users as u on u.userid = t.userid
109 LEFT JOIN languages as l on l.language_id = t.language_id
droy7fcffa72008-06-02 20:33:14 +0000110$where
111ORDER BY t.created_on desc
112LIMIT $LIMIT";
113$rs_p_stat = mysql_query($sql, $dbh);
atoulmea4adf8e2009-01-27 19:01:35 +0000114global $addon;
115$addon->callHook("head");
droy7fcffa72008-06-02 20:33:14 +0000116include($incfile);
atoulmea4adf8e2009-01-27 19:01:35 +0000117$addon->callHook("footer");
droy7fcffa72008-06-02 20:33:14 +0000118
droy7fcffa72008-06-02 20:33:14 +0000119?>