Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 54 lines (45 sloc) 2.033 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
<?php
// Initialization
require_once( '../kernel/setup_inc.php' );
require_once( ILIKE_PKG_PATH.'iLike.php');

$gBitSystem->verifyPackage( 'ilike' );
$gBitSystem->verifyPermission( 'p_ilike_search' );

$gLike = new iLike();
$feedback = array();

if( empty( $contentTypes ) ) {
$contentTypes = array( '' => tra( 'All Content' ) );
foreach( $gLibertySystem->mContentTypes as $cType ) {
if ($gLike->hasViewPermission($cType['content_type_guid'])) {
$contentTypes[$cType['content_type_guid']] = $gLibertySystem->getContentTypeName( $cType['content_type_guid'] );
}
}
}
$gBitSmarty->assign( 'contentTypes', $contentTypes );

// this is for backward compat with old param contentTypes incase of old bookmarks to search
if( !empty( $_REQUEST['contentTypes'] ) && empty( $_REQUEST['content_type_guid'] ) ){
$_REQUEST['content_type_guid'] = $_REQUEST['contentTypes'];
unset($_REQUEST['contentTypes']);
}

$_REQUEST['find'] = !empty( $_REQUEST['highlight'] ) ? $_REQUEST['highlight'] : NULL;
$searchHash = $_REQUEST;
if( !empty( $_REQUEST['find'] ) && $results = $gLike->search( $searchHash ) ) {
$gBitSmarty->assign( "results", $results );
} elseif( !empty( $_REQUEST['find'] ) ) {
$feedback['error'] = $gLike->mErrors;
}

// adding contenttype to listInfo is a little complex - this replicates code in liberty::get_content_list_inc.php
if( !empty( $_REQUEST['content_type_guid'] )) {
if( !is_array( $_REQUEST['content_type_guid'] )) {
$guids = explode( ",", $_REQUEST['content_type_guid'] );
} else {
$guids = $_REQUEST['content_type_guid'];
}
$searchHash['listInfo']['ihash']['content_type_guid'] = $guids;
}

// assign so that all form fields are repopulated regardless of whether we have results or not - search services are dependent on this
if( !empty( $searchHash['listInfo'] ) ){
$gBitSmarty->assign( "listInfo", $searchHash['listInfo'] );
}


$gBitSmarty->assign( "feedback", $feedback );
$gBitSystem->display( 'bitpackage:ilike/search.tpl', tra( 'Search Results' ) , array( 'display_mode' => 'display' ));
?>
Something went wrong with that request. Please try again.