diff options
| author | bitweaver.org <bitweaver@users.sourceforge.net> | 2005-06-19 05:04:25 +0000 |
|---|---|---|
| committer | bitweaver.org <bitweaver@users.sourceforge.net> | 2005-06-19 05:04:25 +0000 |
| commit | 7967104140a4a01872864806b7e509011838ca07 (patch) | |
| tree | c187d87daafa693d8f5869c81a217d6d0027a1e9 /directory_search.php | |
| download | search-7967104140a4a01872864806b7e509011838ca07.tar.gz search-7967104140a4a01872864806b7e509011838ca07.tar.bz2 search-7967104140a4a01872864806b7e509011838ca07.zip | |
IMPORT TikiPro CLYDE FINAL
Diffstat (limited to 'directory_search.php')
| -rw-r--r-- | directory_search.php | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/directory_search.php b/directory_search.php new file mode 100644 index 0000000..4f51cea --- /dev/null +++ b/directory_search.php @@ -0,0 +1,86 @@ +<?php + +// $Header: /cvsroot/bitweaver/_bit_search/directory_search.php,v 1.1 2005/06/19 05:04:25 bitweaver Exp $ + +// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al. +// 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. + +// Initialization +require_once( '../bit_setup_inc.php' ); + +include_once( DIRECTORY_PKG_PATH.'dir_lib.php' ); + +if ($feature_directory != 'y') { + $smarty->assign('msg', tra("This feature is disabled").": feature_directory"); + + $gBitSystem->display( 'error.tpl' ); + die; +} + +if (!$gBitUser->hasPermission( 'bit_p_view_directory' )) { + $smarty->assign('msg', tra("Permission denied")); + + $gBitSystem->display( 'error.tpl' ); + die; +} + +$smarty->assign('words', $_REQUEST['words']); +$smarty->assign('where', $_REQUEST['where']); +$smarty->assign('how', $_REQUEST['how']); + +if ( empty( $_REQUEST["sort_mode"] ) ) { + $sort_mode = 'hits_desc'; +} else { + $sort_mode = $_REQUEST["sort_mode"]; +} +$smarty->assign_by_ref('sort_mode', $sort_mode); + +if (!isset($_REQUEST["offset"])) { + $offset = 0; +} else { + $offset = $_REQUEST["offset"]; +} +if (isset($_REQUEST['page'])) { + $page = &$_REQUEST['page']; + $offset = ($page - 1) * $maxRecords; +} +$smarty->assign_by_ref('offset', $offset); + +if (isset($_REQUEST["find"])) { + $find = $_REQUEST["find"]; +} else { + $find = ''; +} +$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); +} + +$cant_pages = ceil($items["cant"] / $maxRecords); +$smarty->assign_by_ref('cant_pages', $cant_pages); +$smarty->assign('actual_page', 1 + ($offset / $maxRecords)); + +if ($items["cant"] > ($offset + $maxRecords)) { + $smarty->assign('next_offset', $offset + $maxRecords); +} else { + $smarty->assign('next_offset', -1); +} + +if ($offset > 0) { + $smarty->assign('prev_offset', $offset - $maxRecords); +} else { + $smarty->assign('prev_offset', -1); +} + +$smarty->assign_by_ref('items', $items["data"]); + +$section = 'directory'; + +// Display the template +$gBitSystem->display( 'bitpackage:search/directory_search.tpl'); + +?> |
