|
|
@ -19,12 +19,29 @@ if (API_ENABLED) { |
|
|
|
|
|
|
|
|
|
|
|
if (API_SEARCH_ENABLED) { |
|
|
|
if (API_SEARCH_ENABLED) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Connect Sphinx search server |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$sphinx = new SphinxQL(SPHINX_HOST, SPHINX_PORT); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch(Exception $e) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var_dump($e); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exit; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Connect database |
|
|
|
// Connect database |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
$db = new MySQL(DB_HOST, DB_PORT, DB_NAME, DB_USERNAME, DB_PASSWORD); |
|
|
|
$db = new MySQL(DB_HOST, DB_PORT, DB_NAME, DB_USERNAME, DB_PASSWORD); |
|
|
|
|
|
|
|
|
|
|
|
// Connect Sphinx search server |
|
|
|
} catch(Exception $e) { |
|
|
|
$sphinx = new SphinxQL(SPHINX_HOST, SPHINX_PORT); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var_dump($e); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exit; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Filter request data |
|
|
|
// Filter request data |
|
|
|
$type = !empty($_GET['type']) ? Filter::url($_GET['type']) : 'text'; |
|
|
|
$type = !empty($_GET['type']) ? Filter::url($_GET['type']) : 'text'; |
|
|
@ -77,8 +94,17 @@ if (API_ENABLED) { |
|
|
|
if (API_HOSTS_ENABLED) { |
|
|
|
if (API_HOSTS_ENABLED) { |
|
|
|
|
|
|
|
|
|
|
|
// Connect database |
|
|
|
// Connect database |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
$db = new MySQL(DB_HOST, DB_PORT, DB_NAME, DB_USERNAME, DB_PASSWORD); |
|
|
|
$db = new MySQL(DB_HOST, DB_PORT, DB_NAME, DB_USERNAME, DB_PASSWORD); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch(Exception $e) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var_dump($e); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exit; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$response = [ |
|
|
|
$response = [ |
|
|
|
'status' => true, |
|
|
|
'status' => true, |
|
|
|
'totals' => $db->getTotalHosts(), |
|
|
|
'totals' => $db->getTotalHosts(), |
|
|
|