Пример #1
0
<?php

$custom_css = array('search.scss', 'forum.scss');
$page_title = 'Search';
require_once 'header.php';
$search = new search($app);
if (isset($_GET['q'])) {
    $q = preg_replace('/[^a-zA-Z0-9"@._-\\s]/', '', strip_tags(html_entity_decode($_GET['q'])));
    $results = $search->go($q);
}
?>
            <h1>Search</h1>
            <form action="/search.php" method="GET">
                <input type="text" placeholder="Search term" value="<?php 
echo isset($_GET['q']) ? htmlspecialchars($_GET['q']) : '';
?>
" name="q" class='short'>
                <input type="submit" value="Search" class="button left">
            </form>

<?php 
if (isset($_GET['q'])) {
    ?>
            <strong class='white'>Search results for:</strong> <?php 
    echo $search->getLastSearchTerm();
    ?>
            <br/><br/>

<?php 
    //Are there any results
    if (!$results['articles'] && !$results['users'] && !$results['forum']) {
Пример #2
0
	    but WITHOUT ANY WARRANTY; without even the implied warranty of
	    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	    GNU General Public License for more details.
	
	    You should have received a copy of the GNU General Public License
	    along with Jetbird.  If not, see <http://www.gnu.org/licenses/>.
	*/
if (!function_exists("redirect")) {
    // This means that this page hasn't been included right
    die;
}
load("search");
switch ($_GET['action']) {
    case "search":
        $text = $_POST['search'];
        $post = search::go($text);
        if (!$post) {
            unset($post);
        }
        //die(var_dump($post));
        $smarty->assign("results", $post);
        break;
    case "search_weight":
        $text = $_GET['text'];
        $post = search::search_by_weight($text, 3);
        if (!$post) {
            unset($post);
        }
        //die(var_dump($post));
        $smarty->assign("results", $post);
        break;
Пример #3
0
<?php

header('Content-Type: application/json');
require_once 'init.php';
$result = array("status" => false);
if (isset($_GET['user'])) {
    if (isset($_GET['max'])) {
        $max = $_GET['max'];
    } else {
        $max = 5;
    }
    $users = $app->utils->search_users($_GET['user'], $max);
    if ($users) {
        $result['status'] = true;
        $result['users'] = $users;
    }
} else {
    if (isset($_GET['search'])) {
        $search = new search($app);
        $q = preg_replace('/[^a-zA-Z0-9"@._-\\s]/', '', strip_tags(html_entity_decode($_GET['search'])));
        $result['data'] = $search->go($q);
        if ($result['data']['articles'] || $result['data']['users'] || $result['data']['forum']) {
            $result['status'] = true;
        }
    }
}
$json = json_encode($result);
echo htmlspecialchars($json, ENT_NOQUOTES);