From ca400d1b97ff591f157a11ad0b442046468eb413 Mon Sep 17 00:00:00 2001 From: spiderr Date: Fri, 12 Feb 2021 13:28:46 -0500 Subject: rename *_structure_inc.php to structure_*_inc.php --- edit_book.php | 2 +- includes/lookup_page_inc.php | 17 ++++++++++++----- index.php | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/edit_book.php b/edit_book.php index 7d85f4a..9b572a0 100644 --- a/edit_book.php +++ b/edit_book.php @@ -140,7 +140,7 @@ if( isset($_REQUEST["createstructure"]) ) { // set the correct display template $mid = 'bitpackage:wiki/edit_book.tpl'; - include_once( LIBERTY_PKG_INCLUDE_PATH.'edit_structure_inc.php'); + include_once( LIBERTY_PKG_INCLUDE_PATH.'structure_edit_inc.php'); if( $gBitThemes->isAjaxRequest() ) { $gBitSmarty->display( 'bitpackage:kernel/feedback_inc.tpl' ); } diff --git a/includes/lookup_page_inc.php b/includes/lookup_page_inc.php index 8fe4da9..e7eb19f 100644 --- a/includes/lookup_page_inc.php +++ b/includes/lookup_page_inc.php @@ -75,16 +75,23 @@ if( $gContent->isValid() && empty( $gStructure ) ) { } else { $structure=''; } - $structs = $gContent->getStructures(); - if (count($structs)==1) { - $gStructure = new LibertyStructure( $structs[0]['structure_id'] ); + if( $structs = $gContent->getStructures() ) { + $structId = $structs[0]['structure_id']; + if( count( $structs ) > 0 ) { + $gBitSmarty->assign('showstructs', $structs); + foreach( $structs as $struct ) { + if( $struct['parent_id'] == 0 ) { + $structId = $struct['structure_id']; + break; + } + } + } + $gStructure = new LibertyStructure( $structId ); if( $gStructure->load() ) { $gStructure->loadNavigation(); $gStructure->loadPath(); $gBitSmarty->assign( 'structureInfo', $gStructure->mInfo ); } - } else { - $gBitSmarty->assign('showstructs', $structs); } } diff --git a/index.php b/index.php index 3cf1a10..9cc8fd5 100644 --- a/index.php +++ b/index.php @@ -19,7 +19,7 @@ $gBitSystem->verifyPackage( 'wiki' ); require_once( WIKI_PKG_CLASS_PATH.'BitPage.php' ); if( !empty( $_REQUEST['structure_id'] ) ) { - include( LIBERTY_PKG_INCLUDE_PATH.'display_structure_inc.php' ); + include( LIBERTY_PKG_INCLUDE_PATH.'structure_display_inc.php' ); } else { // if no page set if ( !isset( $_REQUEST['page'] ) and !isset( $_REQUEST['page_id'] ) ) { -- cgit v1.3