Files
VestaCP/web/search/index.php

44 lines
1.1 KiB
PHP
Raw Normal View History

2012-09-27 20:30:09 +03:00
<?php
// Init
error_reporting(NULL);
session_start();
2012-09-29 01:55:51 +03:00
$TAB = 'SEARCH';
2012-10-01 17:29:49 +03:00
$_SESSION['back'] = $_SERVER['REQUEST_URI'];
2012-09-27 20:30:09 +03:00
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
2012-09-29 01:55:51 +03:00
// Check query
$q = $_GET['q'];
if (empty($q)) {
$back=getenv("HTTP_REFERER");
2012-09-29 01:55:51 +03:00
if (!empty($back)) {
header("Location: ".$back);
2012-09-29 01:55:51 +03:00
exit;
}
header("Location: /");
2012-09-27 20:30:09 +03:00
exit;
}
2012-09-29 01:55:51 +03:00
// Header
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
2012-09-27 20:30:09 +03:00
2012-09-29 01:55:51 +03:00
// Panel
top_panel($user,$TAB);
2013-01-22 18:43:07 +02:00
$lang = 'ru_RU.utf8';
//setlocale(LC_ALL, $lang);
2013-01-22 18:43:07 +02:00
2012-09-29 01:55:51 +03:00
// Data
$q = escapeshellarg($q);
2012-09-29 01:55:51 +03:00
if ($_SESSION['user'] == 'admin') {
exec (VESTA_CMD."v-search-object ".$q." json", $output, $return_var);
$data = json_decode(implode('', $output), true);
2012-09-29 01:55:51 +03:00
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_search.html');
} else {
exec (VESTA_CMD."v-search-user-object ".$user." ".$q." json", $output, $return_var);
$data = json_decode(implode('', $output), true);
2012-10-01 17:29:49 +03:00
include($_SERVER['DOCUMENT_ROOT'].'/templates/user/list_search.html');
2012-09-29 01:55:51 +03:00
}
// Footer
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');