From de9ae501e8bbed98bc65ecc2ecf63f1216586bf5 Mon Sep 17 00:00:00 2001 From: Nick Palmer Date: Sun, 18 Nov 2007 11:39:50 +0000 Subject: Latest changes from CVS. --- Pigeonholes.php | 41 +++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) (limited to 'Pigeonholes.php') diff --git a/Pigeonholes.php b/Pigeonholes.php index caece5e..70f47fb 100644 --- a/Pigeonholes.php +++ b/Pigeonholes.php @@ -1,6 +1,6 @@ - * @version $Revision: 1.117 $ + * @version $Revision: 1.118 $ * @package pigeonholes */ @@ -396,9 +396,10 @@ class Pigeonholes extends LibertyAttachable { if( !empty( $pPath ) && is_array( $pPath ) ) { foreach( $pPath as $node ) { $title = htmlspecialchars( $node['title'] ); - $ret .= ( @BitBase::verifyId( $node['parent_id'] ) ? ' » ' : '' ).''.$title.''; + $ret .= ( @BitBase::verifyId( $node['parent_id'] ) ? ' » ' : '' ).''.preg_replace('/ /',' ',$title).''; } } + return $ret; } @@ -761,7 +762,7 @@ class Pigeonholes extends LibertyAttachable { $result = $this->mDb->associateInsert( BIT_DB_PREFIX."pigeonhole_members", $item ); } } else { - vd( $this->mErrors ); + error_log( "Error inserting pigeonhole: " . vc($this->mErrors)); } return( count( $this->mErrors ) == 0 ); } @@ -910,9 +911,10 @@ class Pigeonholes extends LibertyAttachable { if( @BitBase::verifyId( $pContentId ) ) { $rewrite_tag = $gBitSystem->isFeatureActive( 'pretty_urls_extended' ) ? 'view/' : ''; if( $gBitSystem->isFeatureActive( 'pretty_urls' ) || $gBitSystem->isFeatureActive( 'pretty_urls_extended' ) ) { - $ret = PIGEONHOLES_PKG_URL.$rewrite_tag.$pContentId; + // WARNING: DIRECTORY SPECIFIC CODE!!! + $ret = DIRECTORY_PKG_URL.$rewrite_tag."category/".$pContentId; } else { - $ret = PIGEONHOLES_PKG_URL.'view.php?content_id='.$pContentId; + $ret = PIGEONHOELS_PKG_URL.'view.php?content_id='.$pContentId; } } return $ret; @@ -1245,6 +1247,33 @@ function pigeonholes_content_list_sql( &$pObject, $pParamHash = NULL ) { $ret['where_sql'] = 'AND pm.`parent_id` IN ('.implode( ',', array_fill( 0, count( $contentIds ), '?' )).')'; $ret['bind_vars'] = $_REQUEST['pigeonholes']['filter'] = $contentIds; } + + if( !empty( $pParamHash['pigeonholes']['root_filter'] )) { + $pParamHash['liberty_root_categories'] = $pParamHash['pigeonholes']['root_filter']; + } + + if( !empty( $pParamHash['liberty_root_categories'] )) { + if( !is_array( $pParamHash['liberty_root_categories'] )) { + $pParamHash['liberty_root_categories'] = array( $pParamHash['liberty_root_categories'] ); + } + + // if we want to allow items in subcategories, we get those and include them in the query + if( !empty( $pParamHash['pigeonholes']['root_sub_holes'] )) { + $pigeonholes = new Pigeonholes(); + $contentIds = array(); + foreach( $pParamHash['liberty_root_categories'] as $pigeonhole ) { + $pigeons = $pigeonholes->getSubPigeonholes( $pigeonhole ); + $contentIds = array_merge( $contentIds, array_keys( $pigeons )); + } + $contentIds = array_unique( array_merge( $pParamHash['liberty_root_categories'], $contentIds )); + } else { + $contentIds = $pParamHash['liberty_root_categories']; + } + + $ret['join_sql'] = "INNER JOIN `".BIT_DB_PREFIX."pigeonhole_members` rpm ON (rlc.`content_id`=rpm.`content_id`)"; + $ret['where_sql'] = 'AND rpm.`parent_id` IN ('.implode( ',', array_fill( 0, count( $contentIds ), '?' )).')'; + $ret['bind_vars'] = $_REQUEST['pigeonholes']['filter'] = $contentIds; + } } return $ret; -- cgit v1.3