diff options
Diffstat (limited to 'includes/bit_setup_inc.php')
| -rwxr-xr-x[-rw-r--r--] | includes/bit_setup_inc.php | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/includes/bit_setup_inc.php b/includes/bit_setup_inc.php index 978e245..10c46e6 100644..100755 --- a/includes/bit_setup_inc.php +++ b/includes/bit_setup_inc.php @@ -1,25 +1,34 @@ <?php +use \Bitweaver\Boards\BitBoard; +use \Bitweaver\Liberty\LibertyComment; +use \Bitweaver\BitMailer; + global $gBitSystem, $gBitThemes; -$registerHash = array( +$pRegisterHash = [ 'package_name' => 'boards', 'package_path' => dirname( dirname( __FILE__ ) ).'/', - 'homeable' => TRUE, -); -$gBitSystem->registerPackage( $registerHash ); + 'homeable' => true, +]; + +// fix to quieten down VS Code which can't see the dynamic creation of these ... +define( 'BOARDS_PKG_NAME', $pRegisterHash['package_name'] ); +define( 'BOARDS_PKG_URL', BIT_ROOT_URL . basename( $pRegisterHash['package_path'] ) . '/' ); +define( 'BOARDS_PKG_PATH', BIT_ROOT_PATH . basename( $pRegisterHash['package_path'] ) . '/' ); +define( 'BOARDS_PKG_INCLUDE_PATH', BIT_ROOT_PATH . basename( $pRegisterHash['package_path'] ) . '/includes/'); +define( 'BOARDS_PKG_CLASS_PATH', BIT_ROOT_PATH . basename( $pRegisterHash['package_path'] ) . '/includes/classes/'); +define( 'BOARDS_PKG_ADMIN_PATH', BIT_ROOT_PATH . basename( $pRegisterHash['package_path'] ) . '/admin/'); +$gBitSystem->registerPackage( $pRegisterHash ); if( $gBitSystem->isPackageActive( 'boards' ) && $gBitUser->hasPermission( 'p_boards_read' )) { - $menuHash = array( + $menuHash = [ 'package_name' => BOARDS_PKG_NAME, 'index_url' => BOARDS_PKG_URL.'index.php', 'menu_template' => 'bitpackage:boards/menu_boards.tpl', - ); + ]; $gBitSystem->registerAppMenu( $menuHash ); - require_once( BOARDS_PKG_CLASS_PATH.'BitBoard.php' ); - require_once( BOARDS_PKG_CLASS_PATH.'BitBoardTopic.php' ); - - $registerArray = array( + $registerArray = [ 'content_display_function' => 'boards_content_display', 'content_preview_function' => 'boards_content_edit', 'content_edit_function' => 'boards_content_edit', @@ -30,7 +39,7 @@ if( $gBitSystem->isPackageActive( 'boards' ) && $gBitUser->hasPermission( 'p_boa // 'content_view_tpl' => 'bitpackage:boards/service_view_boards.tpl', 'content_icon_tpl' => 'bitpackage:boards/boards_service_icons.tpl', 'content_list_sql_function' => 'boards_content_list_sql', - ); + ]; if ( !$gBitSystem->isFeatureActive( 'boards_hide_edit_tpl' ) && !$gBitSystem->isFeatureActive( 'boards_link_by_pigeonholes' ) ) { @@ -40,7 +49,7 @@ if( $gBitSystem->isPackageActive( 'boards' ) && $gBitUser->hasPermission( 'p_boa $gLibertySystem->registerService( LIBERTY_SERVICE_FORUMS, BOARDS_PKG_NAME, $registerArray ); function boards_get_topic_comment( $pThreadForwardSequence ) { - return( intval( substr( $pThreadForwardSequence, 0, 9 ) ) ); + return intval( substr( $pThreadForwardSequence, 0, 9 ) ); } $gBitThemes->loadCss(BOARDS_PKG_PATH.'styles/boards.css'); @@ -50,7 +59,7 @@ if( $gBitSystem->isPackageActive( 'boards' ) && $gBitUser->hasPermission( 'p_boa * we need to include its bit_setup_inc incase comments gets loaded first */ if( file_exists(BIT_ROOT_PATH.'moderation/bit_setup_inc.php') ) { - require_once( BIT_ROOT_PATH.'moderation/bit_setup_inc.php' ); + require_once BIT_ROOT_PATH.'moderation/bit_setup_inc.php'; global $gModerationSystem; if( $gBitSystem->isPackageActive( 'moderation' ) ) { @@ -62,26 +71,26 @@ if( $gBitSystem->isPackageActive( 'boards' ) && $gBitUser->hasPermission( 'p_boa // And define the function we use to handle the observation. function board_comments_moderation($pModerationInfo) { if( $pModerationInfo['type'] == 'comment_post' ) { - $storeComment = new LibertyComment( NULL, $pModerationInfo['content_id'] ); + $storeComment = new LibertyComment( null, $pModerationInfo['content_id'] ); $storeComment->load(); $comments_return_url = ''; $root_id = $storeComment->mInfo['root_id']; global $gContent; - $board = new BitBoard(NULL, $root_id); + $board = new BitBoard(null, $root_id); $board->load(); $boardSync = $board->getPreference('board_sync_list_address'); $code = $storeComment->getPreference('board_confirm_code'); $approved = $board->getPreference('boards_mailing_list_password'); // Possible race. Did we beat the cron? if( empty($code) ) { - require_once(BOARDS_PKG_INCLUDE_PATH.'admin/boardsync_inc.php'); + require_once BOARDS_PKG_INCLUDE_PATH.'admin/boardsync_inc.php'; // Try to pick up the message! - board_sync_run(TRUE); + board_sync_run(true); } if( !empty($code) && !empty($boardSync) && !empty($approved) ) { $boardSync = str_replace('@', '-request@', $boardSync); $code = 'confirm '.$code; -uire_once(KERNEL_PKG_CLASS_PATH.'BitMailer.php'); + require_once KERNEL_PKG_CLASS_PATH.'BitMailer.php'; $mailer = new BitMailer(); if( $pModerationInfo['last_status'] == MODERATION_DELETE ) { @@ -103,5 +112,4 @@ uire_once(KERNEL_PKG_CLASS_PATH.'BitMailer.php'); } } } -} -?> +}
\ No newline at end of file |
