From 84c5638183cdd64cdaef909f26a5be2fa43eaab0 Mon Sep 17 00:00:00 2001 From: modela bitweaver Date: Sat, 13 Feb 2021 19:03:53 -0500 Subject: move bit_setup_inc.php to includes/ --- bit_setup_inc.php | 107 --------------------------------------------- includes/bit_setup_inc.php | 107 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+), 107 deletions(-) delete mode 100644 bit_setup_inc.php create mode 100644 includes/bit_setup_inc.php diff --git a/bit_setup_inc.php b/bit_setup_inc.php deleted file mode 100644 index c43e8ac..0000000 --- a/bit_setup_inc.php +++ /dev/null @@ -1,107 +0,0 @@ - 'boards', - 'package_path' => dirname( __FILE__ ).'/', - 'homeable' => TRUE, -); -$gBitSystem->registerPackage( $registerHash ); - -if( $gBitSystem->isPackageActive( 'boards' ) && $gBitUser->hasPermission( 'p_boards_read' )) { - $menuHash = array( - '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( - 'content_display_function' => 'boards_content_display', - 'content_preview_function' => 'boards_content_edit', - 'content_edit_function' => 'boards_content_edit', - 'content_store_function' => 'boards_content_store', - 'content_verify_function' => 'boards_content_verify', - 'content_expunge_function' => 'boards_content_expunge', - 'comment_store_function' => 'boards_comment_store', -// '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' ) ) { - $registerArray['content_edit_mini_tpl'] = 'bitpackage:boards/boards_edit_mini_inc.tpl'; - } - - $gLibertySystem->registerService( LIBERTY_SERVICE_FORUMS, BOARDS_PKG_NAME, $registerArray ); - - function boards_get_topic_comment( $pThreadForwardSequence ) { - return( intval( substr( $pThreadForwardSequence, 0, 9 ) ) ); - } - - $gBitThemes->loadCss(BOARDS_PKG_PATH.'styles/boards.css'); - - /** - * load up moderation in case we are using modcomments - * 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' ); - global $gModerationSystem; - - if( $gBitSystem->isPackageActive( 'moderation' ) ) { - - // Register our event handler - $gModerationSystem->registerModerationObserver(BOARDS_PKG_NAME, 'modcomments', 'board_comments_moderation'); - $gModerationSystem->registerModerationObserver(BOARDS_PKG_NAME, 'liberty', 'board_comments_moderation'); - - // 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->load(); - $comments_return_url = ''; - $root_id = $storeComment->mInfo['root_id']; - global $gContent; - $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'); - // Try to pick up the message! - 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'); - $mailer = new BitMailer(); - - if( $pModerationInfo['last_status'] == MODERATION_DELETE ) { - // Send a reject message - $mailer->sendEmail($code, '', $boardSync, - array( 'sender' => - BitBoard::getBoardSyncInbox() ) ); - } else { - // Send an accept message - $mailer->sendEmail($code, '', $boardSync, - array('sender' => - BitBoard::getBoardSyncInbox(), - 'x_headers' => - array( 'Approved' => - $approved) ) ); - } - } - } - } - } - } -} -?> diff --git a/includes/bit_setup_inc.php b/includes/bit_setup_inc.php new file mode 100644 index 0000000..c43e8ac --- /dev/null +++ b/includes/bit_setup_inc.php @@ -0,0 +1,107 @@ + 'boards', + 'package_path' => dirname( __FILE__ ).'/', + 'homeable' => TRUE, +); +$gBitSystem->registerPackage( $registerHash ); + +if( $gBitSystem->isPackageActive( 'boards' ) && $gBitUser->hasPermission( 'p_boards_read' )) { + $menuHash = array( + '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( + 'content_display_function' => 'boards_content_display', + 'content_preview_function' => 'boards_content_edit', + 'content_edit_function' => 'boards_content_edit', + 'content_store_function' => 'boards_content_store', + 'content_verify_function' => 'boards_content_verify', + 'content_expunge_function' => 'boards_content_expunge', + 'comment_store_function' => 'boards_comment_store', +// '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' ) ) { + $registerArray['content_edit_mini_tpl'] = 'bitpackage:boards/boards_edit_mini_inc.tpl'; + } + + $gLibertySystem->registerService( LIBERTY_SERVICE_FORUMS, BOARDS_PKG_NAME, $registerArray ); + + function boards_get_topic_comment( $pThreadForwardSequence ) { + return( intval( substr( $pThreadForwardSequence, 0, 9 ) ) ); + } + + $gBitThemes->loadCss(BOARDS_PKG_PATH.'styles/boards.css'); + + /** + * load up moderation in case we are using modcomments + * 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' ); + global $gModerationSystem; + + if( $gBitSystem->isPackageActive( 'moderation' ) ) { + + // Register our event handler + $gModerationSystem->registerModerationObserver(BOARDS_PKG_NAME, 'modcomments', 'board_comments_moderation'); + $gModerationSystem->registerModerationObserver(BOARDS_PKG_NAME, 'liberty', 'board_comments_moderation'); + + // 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->load(); + $comments_return_url = ''; + $root_id = $storeComment->mInfo['root_id']; + global $gContent; + $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'); + // Try to pick up the message! + 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'); + $mailer = new BitMailer(); + + if( $pModerationInfo['last_status'] == MODERATION_DELETE ) { + // Send a reject message + $mailer->sendEmail($code, '', $boardSync, + array( 'sender' => + BitBoard::getBoardSyncInbox() ) ); + } else { + // Send an accept message + $mailer->sendEmail($code, '', $boardSync, + array('sender' => + BitBoard::getBoardSyncInbox(), + 'x_headers' => + array( 'Approved' => + $approved) ) ); + } + } + } + } + } + } +} +?> -- cgit v1.3