2
/* vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab: */
2
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
5
Copyright (c) Ampache.org
8
This program is free software; you can redistribute it and/or
9
modify it under the terms of the GNU General Public License v2
10
as published by the Free Software Foundation.
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with this program; if not, write to the Free Software
19
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
5
* LICENSE: GNU General Public License, version 2 (GPLv2)
6
* Copyright 2001 - 2013 Ampache.org
8
* This program is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU General Public License v2
10
* as published by the Free Software Foundation
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
23
require_once '../init.php';
24
25
function arrayToJSON($array) {
26
foreach ($array as $key => $value) {
27
$json .= '"' . $key . '" : ';
28
if (is_array($value)) {
29
$json .= arrayToJSON($value);
32
// Make sure to strip backslashes and convert things to
33
// entities in our output
34
$json .= '"' . scrub_out(str_replace('\\', '', $value)) . '"';
38
$json = rtrim($json, ', ');
27
foreach ($array as $key => $value) {
28
$json .= '"' . $key . '" : ';
29
if (is_array($value)) {
30
$json .= arrayToJSON($value);
33
// Make sure to strip backslashes and convert things to
34
// entities in our output
35
$json .= '"' . scrub_out(str_replace('\\', '', $value)) . '"';
39
$json = rtrim($json, ', ');
42
43
Header('content-type: application/x-javascript');