27 lines
717 B
PHP
27 lines
717 B
PHP
|
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||
|
header('Content-Type: application/json');
|
||
|
|
||
|
// $_GET
|
||
|
// ----------------------------------------------------------------------------
|
||
|
// (string) $_GET['query']
|
||
|
$query = isset($_GET['query']) ? Text::lowercase($_GET['query']) : false;
|
||
|
// ----------------------------------------------------------------------------
|
||
|
if ($query===false) {
|
||
|
exit (json_encode(array(
|
||
|
'status'=>1,
|
||
|
'files'=>'Invalid query.'
|
||
|
)));
|
||
|
}
|
||
|
|
||
|
$tmp = array();
|
||
|
$parents = buildParentPages();
|
||
|
foreach ($parents as $parent) {
|
||
|
$lowerTitle = Text::lowercase($parent->title());
|
||
|
if (Text::stringContains($lowerTitle, $query)) {
|
||
|
$tmp[$parent->title()] = $parent->key();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
exit (json_encode($tmp));
|
||
|
|
||
|
?>
|