gobrien | 35e2378 | 2007-11-28 21:37:18 +0000 | [diff] [blame] | 1 | <?php |
| 2 | /******************************************************************************* |
| 3 | * Copyright (c) 2007 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 | * Paul Colton (Aptana)- initial API and implementation |
| 11 | * Eclipse Foundation |
kitlo | 47df0c6 | 2009-01-22 15:16:18 +0000 | [diff] [blame] | 12 | * Kit Lo (IBM) - patch, bug 261739, Inconsistent use of language names |
gobrien | 35e2378 | 2007-11-28 21:37:18 +0000 | [diff] [blame] | 13 | *******************************************************************************/ |
| 14 | |
gobrien | 4827546 | 2007-11-29 21:29:17 +0000 | [diff] [blame] | 15 | require_once("cb_global.php"); |
gobrien | 35e2378 | 2007-11-28 21:37:18 +0000 | [diff] [blame] | 16 | |
gobrien | da3a450 | 2008-01-28 23:43:26 +0000 | [diff] [blame] | 17 | |
| 18 | |
kitlo | 47df0c6 | 2009-01-22 15:16:18 +0000 | [diff] [blame] | 19 | $query = "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"; |
kitlo | 2c8d8a9 | 2018-04-19 13:25:09 -0400 | [diff] [blame] | 20 | $res = mysqli_query($dbh, $query); |
gobrien | 35e2378 | 2007-11-28 21:37:18 +0000 | [diff] [blame] | 21 | |
gobrien | ad11d89 | 2007-12-19 08:33:25 +0000 | [diff] [blame] | 22 | |
| 23 | $return = Array(); |
| 24 | |
droy | a3815a5 | 2019-09-25 12:49:18 -0400 | [diff] [blame] | 25 | while($line = mysqli_fetch_array($res, MYSQLI_ASSOC)){ |
gobrien | da3a450 | 2008-01-28 23:43:26 +0000 | [diff] [blame] | 26 | if(isset($_SESSION['language']) and $line['language_id'] == $_SESSION['language']){ |
gobrien | e4a39c8 | 2008-01-11 00:06:14 +0000 | [diff] [blame] | 27 | $line['current'] = true; |
| 28 | } |
gobrien | ad11d89 | 2007-12-19 08:33:25 +0000 | [diff] [blame] | 29 | $return[] = $line; |
gobrien | 35e2378 | 2007-11-28 21:37:18 +0000 | [diff] [blame] | 30 | } |
| 31 | |
gobrien | ad11d89 | 2007-12-19 08:33:25 +0000 | [diff] [blame] | 32 | print json_encode($return); |
| 33 | exit(); |
| 34 | |
gobrien | 0a15214 | 2007-12-19 08:38:52 +0000 | [diff] [blame] | 35 | ?> |