summaryrefslogtreecommitdiff
path: root/json.php
diff options
context:
space:
mode:
authorChristoph Brill <egore911@egore911.de>2012-05-07 12:49:09 +0200
committerChristoph Brill <egore911@egore911.de>2012-05-07 12:49:09 +0200
commitd0cef532e79c9c05d98ffea23fcbb9a5f3b893f2 (patch)
treec5502569ec5bcf8f8a87e23935a38158271cab39 /json.php
parentab1813097a430b21ec62bea46de0bcf2456eb807 (diff)
Rework the show mode to add user details only once
Diffstat (limited to 'json.php')
-rw-r--r--json.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/json.php b/json.php
index 0782afe..83d5268 100644
--- a/json.php
+++ b/json.php
@@ -39,11 +39,11 @@ $retval = array();
$retval['maxdate'] = valid_date('today');
$retval['channel'] = $channel;
$retval['date'] = $date;
-$retval['data'] = array();
switch ($_GET['mode']) {
case '':
case 'watch':
+ $retval['data'] = array();
// Determine which users will be watched
if (isset($_GET['users'])) {
@@ -102,6 +102,8 @@ switch ($_GET['mode']) {
}
break;
case 'show':
+ $retval['users'] = array();
+ $retval['data'] = array();
foreach ($lines as $line_num => $line) {
if (is_from_selected_channel($line, $channel)) {
if (!filter_join($line)) {
@@ -126,7 +128,8 @@ switch ($_GET['mode']) {
if ($image != null) {
$userdata['image'] = $image;
}
- $elem['user'] = $userdata;
+ $retval['users'][$user] = $userdata;
+ $elem['user'] = $user;
array_push($retval['data'], $elem);
}