blob: 1b6730a824e494585a1524e68d21a4e132c90e15 [file] [log] [blame]
gobrien35e23782007-11-28 21:37:18 +00001<?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
kitlo47df0c62009-01-22 15:16:18 +000012 * Kit Lo (IBM) - patch, bug 261739, Inconsistent use of language names
gobrien35e23782007-11-28 21:37:18 +000013*******************************************************************************/
14
gobrien48275462007-11-29 21:29:17 +000015require_once("cb_global.php");
gobrien35e23782007-11-28 21:37:18 +000016
gobrienda3a4502008-01-28 23:43:26 +000017
18
kitlo47df0c62009-01-22 15:16:18 +000019$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";
kitlo2c8d8a92018-04-19 13:25:09 -040020$res = mysqli_query($dbh, $query);
gobrien35e23782007-11-28 21:37:18 +000021
gobrienad11d892007-12-19 08:33:25 +000022
23$return = Array();
24
droya3815a52019-09-25 12:49:18 -040025while($line = mysqli_fetch_array($res, MYSQLI_ASSOC)){
gobrienda3a4502008-01-28 23:43:26 +000026 if(isset($_SESSION['language']) and $line['language_id'] == $_SESSION['language']){
gobriene4a39c82008-01-11 00:06:14 +000027 $line['current'] = true;
28 }
gobrienad11d892007-12-19 08:33:25 +000029 $return[] = $line;
gobrien35e23782007-11-28 21:37:18 +000030}
31
gobrienad11d892007-12-19 08:33:25 +000032print json_encode($return);
33exit();
34
gobrien0a152142007-12-19 08:38:52 +000035?>