blob: 63a0fc7d0d0a76864b6636f4f47aef31bb5267a0 [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
Kit Loddc3f122013-06-27 18:01:40 -040011 * Kit Lo (IBM) - [261739] Inconsistent use of language names
12 * Kit Lo (IBM) - [411832] Stats and Recent pages do not show Orion in project dropdown list
syoshida@git.eclipse.orgcd632392015-11-12 23:10:41 +090013 * Satoru Yoshida - [221181] Search a specific string
droy7fcffa72008-06-02 20:33:14 +000014*******************************************************************************/
15include("global.php");
16
17InitPage("");
18
19global $User;
atoulme3e5e9342009-01-23 17:34:30 +000020global $dbh;
droy7fcffa72008-06-02 20:33:14 +000021
22$pageTitle = "Babel - Recent Translations";
23$pageKeywords = "";
droyaddb32f2008-06-03 15:11:51 +000024$incfile = "content/en_recent_html_list.php";
droy7fcffa72008-06-02 20:33:14 +000025
atoulme3e5e9342009-01-23 17:34:30 +000026$PROJECT_VERSION = getHTTPParameter("project_version");
droy7fcffa72008-06-02 20:33:14 +000027$PROJECT_ID = "";
28$VERSION = "";
29
30if($PROJECT_VERSION != "") {
droy7fcffa72008-06-02 20:33:14 +000031 $items = explode("|", $PROJECT_VERSION);
32 $PROJECT_ID = $items[0];
33 $VERSION = $items[1];
34}
atoulme3e5e9342009-01-23 17:34:30 +000035$LANGUAGE_ID= getHTTPParameter("language_id");
droy7fcffa72008-06-02 20:33:14 +000036if($LANGUAGE_ID == "") {
37 $LANGUAGE_ID = $_SESSION["language"];
38}
droye3dc1112008-11-19 18:21:28 +000039
atoulme3e5e9342009-01-23 17:34:30 +000040$FUZZY = getHTTPParameter("fuzzy");
droye3dc1112008-11-19 18:21:28 +000041if($FUZZY == "" || $FUZZY != 1) {
42 $FUZZY = 0;
43}
44
droy7fcffa72008-06-02 20:33:14 +000045if($LANGUAGE_ID == "All") {
46 $LANGUAGE_ID = "";
47}
atoulme3e5e9342009-01-23 17:34:30 +000048$LIMIT = getHTTPParameter("limit");
droye3dc1112008-11-19 18:21:28 +000049if($LIMIT == "" || $LIMIT <= 0 || $LIMIT > 20000) {
droyb1e81bf2012-10-09 15:53:11 -040050 $LIMIT = 25;
droy7fcffa72008-06-02 20:33:14 +000051}
atoulme3e5e9342009-01-23 17:34:30 +000052$LAYOUT = getHTTPParameter("layout");
droyaddb32f2008-06-03 15:11:51 +000053if($LAYOUT == "list" || $LAYOUT == "table") {
54 $incfile = "content/en_recent_html_" . $LAYOUT . ".php";
55}
atoulme3e5e9342009-01-23 17:34:30 +000056$FORMAT = getHTTPParameter("format");
droy7fcffa72008-06-02 20:33:14 +000057if($FORMAT == "rss") {
58 $incfile = "content/en_recent_rss.php";
59}
syoshida@git.eclipse.orgcd632392015-11-12 23:10:41 +090060$s_value = getHTTPParameter("s_value");
61$s_value = trim($s_value);
62if ($s_value !== '') {
63 $s_value_in_sql = $s_value . '%';
64} else {
65 $s_value_in_sql = '';
66}
atoulme3e5e9342009-01-23 17:34:30 +000067$USERID = getHTTPParameter("userid");
68$SUBMIT = getHTTPParameter("submit");
droy7fcffa72008-06-02 20:33:14 +000069
Kit Lo371a0352013-07-07 11:03:04 -040070$sql = "SELECT DISTINCT pv_m.project_id, pv_m.version FROM project_versions AS pv_m INNER JOIN map_files as m ON pv_m.project_id = m.project_id AND pv_m.version = m.version WHERE pv_m.is_active UNION SELECT DISTINCT pv_s.project_id, pv_s.version FROM project_versions AS pv_s INNER JOIN project_source_locations as s ON pv_s.project_id = s.project_id AND pv_s.version = s.version WHERE pv_s.is_active ORDER BY project_id ASC, version DESC";
kitlo2c8d8a92018-04-19 13:25:09 -040071$rs_p_list = mysqli_query($dbh, $sql);
droy7fcffa72008-06-02 20:33:14 +000072
kitlo47df0c62009-01-22 15:16:18 +000073$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";
kitlo2c8d8a92018-04-19 13:25:09 -040074$rs_l_list = mysqli_query($dbh, $sql);
droy7fcffa72008-06-02 20:33:14 +000075
76$where = " t.is_active ";
77
78if($PROJECT_ID != "") {
atoulme3e5e9342009-01-23 17:34:30 +000079 $where = addAndIfNotNull($where) . " f.project_id = ";
80 $where .= returnQuotedString(sqlSanitize($PROJECT_ID, $dbh));
droy7fcffa72008-06-02 20:33:14 +000081}
82if($LANGUAGE_ID != "") {
atoulme3e5e9342009-01-23 17:34:30 +000083 $where = addAndIfNotNull($where) . " t.language_id = ";
84 $where .= returnQuotedString(sqlSanitize($LANGUAGE_ID, $dbh));
droy7fcffa72008-06-02 20:33:14 +000085}
86if($VERSION != "") {
atoulme3e5e9342009-01-23 17:34:30 +000087 $where = addAndIfNotNull($where) . "f.version = ";
88 $where .= returnQuotedString(sqlSanitize($VERSION, $dbh));
droy7fcffa72008-06-02 20:33:14 +000089}
syoshida@git.eclipse.orgcd632392015-11-12 23:10:41 +090090if($s_value_in_sql !== "") {
91 $where = addAndIfNotNull($where) . "s.value like ";
92 $where .= returnQuotedString(sqlSanitize($s_value_in_sql, $dbh));
93}
droy8ad08be2008-11-12 19:49:33 +000094if($USERID != "") {
atoulme3e5e9342009-01-23 17:34:30 +000095 $where = addAndIfNotNull($where) . "u.userid = ";
96 $where .= sqlSanitize($USERID, $dbh);
droy8ad08be2008-11-12 19:49:33 +000097}
droye3dc1112008-11-19 18:21:28 +000098if($FUZZY == 1) {
atoulme3e5e9342009-01-23 17:34:30 +000099 $where = addAndIfNotNull($where) . "t.possibly_incorrect = 1 ";
droye3dc1112008-11-19 18:21:28 +0000100}
droy7fcffa72008-06-02 20:33:14 +0000101
102if($where != "") {
103 $where = " WHERE " . $where;
104}
105
106
107$sql = "SELECT
droyaddb32f2008-06-03 15:11:51 +0000108 s.name AS string_key, s.value as string_value,
droye3dc1112008-11-19 18:21:28 +0000109 t.value as translation,
110 t.possibly_incorrect as fuzzy,
droy35598f02008-06-03 15:16:48 +0000111 IF(u.last_name <> '' AND u.first_name <> '',
112 CONCAT(CONCAT(first_name, ' '), u.last_name),
droy8ad08be2008-11-12 19:49:33 +0000113 IF(u.first_name <> '', u.first_name, u.last_name)) AS who,
114 u.userid,
droyab4eaa12008-11-11 14:19:38 +0000115 t.created_on, l.iso_code as language,
droyaddb32f2008-06-03 15:11:51 +0000116 f.project_id, f.version, f.name
droy7fcffa72008-06-02 20:33:14 +0000117FROM
118 translations as t
119 LEFT JOIN strings as s on s.string_id = t.string_id
120 LEFT JOIN files as f on s.file_id = f.file_id
droyab4eaa12008-11-11 14:19:38 +0000121 LEFT JOIN users as u on u.userid = t.userid
122 LEFT JOIN languages as l on l.language_id = t.language_id
droy7fcffa72008-06-02 20:33:14 +0000123$where
124ORDER BY t.created_on desc
125LIMIT $LIMIT";
kitlo2c8d8a92018-04-19 13:25:09 -0400126$rs_p_stat = mysqli_query($dbh, $sql);
atoulmea4adf8e2009-01-27 19:01:35 +0000127global $addon;
128$addon->callHook("head");
droy7fcffa72008-06-02 20:33:14 +0000129include($incfile);
atoulmea4adf8e2009-01-27 19:01:35 +0000130$addon->callHook("footer");
droy7fcffa72008-06-02 20:33:14 +0000131
droy7fcffa72008-06-02 20:33:14 +0000132?>