droy | 7fcffa7 | 2008-06-02 20:33:14 +0000 | [diff] [blame] | 1 | <?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 |
kitlo | 47df0c6 | 2009-01-22 15:16:18 +0000 | [diff] [blame] | 11 | * Kit Lo (IBM) - patch, bug 261739, Inconsistent use of language names |
droy | 7fcffa7 | 2008-06-02 20:33:14 +0000 | [diff] [blame] | 12 | *******************************************************************************/ |
| 13 | include("global.php"); |
| 14 | |
| 15 | InitPage(""); |
| 16 | |
| 17 | global $User; |
atoulme | 3e5e934 | 2009-01-23 17:34:30 +0000 | [diff] [blame] | 18 | global $dbh; |
droy | 7fcffa7 | 2008-06-02 20:33:14 +0000 | [diff] [blame] | 19 | |
| 20 | $pageTitle = "Babel - Recent Translations"; |
| 21 | $pageKeywords = ""; |
droy | addb32f | 2008-06-03 15:11:51 +0000 | [diff] [blame] | 22 | $incfile = "content/en_recent_html_list.php"; |
droy | 7fcffa7 | 2008-06-02 20:33:14 +0000 | [diff] [blame] | 23 | |
atoulme | 3e5e934 | 2009-01-23 17:34:30 +0000 | [diff] [blame] | 24 | $PROJECT_VERSION = getHTTPParameter("project_version"); |
droy | 7fcffa7 | 2008-06-02 20:33:14 +0000 | [diff] [blame] | 25 | $PROJECT_ID = ""; |
| 26 | $VERSION = ""; |
| 27 | |
| 28 | if($PROJECT_VERSION != "") { |
droy | 7fcffa7 | 2008-06-02 20:33:14 +0000 | [diff] [blame] | 29 | $items = explode("|", $PROJECT_VERSION); |
| 30 | $PROJECT_ID = $items[0]; |
| 31 | $VERSION = $items[1]; |
| 32 | } |
atoulme | 3e5e934 | 2009-01-23 17:34:30 +0000 | [diff] [blame] | 33 | $LANGUAGE_ID= getHTTPParameter("language_id"); |
droy | 7fcffa7 | 2008-06-02 20:33:14 +0000 | [diff] [blame] | 34 | if($LANGUAGE_ID == "") { |
| 35 | $LANGUAGE_ID = $_SESSION["language"]; |
| 36 | } |
droy | e3dc111 | 2008-11-19 18:21:28 +0000 | [diff] [blame] | 37 | |
atoulme | 3e5e934 | 2009-01-23 17:34:30 +0000 | [diff] [blame] | 38 | $FUZZY = getHTTPParameter("fuzzy"); |
droy | e3dc111 | 2008-11-19 18:21:28 +0000 | [diff] [blame] | 39 | if($FUZZY == "" || $FUZZY != 1) { |
| 40 | $FUZZY = 0; |
| 41 | } |
| 42 | |
droy | 7fcffa7 | 2008-06-02 20:33:14 +0000 | [diff] [blame] | 43 | if($LANGUAGE_ID == "All") { |
| 44 | $LANGUAGE_ID = ""; |
| 45 | } |
atoulme | 3e5e934 | 2009-01-23 17:34:30 +0000 | [diff] [blame] | 46 | $LIMIT = getHTTPParameter("limit"); |
droy | e3dc111 | 2008-11-19 18:21:28 +0000 | [diff] [blame] | 47 | if($LIMIT == "" || $LIMIT <= 0 || $LIMIT > 20000) { |
droy | 7fcffa7 | 2008-06-02 20:33:14 +0000 | [diff] [blame] | 48 | $LIMIT = 200; |
| 49 | } |
atoulme | 3e5e934 | 2009-01-23 17:34:30 +0000 | [diff] [blame] | 50 | $LAYOUT = getHTTPParameter("layout"); |
droy | addb32f | 2008-06-03 15:11:51 +0000 | [diff] [blame] | 51 | if($LAYOUT == "list" || $LAYOUT == "table") { |
| 52 | $incfile = "content/en_recent_html_" . $LAYOUT . ".php"; |
| 53 | } |
atoulme | 3e5e934 | 2009-01-23 17:34:30 +0000 | [diff] [blame] | 54 | $FORMAT = getHTTPParameter("format"); |
droy | 7fcffa7 | 2008-06-02 20:33:14 +0000 | [diff] [blame] | 55 | if($FORMAT == "rss") { |
| 56 | $incfile = "content/en_recent_rss.php"; |
| 57 | } |
atoulme | 3e5e934 | 2009-01-23 17:34:30 +0000 | [diff] [blame] | 58 | $USERID = getHTTPParameter("userid"); |
| 59 | $SUBMIT = getHTTPParameter("submit"); |
droy | 7fcffa7 | 2008-06-02 20:33:14 +0000 | [diff] [blame] | 60 | |
| 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 | |
kitlo | 47df0c6 | 2009-01-22 15:16:18 +0000 | [diff] [blame] | 64 | $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"; |
droy | 7fcffa7 | 2008-06-02 20:33:14 +0000 | [diff] [blame] | 65 | $rs_l_list = mysql_query($sql, $dbh); |
| 66 | |
| 67 | $where = " t.is_active "; |
| 68 | |
| 69 | if($PROJECT_ID != "") { |
atoulme | 3e5e934 | 2009-01-23 17:34:30 +0000 | [diff] [blame] | 70 | $where = addAndIfNotNull($where) . " f.project_id = "; |
| 71 | $where .= returnQuotedString(sqlSanitize($PROJECT_ID, $dbh)); |
droy | 7fcffa7 | 2008-06-02 20:33:14 +0000 | [diff] [blame] | 72 | } |
| 73 | if($LANGUAGE_ID != "") { |
atoulme | 3e5e934 | 2009-01-23 17:34:30 +0000 | [diff] [blame] | 74 | $where = addAndIfNotNull($where) . " t.language_id = "; |
| 75 | $where .= returnQuotedString(sqlSanitize($LANGUAGE_ID, $dbh)); |
droy | 7fcffa7 | 2008-06-02 20:33:14 +0000 | [diff] [blame] | 76 | } |
| 77 | if($VERSION != "") { |
atoulme | 3e5e934 | 2009-01-23 17:34:30 +0000 | [diff] [blame] | 78 | $where = addAndIfNotNull($where) . "f.version = "; |
| 79 | $where .= returnQuotedString(sqlSanitize($VERSION, $dbh)); |
droy | 7fcffa7 | 2008-06-02 20:33:14 +0000 | [diff] [blame] | 80 | } |
droy | 8ad08be | 2008-11-12 19:49:33 +0000 | [diff] [blame] | 81 | if($USERID != "") { |
atoulme | 3e5e934 | 2009-01-23 17:34:30 +0000 | [diff] [blame] | 82 | $where = addAndIfNotNull($where) . "u.userid = "; |
| 83 | $where .= sqlSanitize($USERID, $dbh); |
droy | 8ad08be | 2008-11-12 19:49:33 +0000 | [diff] [blame] | 84 | } |
droy | e3dc111 | 2008-11-19 18:21:28 +0000 | [diff] [blame] | 85 | if($FUZZY == 1) { |
atoulme | 3e5e934 | 2009-01-23 17:34:30 +0000 | [diff] [blame] | 86 | $where = addAndIfNotNull($where) . "t.possibly_incorrect = 1 "; |
droy | e3dc111 | 2008-11-19 18:21:28 +0000 | [diff] [blame] | 87 | } |
droy | 7fcffa7 | 2008-06-02 20:33:14 +0000 | [diff] [blame] | 88 | |
| 89 | if($where != "") { |
| 90 | $where = " WHERE " . $where; |
| 91 | } |
| 92 | |
| 93 | |
| 94 | $sql = "SELECT |
droy | addb32f | 2008-06-03 15:11:51 +0000 | [diff] [blame] | 95 | s.name AS string_key, s.value as string_value, |
droy | e3dc111 | 2008-11-19 18:21:28 +0000 | [diff] [blame] | 96 | t.value as translation, |
| 97 | t.possibly_incorrect as fuzzy, |
droy | 35598f0 | 2008-06-03 15:16:48 +0000 | [diff] [blame] | 98 | IF(u.last_name <> '' AND u.first_name <> '', |
| 99 | CONCAT(CONCAT(first_name, ' '), u.last_name), |
droy | 8ad08be | 2008-11-12 19:49:33 +0000 | [diff] [blame] | 100 | IF(u.first_name <> '', u.first_name, u.last_name)) AS who, |
| 101 | u.userid, |
droy | ab4eaa1 | 2008-11-11 14:19:38 +0000 | [diff] [blame] | 102 | t.created_on, l.iso_code as language, |
droy | addb32f | 2008-06-03 15:11:51 +0000 | [diff] [blame] | 103 | f.project_id, f.version, f.name |
droy | 7fcffa7 | 2008-06-02 20:33:14 +0000 | [diff] [blame] | 104 | FROM |
| 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 |
droy | ab4eaa1 | 2008-11-11 14:19:38 +0000 | [diff] [blame] | 108 | LEFT JOIN users as u on u.userid = t.userid |
| 109 | LEFT JOIN languages as l on l.language_id = t.language_id |
droy | 7fcffa7 | 2008-06-02 20:33:14 +0000 | [diff] [blame] | 110 | $where |
| 111 | ORDER BY t.created_on desc |
| 112 | LIMIT $LIMIT"; |
| 113 | $rs_p_stat = mysql_query($sql, $dbh); |
atoulme | a4adf8e | 2009-01-27 19:01:35 +0000 | [diff] [blame] | 114 | global $addon; |
| 115 | $addon->callHook("head"); |
droy | 7fcffa7 | 2008-06-02 20:33:14 +0000 | [diff] [blame] | 116 | include($incfile); |
atoulme | a4adf8e | 2009-01-27 19:01:35 +0000 | [diff] [blame] | 117 | $addon->callHook("footer"); |
droy | 7fcffa7 | 2008-06-02 20:33:14 +0000 | [diff] [blame] | 118 | |
droy | 7fcffa7 | 2008-06-02 20:33:14 +0000 | [diff] [blame] | 119 | ?> |