tiki-directory_search.php 1.51 KB
Newer Older
1
<?php
2
// (c) Copyright 2002-2011 by authors of the Tiki Wiki CMS Groupware Project
3
// 
4 5
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
6
// $Id$
changi67's avatar
changi67 committed
7

8
$section = 'directory';
9 10
require_once ('tiki-setup.php');
include_once ('lib/directory/dirlib.php');
11 12
$access->check_feature('feature_directory');
$access->check_permission('tiki_p_view_directory');
13 14 15 16 17
$smarty->assign('words', $_REQUEST['words']);
$smarty->assign('where', $_REQUEST['where']);
$smarty->assign('how', $_REQUEST['how']);
if (!isset($_REQUEST["sort_mode"])) {
	$sort_mode = 'hits_desc';
18
} else {
19
	$sort_mode = $_REQUEST["sort_mode"];
20
}
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
if (!isset($_REQUEST["offset"])) {
	$offset = 0;
} else {
	$offset = $_REQUEST["offset"];
}
if (isset($_REQUEST["find"])) {
	$find = $_REQUEST["find"];
} else {
	$find = '';
}
$smarty->assign_by_ref('offset', $offset);
$smarty->assign_by_ref('sort_mode', $sort_mode);
$smarty->assign('find', $find);
if ($_REQUEST['where'] == 'all') {
	$items = $dirlib->dir_search($_REQUEST['words'], $_REQUEST['how'], $offset, $maxRecords, $sort_mode);
} else {
	$items = $dirlib->dir_search_cat($_REQUEST['parent'], $_REQUEST['words'], $_REQUEST['how'], $offset, $maxRecords, $sort_mode);
}
39
$smarty->assign_by_ref('cant_pages', $items["cant"]);
40 41
$smarty->assign_by_ref('items', $items["data"]);
include_once ('tiki-section_options.php');
42
// Display the template
43
$smarty->assign('mid', 'tiki-directory_search.tpl');
44
$smarty->display("tiki.tpl");