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 |
| 11 | *******************************************************************************/ |
| 12 | include("global.php"); |
| 13 | |
| 14 | InitPage(""); |
| 15 | |
| 16 | global $User; |
| 17 | global $App, $dbh; |
| 18 | |
| 19 | $pageTitle = "Babel - Recent Translations"; |
| 20 | $pageKeywords = ""; |
droy | addb32f | 2008-06-03 15:11:51 +0000 | [diff] [blame] | 21 | $incfile = "content/en_recent_html_list.php"; |
droy | 7fcffa7 | 2008-06-02 20:33:14 +0000 | [diff] [blame] | 22 | |
| 23 | $PROJECT_VERSION = $App->getHTTPParameter("project_version"); |
| 24 | $PROJECT_ID = ""; |
| 25 | $VERSION = ""; |
| 26 | |
| 27 | if($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"); |
| 34 | if($LANGUAGE_ID == "") { |
| 35 | $LANGUAGE_ID = $_SESSION["language"]; |
| 36 | } |
| 37 | if($LANGUAGE_ID == "All") { |
| 38 | $LANGUAGE_ID = ""; |
| 39 | } |
| 40 | $LIMIT = $App->getHTTPParameter("limit"); |
| 41 | if($LIMIT == "" || $LIMIT <= 0 || $LIMIT > 1000) { |
| 42 | $LIMIT = 200; |
| 43 | } |
droy | addb32f | 2008-06-03 15:11:51 +0000 | [diff] [blame] | 44 | $LAYOUT = $App->getHTTPParameter("layout"); |
| 45 | if($LAYOUT == "list" || $LAYOUT == "table") { |
| 46 | $incfile = "content/en_recent_html_" . $LAYOUT . ".php"; |
| 47 | } |
droy | 7fcffa7 | 2008-06-02 20:33:14 +0000 | [diff] [blame] | 48 | $FORMAT = $App->getHTTPParameter("format"); |
| 49 | if($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 | |
droy | addb32f | 2008-06-03 15:11:51 +0000 | [diff] [blame] | 57 | $sql = "SELECT language_id, IF(locale <> '', CONCAT(CONCAT(locale, ' '), name), name) as name FROM languages WHERE is_active ORDER BY name"; |
droy | 7fcffa7 | 2008-06-02 20:33:14 +0000 | [diff] [blame] | 58 | $rs_l_list = mysql_query($sql, $dbh); |
| 59 | |
| 60 | $where = " t.is_active "; |
| 61 | |
| 62 | if($PROJECT_ID != "") { |
| 63 | $where = $App->addAndIfNotNull($where) . " f.project_id = "; |
| 64 | $where .= $App->returnQuotedString($App->sqlSanitize($PROJECT_ID, $dbh)); |
| 65 | } |
| 66 | if($LANGUAGE_ID != "") { |
| 67 | $where = $App->addAndIfNotNull($where) . " t.language_id = "; |
| 68 | $where .= $App->returnQuotedString($App->sqlSanitize($LANGUAGE_ID, $dbh)); |
| 69 | } |
| 70 | if($VERSION != "") { |
| 71 | $where = $App->addAndIfNotNull($where) . "f.version = "; |
| 72 | $where .= $App->returnQuotedString($App->sqlSanitize($VERSION, $dbh)); |
| 73 | } |
| 74 | |
| 75 | if($where != "") { |
| 76 | $where = " WHERE " . $where; |
| 77 | } |
| 78 | |
| 79 | |
| 80 | $sql = "SELECT |
droy | addb32f | 2008-06-03 15:11:51 +0000 | [diff] [blame] | 81 | s.name AS string_key, s.value as string_value, |
| 82 | t.value as translation, |
droy | 35598f0 | 2008-06-03 15:16:48 +0000 | [diff] [blame] | 83 | 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, |
droy | addb32f | 2008-06-03 15:11:51 +0000 | [diff] [blame] | 86 | t.created_on, |
| 87 | f.project_id, f.version, f.name |
droy | 7fcffa7 | 2008-06-02 20:33:14 +0000 | [diff] [blame] | 88 | FROM |
| 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 |
| 94 | ORDER BY t.created_on desc |
| 95 | LIMIT $LIMIT"; |
| 96 | $rs_p_stat = mysql_query($sql, $dbh); |
droy | 7fcffa7 | 2008-06-02 20:33:14 +0000 | [diff] [blame] | 97 | include("head.php"); |
| 98 | include($incfile); |
| 99 | include("foot.php"); |
| 100 | |
| 101 | |
| 102 | |
| 103 | ?> |