blob: f2a1674db03372c6543b549a241dc2603d5ba48e [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
11*******************************************************************************/
12include("global.php");
13
14InitPage("");
15
16global $User;
17global $App, $dbh;
18
19$pageTitle = "Babel - Recent Translations";
20$pageKeywords = "";
droyaddb32f2008-06-03 15:11:51 +000021$incfile = "content/en_recent_html_list.php";
droy7fcffa72008-06-02 20:33:14 +000022
23$PROJECT_VERSION = $App->getHTTPParameter("project_version");
24$PROJECT_ID = "";
25$VERSION = "";
26
27if($PROJECT_VERSION != "") {
28
29 $items = explode("|", $PROJECT_VERSION);
30 $PROJECT_ID = $items[0];
31 $VERSION = $items[1];
32}
33$LANGUAGE_ID= $App->getHTTPParameter("language_id");
34if($LANGUAGE_ID == "") {
35 $LANGUAGE_ID = $_SESSION["language"];
36}
37if($LANGUAGE_ID == "All") {
38 $LANGUAGE_ID = "";
39}
40$LIMIT = $App->getHTTPParameter("limit");
41if($LIMIT == "" || $LIMIT <= 0 || $LIMIT > 1000) {
42 $LIMIT = 200;
43}
droyaddb32f2008-06-03 15:11:51 +000044$LAYOUT = $App->getHTTPParameter("layout");
45if($LAYOUT == "list" || $LAYOUT == "table") {
46 $incfile = "content/en_recent_html_" . $LAYOUT . ".php";
47}
droy7fcffa72008-06-02 20:33:14 +000048$FORMAT = $App->getHTTPParameter("format");
49if($FORMAT == "rss") {
50 $incfile = "content/en_recent_rss.php";
51}
52$SUBMIT = $App->getHTTPParameter("submit");
53
54$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";
55$rs_p_list = mysql_query($sql, $dbh);
56
droyaddb32f2008-06-03 15:11:51 +000057$sql = "SELECT language_id, IF(locale <> '', CONCAT(CONCAT(locale, ' '), name), name) as name FROM languages WHERE is_active ORDER BY name";
droy7fcffa72008-06-02 20:33:14 +000058$rs_l_list = mysql_query($sql, $dbh);
59
60$where = " t.is_active ";
61
62if($PROJECT_ID != "") {
63 $where = $App->addAndIfNotNull($where) . " f.project_id = ";
64 $where .= $App->returnQuotedString($App->sqlSanitize($PROJECT_ID, $dbh));
65}
66if($LANGUAGE_ID != "") {
67 $where = $App->addAndIfNotNull($where) . " t.language_id = ";
68 $where .= $App->returnQuotedString($App->sqlSanitize($LANGUAGE_ID, $dbh));
69}
70if($VERSION != "") {
71 $where = $App->addAndIfNotNull($where) . "f.version = ";
72 $where .= $App->returnQuotedString($App->sqlSanitize($VERSION, $dbh));
73}
74
75if($where != "") {
76 $where = " WHERE " . $where;
77}
78
79
80$sql = "SELECT
droyaddb32f2008-06-03 15:11:51 +000081 s.name AS string_key, s.value as string_value,
82 t.value as translation,
droy35598f02008-06-03 15:16:48 +000083 IF(u.last_name <> '' AND u.first_name <> '',
84 CONCAT(CONCAT(first_name, ' '), u.last_name),
85 IF(u.first_name <> '', u.first_name, u.last_name)) AS who,
droyaddb32f2008-06-03 15:11:51 +000086 t.created_on,
87 f.project_id, f.version, f.name
droy7fcffa72008-06-02 20:33:14 +000088FROM
89 translations as t
90 LEFT JOIN strings as s on s.string_id = t.string_id
91 LEFT JOIN files as f on s.file_id = f.file_id
92 LEFT JOIN users as u on u.userid = t.userid
93$where
94ORDER BY t.created_on desc
95LIMIT $LIMIT";
96$rs_p_stat = mysql_query($sql, $dbh);
droy7fcffa72008-06-02 20:33:14 +000097include("head.php");
98include($incfile);
99include("foot.php");
100
101
102
103?>