function chat_load() { $vars['comments'] = chat_getcomments(); $vars['lastcomment'] = $vars['comments'][0]['datum_raw']; $vars['users'] = chat_getusers('html'); return $vars; }
echo json_encode(array('result' => 'error', 'text' => 'Hiba a mysql küldésben!')); } else { echo json_encode(array('result' => 'saved', 'text' => $query)); } //code to be executed if n=label3; break; case 'ChatLoad': if (!$user->checkRole("'any'")) { echo json_encode(array('result' => 'error', 'text' => 'Hiányzó jogosultság')); break; } $date = date('Y-m-d H:i:s', strtotime($_REQUEST['date'])); if (!isset($_REQUEST['rev'])) { $comments = chat_getcomments(array('last' => $date)); } else { $comments = chat_getcomments(array('first' => $date)); } $alert = 0; foreach ($comments as $k => $i) { $comments[$k]['html'] = $twig->render('chat/chatComment.twig', array('comment' => $i)); if ($i['user'] != $user->login) { $alert++; } } echo json_encode(array('result' => 'loaded', 'comments' => $comments, 'new' => count($comments), 'alert' => $alert)); break; case 'ChatUsers': if (!$user->checkRole("'any'")) { echo json_encode(array('result' => 'error', 'text' => 'Hiányzó jogosultság')); break; }