index.php 1022 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. // Init
  3. error_reporting(NULL);
  4. session_start();
  5. $TAB = 'SEARCH';
  6. $_SESSION['back'] = $_SERVER['REQUEST_URI'];
  7. include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
  8. // Check query
  9. $q = $_GET['q'];
  10. if (empty($q)) {
  11. $back = getenv('HTTP_REFERER');
  12. if (!empty($back)) {
  13. header("Location: $back");
  14. exit;
  15. }
  16. header("Location: /");
  17. exit;
  18. }
  19. // Header
  20. include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
  21. // Panel
  22. top_panel($user,$TAB);
  23. $lang = 'ru_RU.utf8';
  24. //setlocale(LC_ALL, $lang);
  25. // Data
  26. if ($_SESSION['user'] == 'admin') {
  27. v_exec('v-search-object', [$q, 'json'], false, $output);
  28. $data = json_decode($output, true);
  29. include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_search.html');
  30. } else {
  31. v_exec('v-search-user-object', [$user, $q, 'json'], false, $output);
  32. $data = json_decode($output, true);
  33. include($_SERVER['DOCUMENT_ROOT'].'/templates/user/list_search.html');
  34. }
  35. // Footer
  36. include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');