index.php 921 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. // Main include
  3. include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
  4. if ($_REQUEST["ajax"] == 1 && $_REQUEST["token"] == $_SESSION["token"]) {
  5. // Data
  6. exec(HESTIA_CMD . "v-list-user-notifications $user json", $output, $return_var);
  7. $data = json_decode(implode("", $output), true);
  8. function sort_priorty_id($element1, $element2) {
  9. return $element2["PRIORITY"] <=> $element1["PRIORITY"];
  10. }
  11. $data = array_reverse($data, true);
  12. usort($data, sort_priorty_id(...));
  13. foreach ($data as $key => $note) {
  14. $note["ID"] = $key;
  15. $data[$key] = $note;
  16. }
  17. echo json_encode($data);
  18. exit();
  19. }
  20. $TAB = "NOTIFICATIONS";
  21. // Data
  22. exec(HESTIA_CMD . "v-list-user-notifications $user json", $output, $return_var);
  23. $data = json_decode(implode("", $output), true);
  24. $data = array_reverse($data, true);
  25. // Render page
  26. render_page($user, $TAB, "list_notifications");
  27. // Back uri
  28. $_SESSION["back"] = $_SERVER["REQUEST_URI"];