From 27b224f36d0587e79447fce1e5cb62161005e616 Mon Sep 17 00:00:00 2001 From: lsces Date: Mon, 9 Mar 2026 20:23:02 +0000 Subject: As with articles, boards has had a blanket Smarty5 and PHP8.4 sweep of the code, but as yet this has not been tested. VSCode is currently saying the files are now clean. --- .htaccess | 4 +- admin/admin_boards_inc.php | 77 ++++++++------- admin/boardsync_cron.php | 10 +- admin/boardsync_inc.php | 86 ++++++++--------- admin/phpbb_migrate.php | 12 +-- admin/schema_inc.php | 60 ++++++------ admin/upgrade_inc.php | 3 - admin/upgrades/1.0.1.php | 4 +- ajax.php | 2 +- assign.php | 6 +- boards_rss.php | 8 +- css/boards.css | 15 ++- edit.php | 12 +-- edit_topic.php | 7 +- includes/bit_setup_inc.php | 48 ++++++---- includes/classes/BitBoard.php | 143 +++++++++++++--------------- includes/classes/BitBoardPost.php | 130 ++++++++++++------------- includes/classes/BitBoardTopic.php | 188 ++++++++++++++++++------------------- includes/edit_topic_inc.php | 6 +- includes/list_boards_inc.php | 24 ++--- includes/lookup_inc.php | 8 +- includes/user_preferences_inc.php | 22 ++--- includes/view_board_inc.php | 29 +++--- includes/view_topic_inc.php | 37 ++++---- index.php | 2 +- mailing_list.php | 16 ++-- modules/help_mod_recent_posts.tpl | 6 +- modules/mod_recent_posts.php | 4 +- modules/mod_recent_posts.tpl | 6 +- rss.php | 4 +- styles/boards.css | 107 ++++++++++++++++----- templates/admin_boards.tpl | 18 ++-- templates/board_assign.tpl | 22 ++--- templates/board_cat.tpl | 6 +- templates/board_edit.tpl | 6 +- templates/board_table.tpl | 8 +- templates/boards_edit_mini_inc.tpl | 4 +- templates/boards_rss_form.tpl | 4 +- templates/boards_service_icons.tpl | 4 +- templates/comment_post.tpl | 14 +-- templates/flipswitch.tpl | 6 +- templates/html_head_inc.tpl | 12 +-- templates/legend_inc.tpl | 6 +- templates/list_boards.tpl | 4 +- templates/list_posts.tpl | 34 +++---- templates/list_topics.tpl | 68 +++++++------- templates/mailing_list.tpl | 24 ++--- templates/menu_boards.tpl | 8 +- templates/menu_boards_admin.tpl | 9 +- templates/post_display.tpl | 52 +++++----- templates/topic_move.tpl | 6 +- templates/user_preferences_inc.tpl | 4 +- topic_move.php | 4 +- 53 files changed, 739 insertions(+), 670 deletions(-) mode change 100644 => 100755 .htaccess mode change 100644 => 100755 admin/admin_boards_inc.php mode change 100644 => 100755 admin/boardsync_cron.php mode change 100644 => 100755 admin/boardsync_inc.php mode change 100644 => 100755 admin/phpbb_migrate.php mode change 100644 => 100755 admin/schema_inc.php mode change 100644 => 100755 admin/upgrade_inc.php mode change 100644 => 100755 admin/upgrades/1.0.1.php mode change 100644 => 100755 ajax.php mode change 100644 => 100755 assign.php mode change 100644 => 100755 boards_rss.php mode change 100644 => 100755 css/boards.css mode change 100644 => 100755 edit.php mode change 100644 => 100755 edit_topic.php mode change 100644 => 100755 includes/bit_setup_inc.php mode change 100644 => 100755 includes/classes/BitBoard.php mode change 100644 => 100755 includes/classes/BitBoardPost.php mode change 100644 => 100755 includes/classes/BitBoardTopic.php mode change 100644 => 100755 includes/edit_topic_inc.php mode change 100644 => 100755 includes/list_boards_inc.php mode change 100644 => 100755 includes/lookup_inc.php mode change 100644 => 100755 includes/user_preferences_inc.php mode change 100644 => 100755 includes/view_board_inc.php mode change 100644 => 100755 includes/view_topic_inc.php mode change 100644 => 100755 index.php mode change 100644 => 100755 mailing_list.php mode change 100644 => 100755 modules/help_mod_recent_posts.tpl mode change 100644 => 100755 modules/mod_recent_posts.php mode change 100644 => 100755 modules/mod_recent_posts.tpl mode change 100644 => 100755 rss.php mode change 100644 => 100755 styles/boards.css mode change 100644 => 100755 templates/admin_boards.tpl mode change 100644 => 100755 templates/board_assign.tpl mode change 100644 => 100755 templates/board_cat.tpl mode change 100644 => 100755 templates/board_edit.tpl mode change 100644 => 100755 templates/board_table.tpl mode change 100644 => 100755 templates/boards_edit_mini_inc.tpl mode change 100644 => 100755 templates/boards_rss_form.tpl mode change 100644 => 100755 templates/boards_service_icons.tpl mode change 100644 => 100755 templates/comment_post.tpl mode change 100644 => 100755 templates/flipswitch.tpl mode change 100644 => 100755 templates/html_head_inc.tpl mode change 100644 => 100755 templates/legend_inc.tpl mode change 100644 => 100755 templates/list_boards.tpl mode change 100644 => 100755 templates/list_posts.tpl mode change 100644 => 100755 templates/list_topics.tpl mode change 100644 => 100755 templates/mailing_list.tpl mode change 100644 => 100755 templates/menu_boards.tpl mode change 100644 => 100755 templates/menu_boards_admin.tpl mode change 100644 => 100755 templates/post_display.tpl mode change 100644 => 100755 templates/topic_move.tpl mode change 100644 => 100755 templates/user_preferences_inc.tpl mode change 100644 => 100755 topic_move.php diff --git a/.htaccess b/.htaccess old mode 100644 new mode 100755 index 477cf65..94957e0 --- a/.htaccess +++ b/.htaccess @@ -1,8 +1,5 @@ RewriteEngine on - - RewriteRule .*index.php/.*php$ /forums/ [L,R=404] - # Uncomment this if mod_rewrites are not working for you. some hosting services have cranky mod_rewrite # RewriteBase /boards/ RewriteCond %{SCRIPT_FILENAME} -f [OR] @@ -16,6 +13,7 @@ RewriteRule ^view/topic/(\d+.*)$ index.php?t=$1 [L,QSA] + # fake out phpBB user profile page RewriteCond %{REQUEST_URI} profile.php RewriteCond %{QUERY_STRING} .*mode=viewprofile.*u=([0-9]*) diff --git a/admin/admin_boards_inc.php b/admin/admin_boards_inc.php old mode 100644 new mode 100755 index e9c494e..3ece564 --- a/admin/admin_boards_inc.php +++ b/admin/admin_boards_inc.php @@ -10,57 +10,57 @@ // $gBitSmarty->assign('home_bitboard', $_REQUEST["homeBitBoards"]); //} -require_once( BOARDS_PKG_CLASS_PATH.'BitBoard.php' ); +namespace Bitweaver\Boards;; -$formBitBoardsLists = array( - 'boards_thread_track' => array( +$formBitBoardsLists = [ + 'boards_thread_track' => [ 'label' => 'Enable Topic Status Tracking', - 'note' => 'Allow users to see what topic have been changed since they last logged on.', - ), - 'boards_thread_notification' => array( + 'note' => 'Allow users to see what topic have been changed since they last logged on.', + ], + 'boards_thread_notification' => [ 'label' => 'Enable Topic Reply Notification', - 'note' => 'Allow users to be sent emails when topics they are interested in receive replies.', - ), - 'boards_posts_anon_moderation' => array( + 'note' => 'Allow users to be sent emails when topics they are interested in receive replies.', + ], + 'boards_posts_anon_moderation' => [ 'label' => 'Require Anonymous Post Moderation', - 'note' => 'Require that ALL Anonymous posts must be validated before they are shown.', - ), - 'boards_hide_edit_tpl' => array( + 'note' => 'Require that ALL Anonymous posts must be validated before they are shown.', + ], + 'boards_hide_edit_tpl' => [ 'label' => 'Hide Linked Boards Option', - 'note' => 'Hide the Linked Boards option on edit pages to link any given content to a forum thread. If you hide this, you will have to manually assign content to a forum thread if you want to make full use of the boards.', - ), - 'boards_link_by_pigeonholes' => array( + 'note' => 'Hide the Linked Boards option on edit pages to link any given content to a forum thread. If you hide this, you will have to manually assign content to a forum thread if you want to make full use of the boards.', + ], + 'boards_link_by_pigeonholes' => [ 'label' => 'Link by Pigeonholes', - 'note' => 'Link content to boards based on pigeonholes. This is useful when you have only one board in a given pigeonhole and want all content in the same pigeonhole to be shown in the board. Note that you MUST run the following SQL on your database to allow content in more than one board: "alter table boards_map drop constraint boards_map_pkey;" This is therfore a very advanced option.' - ), -); + 'note' => 'Link content to boards based on pigeonholes. This is useful when you have only one board in a given pigeonhole and want all content in the same pigeonhole to be shown in the board. Note that you MUST run the following SQL on your database to allow content in more than one board: "alter table boards_map drop constraint boards_map_pkey;" This is therfore a very advanced option.', + ], +]; $gBitSmarty->assign( 'formBitBoardsLists',$formBitBoardsLists ); -$formBitBoardsSync = array( - 'boards_sync_mail_server' => array( +$formBitBoardsSync = [ + 'boards_sync_mail_server' => [ 'label' => 'Email Server', - 'note' => 'Internet address of your mail server.', - ), - 'boards_sync_user' => array( + 'note' => 'Internet address of your mail server.', + ], + 'boards_sync_user' => [ 'label' => 'Email Username', - 'note' => 'Username used to login to the board sync email account.', - ), - 'boards_sync_password' => array( + 'note' => 'Username used to login to the board sync email account.', + ], + 'boards_sync_password' => [ 'label' => 'Email Password', - 'note' => 'Password used to login to the board sync email account.', - ), -); + 'note' => 'Password used to login to the board sync email account.', + ], +]; $gBitSmarty->assign( 'formBitBoardsSync',$formBitBoardsSync ); $processForm = set_tab(); -$formBoardsEmailList = array( - "boards_email_list" => array( +$formBoardsEmailList = [ + "boards_email_list" => [ 'label' => 'Group Email List', - 'note' => 'Enable groups to have an associated email list', - ), -); + 'note' => 'Enable groups to have an associated email list', + ], +]; $gBitSmarty->assign( 'formBoardsEmailList',$formBoardsEmailList ); -$formBoardsEmailText = array( 'boards_email_host', 'boards_email_admin', 'server_mailman_bin', 'server_mailman_cmd', 'server_newaliases_cmd', 'server_aliases_file' ); +$formBoardsEmailText = [ 'boards_email_host', 'boards_email_admin', 'server_mailman_bin', 'server_mailman_cmd', 'server_newaliases_cmd', 'server_aliases_file' ]; if( $processForm ) { $bitboardToggles = array_merge( $formBitBoardsLists,$formBoardsEmailList ); @@ -68,16 +68,15 @@ if( $processForm ) { simple_set_toggle( $item, BOARDS_PKG_NAME ); } foreach( $formBitBoardsSync as $key => $data ) { - $gBitSystem->storeConfig( $key, (!empty( $_REQUEST[$key] ) ? $_REQUEST[$key] : NULL), BOARDS_PKG_NAME ); + $gBitSystem->storeConfig( $key, $_REQUEST[$key] ?? null, BOARDS_PKG_NAME ); } foreach( $formBoardsEmailText as $text ) { - $gBitSystem->storeConfig( $text, ( !empty( $_REQUEST[$text] ) ? trim( $_REQUEST[$text] ) : NULL ), BOARDS_PKG_NAME ); + $gBitSystem->storeConfig( $text, !empty( $_REQUEST[$text] ) ? trim( $_REQUEST[$text] ) : null, BOARDS_PKG_NAME ); } } $board = new BitBoard(); $boards = $board->getBoardSelectList( $_REQUEST ); -$gBitSmarty->assignByRef(BOARDS_PKG_NAME, $boards['data']); -?> +$gBitSmarty->assign(BOARDS_PKG_NAME, $boards['data'] ?? ''); diff --git a/admin/boardsync_cron.php b/admin/boardsync_cron.php old mode 100644 new mode 100755 index 9ea170c..40f6600 --- a/admin/boardsync_cron.php +++ b/admin/boardsync_cron.php @@ -1,13 +1,13 @@ setPermissionOverride('p_users_bypass_captcha', TRUE); + $gBitUser->setPermissionOverride('p_users_bypass_captcha', true); $connectionString = '{'.$gBitSystem->getConfig('boards_sync_mail_server','imap').':'.$gBitSystem->getConfig('boards_sync_mail_port','993').'/'.$gBitSystem->getConfig('boards_sync_mail_protocol','imap').'/ssl/novalidate-cert}'; @@ -18,7 +18,7 @@ function board_sync_run($pLog = FALSE) { if( $messageNumbers = imap_sort( $mbox, SORTDATE, 0 ) ) { foreach( $messageNumbers as $msgNum ) { if ($pLog) print "Processing Msg#: ".$msgNum."\n"; - $deleteMsg = FALSE; + $deleteMsg = false; $header = imap_headerinfo( $mbox, $msgNum ); // Is this a moderation message? @@ -57,10 +57,10 @@ function board_sync_run($pLog = FALSE) { // Is this a reminder message that we just skip? } elseif( preg_match('/[0-9]+ .*? moderator request.* waiting/', $header->subject) ) { if ($pLog) print "Deleting reminder.\n"; - $deleteMsg = TRUE; + $deleteMsg = true; } elseif( preg_match('/Welcome to the .* mailing list/', $header->subject) ) { if ($pLog) print "Deleting welcome message.\n"; - $deleteMsg = TRUE; + $deleteMsg = true; } else { // imap_headerinfo acts retarded on these emails and improperly parses the header unless we call fetchstructure first - so do it. // note this problem does not occure above when parsing the temp email in a moderated msg - god damn spooky @@ -69,7 +69,7 @@ function board_sync_run($pLog = FALSE) { // With multiple To: recipients it is often handy to know who the message is "Delivered-To" by the MTA $raw_headers = imap_fetchheader($mbox, $msgNum); $deliveredTo = board_sync_delivered_to($raw_headers); - $deleteMsg = board_sync_process_message( $mbox, $msgNum, $msgHeader, $msgStructure, FALSE, $pLog, $deliveredTo); + $deleteMsg = board_sync_process_message( $mbox, $msgNum, $msgHeader, $msgStructure, false, $pLog, $deliveredTo); // vd($deleteMsg); } if( $deleteMsg && empty( $gDebug ) && empty( $gArgs['test'] ) ) { @@ -191,7 +191,7 @@ function board_sync_get_user( $pFrom ) { return $gBitUser->getUserInfo( array( 'user_id'=>-1 ) ); } -function cache_check_content_prefs( $pName, $pValue, $pLower = FALSE ) { +function cache_check_content_prefs( $pName, $pValue, $pLower = false ) { global $gBitDb, $gBitSystem; static $prefs; @@ -206,13 +206,13 @@ function cache_check_content_prefs( $pName, $pValue, $pLower = FALSE ) { return $prefs[$pLower][$pName][$pValue]; } - return NULL; + return null; } /** * $pMsgHeader is a imap_headerinfo generated array **/ -function board_sync_process_message( $pMbox, $pMsgNum, $pMsgHeader, $pMsgStructure, $pModerate = FALSE , $pLog=FALSE, $pDeliveredTo=NULL) { +function board_sync_process_message( $pMbox, $pMsgNum, $pMsgHeader, $pMsgStructure, $pModerate = false , $pLog=false, $pDeliveredTo=null) { global $gBitSystem, $gBitDb; // vd( $pMsgHeader ); @@ -231,8 +231,8 @@ function board_sync_process_message( $pMbox, $pMsgNum, $pMsgHeader, $pMsgStructu if ($pLog) print(" Subject: ".$subject."\n"); - $matches = array(); - $toAddresses = array(); + $matches = []; + $toAddresses = []; $allRecipients = ""; if (empty($pDeliveredTo)) { if( isset( $pMsgHeader->toaddress ) ){ @@ -248,8 +248,8 @@ function board_sync_process_message( $pMbox, $pMsgNum, $pMsgHeader, $pMsgStructu $allSplit = split( ',', $allRecipients ); foreach( $allSplit as $s ) { $s = trim( $s ); - $matches = array(); - if( strpos( $s, '<' ) !== FALSE ) { + $matches = []; + if( strpos( $s, '<' ) !== false ) { if( preg_match( "/\s*(.*)\s*<\s*(.*)\s*>/", $s, $matches ) ) { $toAddresses[] = array( 'name'=>$matches[1], 'email'=>$matches[2] ); } elseif( preg_match('/<\s*(.*)\s*>\s*(.*)\s*/', $s, $matches) ) { @@ -282,12 +282,12 @@ function board_sync_process_message( $pMbox, $pMsgNum, $pMsgHeader, $pMsgStructu foreach( $toAddresses AS $to ) { if ($pLog) print( " Processing email: " . strtolower($to['email']) . "\n"); // get a board match for the email address - if( $boardContentId = cache_check_content_prefs( 'board_sync_list_address', strtolower($to['email']), TRUE ) ) { + if( $boardContentId = cache_check_content_prefs( 'board_sync_list_address', strtolower($to['email']), true ) ) { if ($pLog) print "Found Board Content $boardContentId for $to[email]\n"; // Do we already have this message in this board? - $contentId = NULL; - if( $message_id != NULL ) { + $contentId = null; + if( $message_id != null ) { $sql = "SELECT `content_id` FROM `".BIT_DB_PREFIX."liberty_comments` WHERE `message_guid`=? AND `root_id`=?"; $contentId = $gBitDb->getOne( $sql, array( $message_id, $boardContentId ) ); } @@ -312,7 +312,7 @@ function board_sync_process_message( $pMbox, $pMsgNum, $pMsgHeader, $pMsgStructu } $userInfo = board_sync_get_user( $fromaddress ); // prep the storage hash - $storeRow = array(); + $storeRow = []; $storeRow['created'] = strtotime( $date ); $storeRow['last_modified'] = $storeRow['created']; $storeRow['user_id'] = $userInfo['user_id']; @@ -325,7 +325,7 @@ function board_sync_process_message( $pMbox, $pMsgNum, $pMsgHeader, $pMsgStructu $storeRow['root_id'] = $rootId; $storeRow['parent_id'] = $replyId; - $partHash = array(); + $partHash = []; switch( $pMsgStructure->type ) { case '0': @@ -403,7 +403,7 @@ function board_sync_process_message( $pMbox, $pMsgNum, $pMsgHeader, $pMsgStructu if( $userInfo['user_id'] != ANONYMOUS_USER_ID ) { $userClass = $gBitSystem->getConfig( 'user_class', 'BitPermUser' ); $newBitUser = new $userClass( $userInfo['user_id'] ); - $newBitUser->load( TRUE ); + $newBitUser->load( true ); } if( !empty( $newBitUser ) && $newBitUser->isValid() ){ // flip gBitUser to our message sender @@ -411,7 +411,7 @@ function board_sync_process_message( $pMbox, $pMsgNum, $pMsgHeader, $pMsgStructu } // Load the parent board - $board = new BitBoard( NULL, $boardContentId ); + $board = new BitBoard( null, $boardContentId ); $board->load(); // Check the permission for the user on the board @@ -440,7 +440,7 @@ function board_sync_process_message( $pMbox, $pMsgNum, $pMsgHeader, $pMsgStructu } - $storeComment = new LibertyComment( NULL ); + $storeComment = new LibertyComment( null ); $gBitDb->StartTrans(); if( $storeComment->storeComment($storeRow) ) { // undo the attachment permission @@ -449,12 +449,12 @@ function board_sync_process_message( $pMbox, $pMsgNum, $pMsgHeader, $pMsgStructu // set moderation approval if( !$pModerate && $gBitSystem->isPackageActive('moderation') && $gBitSystem->isPackageActive('modcomments') ) { global $gModerationSystem, $gBitUser; - $moderation = $gModerationSystem->getModeration(NULL, $storeComment->mContentId); + $moderation = $gModerationSystem->getModeration(null, $storeComment->mContentId); if( !empty($moderation) ) { // Allow to moderate - $gBitUser->setPermissionOverride('p_admin', TRUE); + $gBitUser->setPermissionOverride('p_admin', true); $gModerationSystem->setModerationReply($moderation['moderation_id'], MODERATION_APPROVED); - $gBitUser->setPermissionOverride('p_admin', FALSE); + $gBitUser->setPermissionOverride('p_admin', false); } } @@ -469,44 +469,44 @@ function board_sync_process_message( $pMbox, $pMsgNum, $pMsgHeader, $pMsgStructu // done $gBitDb->CompleteTrans(); - return TRUE; + return true; }else{ bit_error_log( "Email sync error: Message Id not set. You shouldn't have even gotten this far." ); $gBitDb->RollbackTrans(); - return FALSE; + return false; } } else { if( count( $storeComment->mErrors ) == 1 && !empty( $storeComment->mErrors['store'] ) && $storeComment->mErrors['store'] == 'Duplicate comment.' ) { - return TRUE; + return true; } else { foreach( $storeComment->mErrors as $error ){ bit_error_log( $error ); } $gBitDb->RollbackTrans(); - return FALSE; + return false; } } } else { if ($pLog) print "Message Exists: $contentId : $boardContentId : $message_id : $pModerate\n"; // If this isn't a moderation message - if( $pModerate === FALSE ) { + if( $pModerate === false ) { // If the message exists it must have been approved via some // moderation mechanism, so make sure it is available if( $gBitSystem->isPackageActive('moderation') && $gBitSystem->isPackageActive('modcomments') ) { global $gModerationSystem, $gBitUser; - $storeComment = new LibertyComment( NULL, $contentId ); + $storeComment = new LibertyComment( null, $contentId ); $storeComment->loadComment(); if ($storeComment->mInfo['content_status_id'] > 0) { if ($pLog) print "Already approved: $contentId\n"; } else { - $moderation = $gModerationSystem->getModeration(NULL, $contentId); + $moderation = $gModerationSystem->getModeration(null, $contentId); // vd($moderation); if( !empty($moderation) ) { - $gBitUser->setPermissionOverride('p_admin', TRUE); + $gBitUser->setPermissionOverride('p_admin', true); if ($pLog) print( "Setting approved: $contentId\n" ); $gModerationSystem->setModerationReply($moderation['moderation_id'], MODERATION_APPROVED); - $gBitUser->setPermissionOverride('p_admin', FALSE); + $gBitUser->setPermissionOverride('p_admin', false); if ($pLog) print "Done"; } else { if ($pLog) print "ERROR: Unable to find moderation to approve for: $contentId"; @@ -516,17 +516,17 @@ function board_sync_process_message( $pMbox, $pMsgNum, $pMsgHeader, $pMsgStructu } else { // Store the approve code; if ($pLog) print "Storing approval code: " . $contentId . ":" . $pModerate . "\n"; - $storeComment = new LibertyComment( NULL, $contentId ); + $storeComment = new LibertyComment( null, $contentId ); $storeComment->storePreference('board_confirm_code', $pModerate); } - return TRUE; + return true; } } else { if ($pLog) print "No Board match found for $to[email]\n"; } } } - return FALSE; + return false; } function board_sync_raw_headers($body) { @@ -535,7 +535,7 @@ function board_sync_raw_headers($body) { } function board_sync_get_header($header, $body) { - $ret = NULL; + $ret = null; preg_match( '/^'.$header.':\s*(.*?)\s*$/m', $body, $matches); if (!empty($matches[1])) { $ret = $matches[1]; @@ -545,7 +545,7 @@ function board_sync_get_header($header, $body) { // $header is imap_headerinfo array function board_sync_get_headerinfo( $header, $key ){ - $ret = NULL; + $ret = null; if( isset( $header->$key ) ){ $ret = $header->$key; } @@ -556,7 +556,7 @@ function board_sync_delivered_to( $raw_headers ) { $ret = null; if (isset($raw_headers) && preg_match_all("/Delivered-To:\s*(.*)\s*/", $raw_headers, $deliveredTo) > 0) { - $ret = array(); + $ret = []; foreach ($deliveredTo[1] as $address) { // Make sure the Delivered-To: address is valid. if (validate_email_syntax( $address ) ) { @@ -573,10 +573,10 @@ function is_utf8($string) { [\x09\x0A\x0D\x20-\x7E] # ASCII | [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs - | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte + | [\xE1-\xEC\xEE\xEF][\x80-\xBF][2] # straight 3-byte | \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates - | \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3 - | [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15 - | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 + | \xF0[\x90-\xBF][\x80-\xBF][2] # planes 1-3 + | [\xF1-\xF3][\x80-\xBF][3] # planes 4-15 + | \xF4[\x80-\x8F][\x80-\xBF][2] # plane 16 )*$%xs', $string); } diff --git a/admin/phpbb_migrate.php b/admin/phpbb_migrate.php old mode 100644 new mode 100755 index f88270c..c787780 --- a/admin/phpbb_migrate.php +++ b/admin/phpbb_migrate.php @@ -18,7 +18,7 @@ require_once( '../../kernel/includes/setup_inc.php' ); $gBitSystem->verifyPermission( 'p_admin' ); -$_SESSION['captcha_verified'] = TRUE; +$_SESSION['captcha_verified'] = true; global $db; @@ -65,7 +65,7 @@ vd( $forumList ); flush(); foreach( array_keys( $forumList ) as $forumId ) { print "Migrating forum $forumId
\n"; flush(); if( empty( $forumList[$forumId]['content_id'] ) ) { - $forumStore = array(); + $forumStore = []; $forumStore['user_id'] = ROOT_USER_ID; $forumStore['title'] = $forumList[$forumId]['forum_name']; $forumStore['edit'] = $forumList[$forumId]['forum_desc']; @@ -105,7 +105,7 @@ function migrate_phpbb_forum( $pForumId, $pForumContentId ) { } $gBitDb->StartTrans(); while ( $row = $db->sql_fetchrow($result) ) { - $commentHash = array(); + $commentHash = []; $commentHash['root_id'] = $pForumContentId; $commentHash['parent_id'] = $pForumContentId; $commentHash['anon_name'] = $row['post_username']; @@ -123,8 +123,8 @@ $gBitDb->StartTrans(); print "Migrating Post $row[post_id]
\n"; flush(); $topicHash['root_id'] = $rootComment->mContentId; $topicHash['is_moved'] = $row['topic_moved_id']; - $topicHash['is_sticky'] = !empty( $row['topic_type'] ) ? '1' : NULL; - $topicHash['is_moved'] = ($row['topic_status'] == 2 ? '1' : NULL); + $topicHash['is_sticky'] = !empty( $row['topic_type'] ) ? '1' : null; + $topicHash['is_moved'] = ($row['topic_status'] == 2 ? '1' : null); $topicHash['migrate_topic_id'] = $row['topic_id']; $rootTopic = new BitBoardTopic( $rootComment->mContentId ); $rootTopic->store( $topicHash ); @@ -152,7 +152,7 @@ function migrate_phpbb_topic( $pTopicId, &$pRootComment ) { } while ( $row = $db->sql_fetchrow($result) ) { print "Migrating Post $row[post_id]
\n"; - $commentHash = array(); + $commentHash = []; $commentHash['root_id'] = $pRootComment->getField( 'root_id' ); $commentHash['parent_id'] = $pRootComment->getField( 'content_id' ); $commentHash['anon_name'] = $row['post_username']; diff --git a/admin/schema_inc.php b/admin/schema_inc.php old mode 100644 new mode 100755 index 346bd46..be6958a --- a/admin/schema_inc.php +++ b/admin/schema_inc.php @@ -1,5 +1,5 @@ " comment_id I4 PRIMARY, is_approved I1 NOTNULL DEFAULT(0), @@ -42,7 +42,7 @@ $tables = array( notify I1 NOTNULL DEFAULT(0), notify_date I4 NOTNULL DEFAULT(0) " -); +]; global $gBitInstaller; @@ -50,50 +50,50 @@ foreach( array_keys( $tables ) AS $tableName ) { $gBitInstaller->registerSchemaTable( BOARDS_PKG_NAME, $tableName, $tables[$tableName] ); } -$gBitInstaller->registerPackageInfo( BOARDS_PKG_NAME, array( +$gBitInstaller->registerPackageInfo( BOARDS_PKG_NAME, [ 'description' => "Highly integrated message boards package.", 'license' => 'LGPL', -) ); +] ); // ### Indexes -$indices = array( - 'boards_id_idx' => array('table' => 'boards', 'cols' => 'board_id', 'opts' => NULL ), -); +$indices = [ + 'boards_id_idx' => [ 'table' => 'boards', 'cols' => 'board_id', 'opts' => null ], +]; $gBitInstaller->registerSchemaIndexes( BOARDS_PKG_NAME, $indices ); // ### Sequences -$sequences = array ( - 'boards_board_id_seq' => array( 'start' => 1 ), - 'boards_sections_id_seq' => array( 'start' => 1 ), -); +$sequences = [ + 'boards_board_id_seq' => [ 'start' => 1 ], + 'boards_sections_id_seq' => [ 'start' => 1 ], +]; $gBitInstaller->registerSchemaSequences( BOARDS_PKG_NAME, $sequences ); // ### Default UserPermissions -$gBitInstaller->registerUserPermissions( BOARDS_PKG_NAME, array( - array( 'p_boards_admin' , 'Can admin message boards' , 'admin' , BOARDS_PKG_NAME ), - array( 'p_boards_create', 'Can create a message board', 'editors', BOARDS_PKG_NAME ), - array( 'p_boards_post_update', 'Can update any post', 'editors', BOARDS_PKG_NAME ), - array( 'p_boards_update' , 'Can update any message board', 'editors', BOARDS_PKG_NAME ), - array( 'p_boards_read' , 'Can read message boards' , 'basic' , BOARDS_PKG_NAME ), - array( 'p_boards_remove', 'Can delete message boards' , 'editors', BOARDS_PKG_NAME ), -) ); +$gBitInstaller->registerUserPermissions( BOARDS_PKG_NAME, [ + [ 'p_boards_admin' , 'Can admin message boards' , 'admin' , BOARDS_PKG_NAME ], + [ 'p_boards_create', 'Can create a message board', 'editors', BOARDS_PKG_NAME ], + [ 'p_boards_post_update', 'Can update any post', 'editors', BOARDS_PKG_NAME ], + [ 'p_boards_update' , 'Can update any message board', 'editors', BOARDS_PKG_NAME ], + [ 'p_boards_read' , 'Can read message boards' , 'basic' , BOARDS_PKG_NAME ], + [ 'p_boards_remove', 'Can delete message boards' , 'editors', BOARDS_PKG_NAME ], +] ); // ### Default Preferences -$gBitInstaller->registerPreferences( BOARDS_PKG_NAME, array( - array( BOARDS_PKG_NAME, 'boards_thread_track', 'y' ), -)); +$gBitInstaller->registerPreferences( BOARDS_PKG_NAME, [ + [ BOARDS_PKG_NAME, 'boards_thread_track', 'y' ], +] ); if(defined('RSS_PKG_NAME')) { - $gBitInstaller->registerPreferences( BOARDS_PKG_NAME, array( - array( RSS_PKG_NAME, BOARDS_PKG_NAME.'_rss', 'y'), - )); + $gBitInstaller->registerPreferences( BOARDS_PKG_NAME, [ + [ RSS_PKG_NAME, BOARDS_PKG_NAME.'_rss', 'y'], + ] ); } // ### Register content types -$gBitInstaller->registerContentObjects( BOARDS_PKG_NAME, array( +$gBitInstaller->registerContentObjects( BOARDS_PKG_NAME, [ 'BitBoard'=>BOARDS_PKG_CLASS_PATH.'BitBoard.php', -)); +] ); // Requirements -$gBitInstaller->registerRequirements( BOARDS_PKG_NAME, array( - 'liberty' => array( 'min' => '2.1.4' ), -)); +$gBitInstaller->registerRequirements( BOARDS_PKG_NAME, [ + 'liberty' => [ 'min' => '5.0.0' ], +] ); diff --git a/admin/upgrade_inc.php b/admin/upgrade_inc.php old mode 100644 new mode 100755 index 2b1ae03..0542598 --- a/admin/upgrade_inc.php +++ b/admin/upgrade_inc.php @@ -20,6 +20,3 @@ require_once( BOARDS_PKG_ADMIN_PATH.'phpbb_migrate.php' ); migrate_phpbb(); */ - - -?> diff --git a/admin/upgrades/1.0.1.php b/admin/upgrades/1.0.1.php old mode 100644 new mode 100755 index 154a51c..6eef1b9 --- a/admin/upgrades/1.0.1.php +++ b/admin/upgrades/1.0.1.php @@ -8,7 +8,7 @@ $infoHash = array( 'package' => BOARDS_PKG_NAME, 'version' => str_replace( '.php', '', basename( __FILE__ )), 'description' => "Add boards sections and positioning.", - 'post_upgrade' => NULL, + 'post_upgrade' => null, ); $gBitInstaller->registerPackageUpgrade( $infoHash, array( @@ -26,7 +26,7 @@ array( 'DATADICT' => array( 'pos' => array( '`pos`', 'I4' ), ))), array( 'CREATEINDEX' => array( - 'boards_sections_idx' => array( 'boards', 'section_id', array() ), + 'boards_sections_idx' => array( 'boards', 'section_id', [] ), )), array( 'CREATESEQUENCE' => array( 'boards_sections_id_seq', diff --git a/ajax.php b/ajax.php old mode 100644 new mode 100755 index 486d933..9097f3d --- a/ajax.php +++ b/ajax.php @@ -13,7 +13,7 @@ /** * required setup */ -require_once( '../kernel/includes/setup_inc.php' ); +require_once '../kernel/includes/setup_inc.php'; // Is package installed and enabled $gBitSystem->verifyPackage( 'boards' ); diff --git a/assign.php b/assign.php old mode 100644 new mode 100755 index 274e9bc..4741d42 --- a/assign.php +++ b/assign.php @@ -11,7 +11,7 @@ /** * required setup */ -require_once( '../kernel/includes/setup_inc.php' ); +require_once '../kernel/includes/setup_inc.php'; // Is package installed and enabled $gBitSystem->verifyPackage( 'boards' ); @@ -37,7 +37,7 @@ if (!empty($_REQUEST['remove'])) { } } -if( !empty( $_REQUEST['assign'] ) && @BitBase::verifyId( $_REQUEST['to_board_id'] ) ) { +if( !empty( $_REQUEST['assign'] ) && BitBase::verifyId( $_REQUEST['to_board_id'] ?? 0 ) ) { $b = new BitBoard( $_REQUEST['to_board_id'] ); $b->load(); if ( $b->verifyUpdatePermission() ){ @@ -57,7 +57,7 @@ if (!empty($_REQUEST['integrity'])) { } $data = BitBoard::getAllMap(); -$gBitSmarty->assignByRef('data',$data); +$gBitSmarty->assign('data',$data); // Display the template $gBitSystem->display( 'bitpackage:boards/board_assign.tpl', tra('Assign content to Board') , array( 'display_mode' => 'display' )); diff --git a/boards_rss.php b/boards_rss.php old mode 100644 new mode 100755 index 68a352c..ce8d038 --- a/boards_rss.php +++ b/boards_rss.php @@ -24,7 +24,7 @@ if( !empty( $_REQUEST['t'] ) || !empty($_REQUEST['b'] ) ){ $gContent->load(); } else{ - $gBitSystem->fatalError(tra("Unknown discussion"), NULL, NULL, HttpStatusCodes::HTTP_GONE ); + $gBitSystem->fatalError(tra("Unknown discussion"), null, null, HttpStatusCodes::HTTP_GONE ); } } $gContent->verifyViewPermission(); @@ -73,7 +73,7 @@ switch( $gContent->getField('content_type_guid') ){ case 'bitboard': default: $topic = new BitBoardTopic(); - $pParamHash = array(); + $pParamHash = []; if( !empty( $_REQUEST['b'] ) ) { $pParamHash['b'] = $_REQUEST['b']; } @@ -128,10 +128,10 @@ foreach( $feeds as $feed ) { } $user->load(); - $item->author = $user->getDisplayName();//$gBitUser->getDisplayName( FALSE, array( 'user_id' => $feed['modifier_user_id'] ) ); + $item->author = $user->getDisplayName();//$gBitUser->getDisplayName( false, array( 'user_id' => $feed['modifier_user_id'] ) ); $item->authorEmail = $user->mInfo['email']; $item->descriptionTruncSize = $gBitSystem->getConfig( 'rssfeed_truncate', 1000 ); - $item->descriptionHtmlSyndicated = FALSE; + $item->descriptionHtmlSyndicated = false; /* var_dump($item); echo ""; diff --git a/css/boards.css b/css/boards.css old mode 100644 new mode 100755 index c1de790..bb19e36 --- a/css/boards.css +++ b/css/boards.css @@ -1,4 +1,13 @@ -.bitboard .title h3 {margin: 0px; font-size: 1.2em} -.bitboard .desc {font-size: .9em; clear:both;} -.bitboard .topic {font-size: .9em;} +.bitboard .title h3 { + margin: 0px; + font-size: 1.2em +} +.bitboard .desc { + font-size: .9em; + clear: both; +} + +.bitboard .topic { + font-size: .9em; +} \ No newline at end of file diff --git a/edit.php b/edit.php old mode 100644 new mode 100755 index 2d35079..563413b --- a/edit.php +++ b/edit.php @@ -11,7 +11,7 @@ /** * required setup */ -require_once( '../kernel/includes/setup_inc.php' ); +require_once '../kernel/includes/setup_inc.php'; // Is package installed and enabled $gBitSystem->verifyPackage( 'boards' ); @@ -32,13 +32,13 @@ if( $gContent->isValid() ) { // Handle delete request if( isset( $_REQUEST['remove'] ) ) { // @TODO: Change to verifyExpungePermission when that exists in LibertyContent - if ( $gContent->isValid() && $gContent->hasUserPermission( 'p_boards_remove', TRUE, TRUE ) ) { + if ( $gContent->isValid() && $gContent->hasUserPermission( 'p_boards_remove', true, true ) ) { if( empty( $_REQUEST['confirm'] ) ) { $formHash['b'] = $_REQUEST['b']; - $formHash['remove'] = TRUE; + $formHash['remove'] = true; $gBitSystem->confirmDialog( $formHash, array( 'warning' => tra( 'Are you sure you want to remove the entire message board' ).' "'.$gContent->getTitle().'" ?', 'error' => 'This cannot be undone!' ) ); } elseif( !$gContent->expunge() ) { - $gBitSmarty->assignByRef( 'errors', $deleteComment->mErrors ); + $gBitSmarty->assign( 'errors', $deleteComment->mErrors ); } else { bit_redirect( BOARDS_PKG_URL.'index.php' ); } @@ -66,10 +66,10 @@ if( !empty( $_REQUEST["save_bitboard"] ) ) { // to avoid error messages. This can happen if some features are // disabled if( $gContent->store( $storeHash ) ) { - $gContent->storePreference( 'board_sync_list_address', (!empty( $_REQUEST['bitboardconfig']['board_sync_list_address'] ) ? $_REQUEST['bitboardconfig']['board_sync_list_address'] : NULL) ); + $gContent->storePreference( 'board_sync_list_address', (!empty( $_REQUEST['bitboardconfig']['board_sync_list_address'] ) ? $_REQUEST['bitboardconfig']['board_sync_list_address'] : null) ); bit_redirect( $gContent->getDisplayUrl() ); } else { - $gBitSmarty->assignByRef( 'errors', $gContent->mErrors ); + $gBitSmarty->assign( 'errors', $gContent->mErrors ); } } diff --git a/edit_topic.php b/edit_topic.php old mode 100644 new mode 100755 index 38c31b0..47f448e --- a/edit_topic.php +++ b/edit_topic.php @@ -11,7 +11,8 @@ /** * required setup */ -require_once( '../kernel/includes/setup_inc.php' ); +use \Bitweaver\Boards\BitBoard; +require_once '../kernel/includes/setup_inc.php'; // Is package installed and enabled $gBitSystem->verifyPackage( 'boards' ); @@ -54,7 +55,7 @@ if( isset($_REQUEST['is_locked']) || isset($_REQUEST['is_sticky']) ){ if( !empty( $_REQUEST['cancel'] ) ) { // user cancelled - just continue on, doing nothing } elseif( empty( $_REQUEST['confirm'] ) ) { - $formHash['remove'] = TRUE; + $formHash['remove'] = true; $formHash['t'] = $_REQUEST['t']; $gBitSystem->confirmDialog( $formHash, array( @@ -66,7 +67,7 @@ if( isset($_REQUEST['is_locked']) || isset($_REQUEST['is_sticky']) ){ // @TODO Topic should extend LibertyComment - but until that day we load it up a second time $topicAsComment = new LibertyComment( $_REQUEST['t'] ); if( !$topicAsComment->expunge() ) { - $gBitSmarty->assignByRef( 'errors', $topicAsComment->mErrors ); + $gBitSmarty->assign( 'errors', $topicAsComment->mErrors ); } // send us back to the baord - http_referer won't work with confirm process bit_redirect( BOARDS_PKG_URL.'index.php?b='. $gContent->mInfo['board_id'] ); diff --git a/includes/bit_setup_inc.php b/includes/bit_setup_inc.php old mode 100644 new mode 100755 index 978e245..10c46e6 --- a/includes/bit_setup_inc.php +++ b/includes/bit_setup_inc.php @@ -1,25 +1,34 @@ '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 diff --git a/includes/classes/BitBoard.php b/includes/classes/BitBoard.php old mode 100644 new mode 100755 index c0a296f..6104a00 --- a/includes/classes/BitBoard.php +++ b/includes/classes/BitBoard.php @@ -14,7 +14,13 @@ /** * required setup */ -require_once( LIBERTY_PKG_CLASS_PATH.'LibertyMime.php' ); +namespace Bitweaver\Boards; +use Bitweaver\BitBase; +use Bitweaver\KernelTools; +use Bitweaver\Pigeonholes\Pigeonholes; +use Bitweaver\Liberty\LibertyContent; +use Bitweaver\Liberty\LibertyMime; +use function intval; /** * This is used to uniquely identify the object @@ -34,7 +40,7 @@ class BitBoard extends LibertyMime { /** * During initialisation, be sure to call our base constructors **/ - function __construct( $pBitBoardId=NULL, $pContentId=NULL ) { + function __construct( $pBitBoardId=null, $pContentId=null ) { parent::__construct(); $this->mBitBoardId = (int)$pBitBoardId; $this->mContentId = (int)$pContentId; @@ -58,16 +64,16 @@ class BitBoard extends LibertyMime { /** * Load the data from the database - * @param pParamHash be sure to pass by reference in case we need to make modifcations to the hash + * @param array pParamHash be sure to pass by reference in case we need to make modifcations to the hash **/ - function load( $pContentId = NULL, $pPluginParams = NULL ) { + public function load( $pContentId = null, $pPluginParams = null ) { if( $this->verifyId( $this->mBitBoardId ) || $this->verifyId( $this->mContentId ) ) { // LibertyContent::load()assumes you have joined already, and will not execute any sql! // This is a significant performance optimization $lookupColumn = $this->verifyId( $this->mBitBoardId ) ? 'board_id' : 'content_id'; - $bindVars = array(); + $bindVars = []; $selectSql = $joinSql = $whereSql = ''; - array_push( $bindVars, (int)($lookupId = @BitBase::verifyId( $this->mBitBoardId ) ? $this->mBitBoardId : $this->mContentId) ); + array_push( $bindVars, (int)($lookupId = BitBase::verifyId( $this->mBitBoardId ) ? $this->mBitBoardId : $this->mContentId) ); $this->getServicesSql( 'content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars ); $query = "SELECT s.*, lc.*, " . @@ -86,20 +92,20 @@ class BitBoard extends LibertyMime { $this->mContentId = $result->fields['content_id']; $this->mBitBoardId = $result->fields['board_id']; - $this->mInfo['creator'] =( isset( $result->fields['creator_real_name'] )? $result->fields['creator_real_name'] : $result->fields['creator_user'] ); - $this->mInfo['editor'] =( isset( $result->fields['modifier_real_name'] )? $result->fields['modifier_real_name'] : $result->fields['modifier_user'] ); + $this->mInfo['creator'] =( $result->fields['creator_real_name'] ?? $result->fields['creator_user'] ); + $this->mInfo['editor'] =( $result->fields['modifier_real_name'] ?? $result->fields['modifier_user'] ); $this->mInfo['display_url'] = $this->getDisplayUrl(); $this->parseData(); LibertyMime::load(); } } - return( count( $this->mInfo ) ); + return count( $this->mInfo ); } public static function lookupByMigrateBoard( $pMigrateBoardId ) { global $gBitDb; - $ret = NULL; + $ret = null; if( BitBase::verifyId( $pMigrateBoardId ) ) { $ret = $gBitDb->getOne( "SELECT `board_id` FROM `".BIT_DB_PREFIX."boards` bb WHERE `migrate_board_id`=?", array( $pMigrateBoardId ) ); } @@ -108,31 +114,26 @@ class BitBoard extends LibertyMime { /** * Any method named Store inherently implies data will be written to the database - * @param pParamHash be sure to pass by reference in case we need to make modifcations to the hash + * @param array pParamHash be sure to pass by reference in case we need to make modifcations to the hash * This is the ONLY method that should be called in order to store( create or update )an bitboard! * It is very smart and will figure out what to do for you. It should be considered a black box. * * @param array pParams hash of values that will be used to store the page * - * @return bool TRUE on success, FALSE if store could not occur. If FALSE, $this->mErrors will have reason why + * @return bool true on success, false if store could not occur. If false, $this->mErrors will have reason why * * @access public **/ - function store( &$pParamHash ) { + public function store( array &$pParamHash ): bool { if( $this->verify( $pParamHash )&& LibertyMime::store( $pParamHash ) ) { $table = BIT_DB_PREFIX."boards"; $this->StartTrans(); if( $this->mBitBoardId ) { - $locId = array( "board_id" => $pParamHash['board_id'] ); + $locId = [ "board_id" => $pParamHash['board_id'] ]; $result = $this->mDb->associateUpdate( $table, $pParamHash['board_store'], $locId ); } else { $pParamHash['board_store']['content_id'] = $pParamHash['content_id']; - if( @$this->verifyId( $pParamHash['board_id'] ) ) { - // if pParamHash['board_id'] is set, some is requesting a particular board_id. Use with caution! - $pParamHash['board_store']['board_id'] = $pParamHash['board_id']; - } else { - $pParamHash['board_store']['board_id'] = $this->mDb->GenID( 'boards_board_id_seq' ); - } + $pParamHash['board_store']['board_id'] = ( @$this->verifyId( $pParamHash['board_id'] ) ) ? $pParamHash['board_id'] : $this->mDb->GenID( 'boards_board_id_seq' ); $this->mBitBoardId = $pParamHash['board_store']['board_id']; $result = $this->mDb->associateInsert( $table, $pParamHash['board_store'] ); @@ -142,7 +143,7 @@ class BitBoard extends LibertyMime { require_once( UTIL_PKG_INCLUDE_PATH.'mailman_lib.php' ); if( $gBitSystem->getConfig( 'boards_sync_mail_server' ) ) { if( !($error = mailman_newlist( array( 'listname' => $pParamHash['boards_mailing_list'], 'listhost' => $gBitSystem->getConfig( 'boards_email_host', $gBitSystem->getConfig( 'kernel_server_name' ) ), 'admin-password'=>$pParamHash['boards_mailing_list_password'], 'listadmin-addr'=>$gBitUser->getField( 'email' ) ) )) ) { - $this->storePreference( 'boards_mailing_list', !empty( $pParamHash['boards_mailing_list'] ) ? $pParamHash['boards_mailing_list'] : NULL ); + $this->storePreference( 'boards_mailing_list', !empty( $pParamHash['boards_mailing_list'] ) ? $pParamHash['boards_mailing_list'] : null ); $this->storePreference( 'boards_mailing_list_password', $pParamHash['boards_mailing_list_password'] ); // Subscribe the owner mailman_addmember( $this->getPreference( 'boards_mailing_list'), $gBitUser->getField('email') ); @@ -164,8 +165,8 @@ class BitBoard extends LibertyMime { $this->load(); } else { $this->mDb->RollbackTrans(); - $this->mContentId = NULL; - $this->mBitBoardId = NULL; + $this->mContentId = null; + $this->mBitBoardId = null; } } return( count( $this->mErrors )== 0 ); @@ -173,17 +174,16 @@ class BitBoard extends LibertyMime { /** * Make sure the data is safe to store - * @param pParamHash be sure to pass by reference in case we need to make modifcations to the hash + * @param array pParamHash be sure to pass by reference in case we need to make modifcations to the hash * This function is responsible for data integrity and validation before any operations are performed with the $pParamHash * NOTE: This is a PRIVATE METHOD!!!! do not call outside this class, under penalty of death! * * @param array pParams reference to hash of values that will be used to store the page, they will be modified where necessary - * - * @return bool TRUE on success, FALSE if verify failed. If FALSE, $this->mErrors will have reason why + * @return bool true on success, false if verify failed. If false, $this->mErrors will have reason why * * @access private **/ - function verify( &$pParamHash ) { + public function verify( array &$pParamHash ): bool { // make sure we're all loaded up of we have a mBitBoardId if( $this->verifyId( $this->mBitBoardId ) && empty( $this->mInfo ) ) { $this->load(); @@ -272,8 +272,7 @@ class BitBoard extends LibertyMime { /** * This function removes a bitboard entry **/ - function expunge() { - $ret = FALSE; + public function expunge(): bool { if( $this->isValid() ) { $this->StartTrans(); $mailingList = $this->getPreference( 'boards_mailing_list' ); @@ -283,18 +282,17 @@ class BitBoard extends LibertyMime { $result = $this->mDb->query( $query, array( $this->mContentId ) ); if( LibertyMime::expunge() ) { if( $mailingList ) { - require_once( UTIL_PKG_INCLUDE_PATH.'mailman_lib.php' ); + require_once UTIL_PKG_INCLUDE_PATH.'mailman_lib.php'; if( $error = mailman_rmlist( $mailingList ) ) { $this->mErrors['mailing_list'] = $error; } } - $ret = TRUE; $this->CompleteTrans(); } else { $this->mDb->RollbackTrans(); } } - return $ret; + return true; } /** @@ -306,9 +304,9 @@ class BitBoard extends LibertyMime { function getAllMap() { $b = new BitBoard(); - $listHash = array(); + $listHash = []; $l = $b->getList($listHash); - $ret = array(); + $ret = []; foreach ($l as $k => $boardd) { $board = new BitBoard($boardd['board_id']); $board->mInfo=$boardd; @@ -327,7 +325,7 @@ class BitBoard extends LibertyMime { function getUnMapped() { global $gBitSystem; - $ret = NULL; + $ret = null; $sql = "SELECT lc.`title`, lc.`content_id`, @@ -359,7 +357,7 @@ class BitBoard extends LibertyMime { } function addContent($content_id) { - if (@BitBase::verifyId($content_id)) { + if (BitBase::verifyId($content_id)) { $data = array( 'board_content_id'=>$this->mContentId, 'topic_content_id'=>$content_id, @@ -369,7 +367,7 @@ class BitBoard extends LibertyMime { } function removeContent($content_id) { - if (@BitBase::verifyId($content_id) && @BitBase::verifyId($this->mContentId)) { + if (BitBase::verifyId($content_id) && BitBase::verifyId($this->mContentId)) { $sql = "DELETE FROM `".BIT_DB_PREFIX."boards_map` WHERE `board_content_id` = ? AND `topic_content_id` = ?"; $result = $this->mDb->query( $sql, array( $this->mContentId,$content_id ) ); } @@ -392,7 +390,7 @@ class BitBoard extends LibertyMime { } function fixContentMap() { - if( $this->isValid() && @BitBase::verifyId($this->mContentId)) { + if( $this->isValid() && BitBase::verifyId($this->mContentId)) { $this->removeContent($this->mContentId); $this->addContent($this->mContentId); } @@ -400,8 +398,8 @@ class BitBoard extends LibertyMime { function lookupMapRev($content_id) { global $gBitDb; - $ret = NULL; - if (@BitBase::verifyId($content_id)) { + $ret = null; + if (BitBase::verifyId($content_id)) { $sql = "SELECT `board_content_id` FROM `".BIT_DB_PREFIX."boards_map` map WHERE map.`topic_content_id`=?"; $ret = $gBitDb->getOne( $sql, array( $content_id )); } @@ -410,7 +408,7 @@ class BitBoard extends LibertyMime { function getMap() { global $gBitSystem; - $ret = NULL; + $ret = null; if( $this->isValid() ) { $sql = "SELECT lc.`title` AS t_title, @@ -440,7 +438,7 @@ class BitBoard extends LibertyMime { return $ret; } - public static function prepGetList( &$pParamHash ) { + public static function prepGetList( array &$pParamHash ): void { if( empty( $pParamHash['sort_mode'] ) ) { // default sort_mode for boards is alphabetical $pParamHash['sort_mode'] = 'title_asc'; @@ -457,7 +455,7 @@ class BitBoard extends LibertyMime { $this->prepGetList( $pParamHash ); $selectSql = $joinSql = $whereSql = ''; - $bindVars = array(); + $bindVars = []; array_push( $bindVars, $this->mContentTypeGuid ); $this->getServicesSql( 'content_list_sql_function', $selectSql, $joinSql, $whereSql, $bindVars ); @@ -510,7 +508,7 @@ class BitBoard extends LibertyMime { INNER JOIN `".BIT_DB_PREFIX."liberty_comments` s_lcom ON (map.`topic_content_id` = s_lcom.`root_id`) INNER JOIN `".BIT_DB_PREFIX."liberty_content` s_lc ON (s_lcom.`content_id` = s_lc.`content_id`) LEFT JOIN `".BIT_DB_PREFIX."boards_posts` s ON( s_lcom.`comment_id` = s.`comment_id` ) -WHERE map.`board_content_id`=lc.`content_id` AND ((s_lc.`user_id` < 0) AND (s.`is_approved` = 0 OR s.`is_approved` IS NULL) ) +WHERE map.`board_content_id`=lc.`content_id` AND ((s_lc.`user_id` < 0) AND (s.`is_approved` = 0 OR s.`is_approved` IS null) ) ) AS unreg"; } else { $selectSql .= ", 0 AS unreg"; @@ -542,7 +540,7 @@ WHERE map.`board_content_id`=lc.`content_id` AND ((s_lc.`user_id` < 0) AND (s.`i $result = $this->mDb->query( $query, $bindVars ); - $ret = array(); + $ret = []; while( $res = $result->fetchRow() ) { $res['url']= BOARDS_PKG_URL."index.php?b={$res['board_id']}"; @@ -551,23 +549,19 @@ WHERE map.`board_content_id`=lc.`content_id` AND ((s_lc.`user_id` < 0) AND (s.`i INNER JOIN `".BIT_DB_PREFIX."liberty_comments` lcom ON (map.`topic_content_id` = lcom.`root_id`) INNER JOIN `".BIT_DB_PREFIX."liberty_content` slc ON( slc.`content_id` = lcom.`content_id` ) LEFT JOIN `".BIT_DB_PREFIX."boards_posts` fp ON (fp.`comment_id` = lcom.`comment_id`) - WHERE lcom.`root_id`=lcom.`parent_id` AND map.`board_content_id`=? AND ((fp.`is_approved` = 1) OR (fp.`is_approved` IS NULL))", array( $res['content_id'] ) ); + WHERE lcom.`root_id`=lcom.`parent_id` AND map.`board_content_id`=? AND ((fp.`is_approved` = 1) OR (fp.`is_approved` IS null))", array( $res['content_id'] ) ); $res['post_count'] = $this->mDb->getOne( "SELECT count(*) FROM `".BIT_DB_PREFIX."liberty_comments` lcom INNER JOIN `".BIT_DB_PREFIX."liberty_content` slc ON( slc.`content_id` = lcom.`content_id` ) INNER JOIN `".BIT_DB_PREFIX."boards_map` map ON (lcom.`root_id`=map.`topic_content_id`) LEFT JOIN `".BIT_DB_PREFIX."boards_posts` fp ON (fp.`comment_id` = lcom.`comment_id`) - WHERE map.`board_content_id`=? AND ((fp.`is_approved` = 1) OR (fp.`is_approved` IS NULL))", array( $res['content_id'] ) ); + WHERE map.`board_content_id`=? AND ((fp.`is_approved` = 1) OR (fp.`is_approved` IS null))", array( $res['content_id'] ) ); if($track) { if ($gBitUser->isRegistered()) { $res['track']['on'] = true; $res['track']['count'] = $res['track_count']; - if ($res['post_count']>$res['track_count']) { - $res['track']['mod'] = true; - } else { - $res['track']['mod'] = false; - } + $res['track']['mod'] = ( $res['post_count'] > $res['track_count'] ) ? true : false; } else { $res['track']['on'] = false; } @@ -592,7 +586,7 @@ WHERE map.`board_content_id`=lc.`content_id` AND ((s_lc.`user_id` < 0) AND (s.`i INNER JOIN `".BIT_DB_PREFIX."liberty_comments` lcom ON (map.`topic_content_id` = lcom.`root_id`) INNER JOIN `".BIT_DB_PREFIX."liberty_content` slc ON( slc.`content_id` = lcom.`content_id` ) LEFT JOIN `".BIT_DB_PREFIX."boards_posts` fp ON (fp.`comment_id` = lcom.`comment_id`) - WHERE lcom.`root_id`=lcom.`parent_id` AND map.`board_content_id`=? AND ((fp.`is_approved` IS NULL OR fp.`is_approved` = 1) OR (slc.`user_id` >= 0)) + WHERE lcom.`root_id`=lcom.`parent_id` AND map.`board_content_id`=? AND ((fp.`is_approved` IS null OR fp.`is_approved` = 1) OR (slc.`user_id` >= 0)) ORDER BY slc.`last_modified` DESC "; $result = $this->mDb->getRow( $query, array( $data['content_id'] ) ); @@ -608,19 +602,18 @@ WHERE map.`board_content_id`=lc.`content_id` AND ((s_lc.`user_id` < 0) AND (s.`i /** * Generates the URL to the bitboard page - * @return the link to display the page. + * @return string link to display the page. */ public static function getDisplayUrlFromHash( &$pParamHash ) { global $gBitSystem; - $ret = NULL; + $ret = null; if( !empty( $pParamHash['comment'] ) && !empty( $pParamHash['comment']['thread_forward_sequence'] ) ){ - // look up base of comment sequece which is BitBoardTopic + // look up base of comment sequence which is BitBoardTopic $seq = explode( ".", $pParamHash['comment']['thread_forward_sequence'] ); $topicRootId = (int)$seq[0]; if( BitBase::verifyId( $topicRootId )) { - require_once( BOARDS_PKG_CLASS_PATH.'BitBoardTopic.php' ); - $hash = array( 'topic_id' => $topicRootId ); + $hash = [ 'topic_id' => $topicRootId ]; $ret = BitBoardTopic::getDisplayUrlFromHash( $hash ); // we're out of here with our topic url return $ret; @@ -641,12 +634,12 @@ WHERE map.`board_content_id`=lc.`content_id` AND ((s_lc.`user_id` < 0) AND (s.`i return $ret; } - function getBoardSelectList( $pBlankFirst=FALSE ) { + public function getBoardSelectList( $pBlankFirst=false ) { global $gBitSystem, $gBitUser; // invoke list sql principly to enforce permission services $selectSql = $joinSql = $whereSql = ''; - $bindVars = array(); + $bindVars = []; $this->getServicesSql( 'content_list_sql_function', $selectSql, $joinSql, $whereSql, $bindVars ); @@ -670,7 +663,7 @@ WHERE map.`board_content_id`=lc.`content_id` AND ((s_lc.`user_id` < 0) AND (s.`i WHERE lc.`content_id` = b.`content_id` $whereSql ORDER BY lc.`title` ASC"; - $ret = array(); + $ret = []; if( $rslt = $this->mDb->query( $query, $bindVars ) ){ if( $pBlankFirst ) { @@ -691,7 +684,7 @@ WHERE map.`board_content_id`=lc.`content_id` AND ((s_lc.`user_id` < 0) AND (s.`i if( LibertyContent::verifyId( $contentId ) ) { // LibertyContent::load()assumes you have joined already, and will not execute any sql! // This is a significant performance optimization - $bindVars = array(); + $bindVars = []; $selectSql = $joinSql = $whereSql = ''; array_push( $bindVars, $contentId ); $gBitUser->getServicesSql( 'content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars ); @@ -703,7 +696,7 @@ WHERE map.`board_content_id`=lc.`content_id` AND ((s_lc.`user_id` < 0) AND (s.`i WHERE lc.`content_id`=? $whereSql"; $result = $gBitDb->query( $query, $bindVars ); - $ret = array(); + $ret = []; if( $result && $result->numRows() ) { $ret = $result->fields; @@ -712,12 +705,12 @@ WHERE map.`board_content_id`=lc.`content_id` AND ((s_lc.`user_id` < 0) AND (s.`i $ret['display_url'] = BIT_ROOT_URL."index.php?content_id=$contentId"; } } - return( $ret ); + return $ret; } public static function getLinkedBoard( $pContentId ) { global $gBitDb; - $ret = NULL; + $ret = null; if( BitBase::verifyId( $pContentId ) ) { $sql = "SELECT b.`board_id`, b.`content_id` AS `board_content_id`, COUNT(lcom.`comment_id`) AS `post_count` FROM `".BIT_DB_PREFIX."boards_map` bm @@ -743,7 +736,7 @@ WHERE map.`board_content_id`=lc.`content_id` AND ((s_lc.`user_id` < 0) AND (s.`i function getBoardMailingList() { global $gBitSystem; - $ret = NULL; + $ret = null; if( $this->isValid() && $gBitSystem->getConfig( 'boards_sync_mail_server' ) && $this->getPreference( 'boards_mailing_list' ) ) { $ret = $this->getPreference( 'boards_mailing_list' ).'@'.$gBitSystem->getConfig( 'boards_email_host', $gBitSystem->getConfig( 'kernel_server_name' ) ); } @@ -770,16 +763,15 @@ function boards_content_edit ( $pContent, $pParamHash ) { } require_once( BOARDS_PKG_CLASS_PATH.'BitBoard.php' ); $board = new BitBoard(); - $boardList = $board->getBoardSelectList( TRUE ); + $boardList = $board->getBoardSelectList( true ); $gBitSmarty->assign( 'boardList', $boardList ); } } -// store services for boads +// store services for boards function boards_content_store( $pContent, $pParamHash ) { global $gBitDb, $gBitSmarty, $gBitSystem; - require_once( BOARDS_PKG_CLASS_PATH.'BitBoardTopic.php' ); // do not allow unassigning topics. the UI should prevent this, but just to make sure... if( $pContent->isValid() && !$pContent->isContentType( BITBOARDTOPIC_CONTENT_TYPE_GUID ) && !$pContent->isContentType( BITBOARD_CONTENT_TYPE_GUID ) ) { // wipe out all previous assignments for good measure. Not the sanest thing to do, but edits are infrequent - at least for now @@ -791,7 +783,6 @@ function boards_content_store( $pContent, $pParamHash ) { $p = null; if ( ! empty( $pParamHash['pigoneholes'] ) ) { foreach( $pParamHash['pigeonholes']['pigeonhole'] as $p_id ) { - require_once(PIGEONHOLES_PKG_CLASS_PATH.'Pigeonholes.php'); if (empty($p)) { $p = new Pigeonholes(); } @@ -804,7 +795,7 @@ function boards_content_store( $pContent, $pParamHash ) { // Insert into these boards foreach ($boards as $board) { - if( @BitBase::verifyId( $board['content_id'] ) ) { + if( BitBase::verifyId( $board['content_id'] ) ) { $pContent->mDb->query( "INSERT INTO `".BIT_DB_PREFIX."boards_map` (`board_content_id`,`topic_content_id`) VALUES (?,?)", array( $board['content_id'], $pContent->mContentId ) ); } } @@ -813,13 +804,13 @@ function boards_content_store( $pContent, $pParamHash ) { } else { $pContent->mDb->query( "DELETE FROM `".BIT_DB_PREFIX."boards_map` WHERE `topic_content_id`=?", array( $pContent->mContentId ) ); - if( @BitBase::verifyId( $pParamHash['linked_board_cid'] ) ) { + if( BitBase::verifyId( $pParamHash['linked_board_cid'] ?? 0 ) ) { $pContent->mDb->query( "INSERT INTO `".BIT_DB_PREFIX."boards_map` (`board_content_id`,`topic_content_id`) VALUES (?,?)", array( $pParamHash['linked_board_cid'], $pContent->mContentId ) ); } } $gBitSmarty->assign( 'boardInfo', BitBoard::getLinkedBoard( $pContent->mContentId ) ); } else { - if( @BitBase::verifyId( $pParamHash['content_id'] ) && @BitBase::verifyId( $pParamHash['linked_board_cid'] ) ) { + if( BitBase::verifyId( $pParamHash['content_id'] ?? 0 ) && BitBase::verifyId( $pParamHash['linked_board_cid'] ?? 0 ) ) { $pContent->mDb->query( "INSERT INTO `".BIT_DB_PREFIX."boards_map` (`board_content_id`,`topic_content_id`) VALUES (?,?)", array( $pParamHash['linked_board_cid'], $pParamHash['content_id'] ) ); } } @@ -845,13 +836,13 @@ function boards_comment_store( &$pObject, &$pParamHash ) { } } -function boards_content_verify( $pObject, &$pParamHash ){ +function boards_content_verify( &$pObject, &$pParamHash ){ // board posts ( e.g. liberty comments ) service global $gBitSystem, $gBitUser; // use is_a instead of isContentType( BITCOMMENT_CONTENT_TYPE_GUID ) as isContentType() checks isValid(), and this service method will not properly handle new object stores if( $gBitSystem->isPackageActive( 'boards' ) && is_a( $pObject , 'LibertyComment' ) ) { if( BitBoardTopic::isLockedMsg( $pParamHash['parent_id'] )) { - $pObject->mErrors['warning']=tra("The selected Topic is Locked posting is disabled"); + $pObject->mErrors['warning'] = KernelTools::tra("The selected Topic is Locked posting is disabled"); } } } @@ -862,5 +853,3 @@ function boards_content_expunge( $pContent ) { $pContent->mDb->query( "DELETE FROM `".BIT_DB_PREFIX."boards_map` WHERE `topic_content_id`=?", array( $pContent->mContentId ) ); } } - -?> diff --git a/includes/classes/BitBoardPost.php b/includes/classes/BitBoardPost.php old mode 100644 new mode 100755 index 63bb3f4..e77e947 --- a/includes/classes/BitBoardPost.php +++ b/includes/classes/BitBoardPost.php @@ -14,8 +14,12 @@ /** * required setup */ -require_once( LIBERTY_PKG_CLASS_PATH.'LibertyMime.php' ); -require_once( BOARDS_PKG_CLASS_PATH.'BitBoardTopic.php' ); +namespace Bitweaver\Boards; +use Bitweaver\BitBase; +use Bitweaver\KernelTools; +use Bitweaver\Liberty\LibertyComment; +use Bitweaver\Users\RoleUser; +use Messages; /** * @package boards @@ -24,7 +28,7 @@ class BitBoardPost extends LibertyComment { /** * During initialisation, be sure to call our base constructors */ - function __construct($pCommentId = NULL, $pContentId = NULL, $pInfo = NULL) { + function __construct($pCommentId = null, $pContentId = null, $pInfo = null) { parent::__construct($pCommentId,$pContentId,$pInfo); // Permission setup @@ -36,17 +40,17 @@ class BitBoardPost extends LibertyComment { /** * This function verifies the data for a post */ - function verify( &$pParamHash ) { + public function verify( array &$pParamHash ): bool { if( isset( $pParamHash['is_approved'] ) ) { if( !is_numeric( $pParamHash['is_approved'] ) || $pParamHash['is_approved'] > 1 || $pParamHash['is_approved'] < 0 ) { - $this->mErrors[]=("Invalid post approved state"); + $this->mErrors[]= "Invalid post approved state"; } else { $pParamHash['post_store']['is_approved'] = $pParamHash['is_approved']; } } if( isset( $pParamHash['is_warned'] ) ) { if( !is_numeric( $pParamHash['warned'] ) || $pParamHash['is_warned'] > 1 || $pParamHash['is_warned'] < 0 ) { - $this->mErrors[]=("Invalid warned state"); + $this->mErrors[]= "Invalid warned state"; } else { $pParamHash['post_store']['is_warned'] = $pParamHash['is_warned']; } @@ -61,15 +65,15 @@ class BitBoardPost extends LibertyComment { $pParamHash['post_store']['migrate_post_id'] = $pParamHash['migrate_post_id']; } - return( count( $this->mErrors ) == 0 && !empty( $pParamHash['post_store'] ) ); + return count( $this->mErrors ) == 0 && !empty( $pParamHash['post_store'] ); } /** * This function stores a post */ - function store( &$pParamHash ) { + public function store( array &$pParamHash ): bool { global $gBitSystem; - $ret = FALSE; + $ret = false; if( $this->mCommentId && $this->verify( $pParamHash ) ) { //$gBitSystem->verifyPermission('p_boards_update'); //$pParamHash = (($pParamHash + 1)%2); @@ -81,7 +85,7 @@ class BitBoardPost extends LibertyComment { $pParamHash['post_store']['comment_id'] = $this->mCommentId; $result = $this->mDb->associateInsert( 'boards_posts', $pParamHash['post_store'] ); } - $ret = TRUE; + $ret = true; } return $ret; } @@ -89,7 +93,7 @@ class BitBoardPost extends LibertyComment { /** * This function gets the meta data relating to a post */ - function loadMetaData() { + public function loadMetaData(): void { if ($this->isValid()) { if (!isset($this->mInfo['accepted'])) { $key = array('comment_id' => $this->mCommentId); @@ -112,30 +116,28 @@ class BitBoardPost extends LibertyComment { /** * This function removes a bitboard entry **/ - function expunge() { - $ret = FALSE; + public function expunge(): bool { if( $this->isValid() ) { $this->StartTrans(); // parent actually has deletion of rows in boards for constraint reasons if( parent::expunge() ) { $this->CompleteTrans(); - $ret = TRUE; } else { $this->mDb->RollbackTrans(); } } - return $ret; + return true; } /** * This function gets all the post relating to a topic */ - function getComments( $pContentId = NULL, $pMaxComments = NULL, $pOffset = NULL, $pSortOrder = NULL, $pDisplayMode = NULL ) { + public function getComments( $pContentId = null, $pMaxComments = null, $pOffset = null, $pSortOrder = null, $pDisplayMode = null ) { global $gBitUser, $gBitSystem; $joinSql = $selectSql = $whereSql = ''; - $ret = array(); + $ret = []; $contentId = $this->mCommentId; $mid = 'thread_forward_sequence ASC'; @@ -155,7 +157,7 @@ class BitBoardPost extends LibertyComment { } $mid = 'order by ' . $mid; - $bindVars = array(); + $bindVars = []; if (is_array( $contentId ) ) { $mid2 = 'in ('.implode(',', array_fill(0, count( $pContentId ), '?')).')'; $bindVars = $contentId; @@ -171,7 +173,7 @@ class BitBoardPost extends LibertyComment { $whereSql .= " AND ((post.`is_approved` = 1) OR (lc.`user_id` >= 0))"; } - $pListHash = array( 'content_id' => $contentId, 'max_records' => $pMaxComments, 'offset'=>$pOffset, 'sort_mode'=> $pSortOrder, 'display_mode' => $pDisplayMode, 'has_comment_view_perm' => TRUE ); + $pListHash = array( 'content_id' => $contentId, 'max_records' => $pMaxComments, 'offset'=>$pOffset, 'sort_mode'=> $pSortOrder, 'display_mode' => $pDisplayMode, 'has_comment_view_perm' => true ); $this->getServicesSql( 'content_list_sql_function', $selectSql, $joinSql, $whereSql, $bindVars, $this, $pListHash ); if ($pContentId) { @@ -192,26 +194,22 @@ class BitBoardPost extends LibertyComment { LEFT JOIN `".BIT_DB_PREFIX."boards_posts` post ON (post.`comment_id` = lcom.`comment_id`) WHERE $mid2 $whereSql $mid"; - $flat_comments = array(); + $flat_comments = []; if( $result = $this->mDb->query( $sql, $bindVars, $pMaxComments, $pOffset ) ) { while( $row = $result->FetchRow() ) { if (empty($row['anon_name'])) { $row['anon_name'] = "Anonymous"; } - if( $row['avatar_file_name'] ) { - $row['user_avatar_url'] = liberty_fetch_thumbnail_url( array( - 'source_file' => liberty_mime_get_source_file( array( 'user_id'=>$row['avatar_user_id'], 'file_name'=>$row['avatar_file_name'], 'mime_type'=>$row['avatar_mime_type'], 'attachment_id'=>$row['avatar_attachment_id'] ) ), - 'size' => 'avatar' - )); - } else { - $row['user_avatar_url'] = FALSE; - } + $row['user_avatar_url'] = ( $row['avatar_file_name'] ) ? \Bitweaver\Liberty\liberty_fetch_thumbnail_url( array( + 'source_file' => \Bitweaver\Liberty\liberty_mime_get_source_file( array( 'user_id' => $row['avatar_user_id'], 'file_name' => $row['avatar_file_name'], 'mime_type' => $row['avatar_mime_type'], 'attachment_id' => $row['avatar_attachment_id'] ) ), + 'size' => 'avatar', + ) ) : false; if (!empty($row['warned_message'])) { $row['warned_message'] = str_replace("\n","
\n",$row['warned_message']); } $row['data'] = trim( $row['data'] ); - $row['user_url'] = BitUser::getDisplayUrlFromHash( $row ); + $row['user_url'] = RoleUser::getDisplayUrlFromHash( $row ); $row['parsed_data'] = self::parseDataHash( $row ); $row['level'] = substr_count ( $row['thread_forward_sequence'], '.' ) - 1; $c = new LibertyComment(); @@ -227,7 +225,7 @@ class BitBoardPost extends LibertyComment { if( $func = $gLibertySystem->getPluginFunction( $row2['attachment_plugin_guid'], 'load_function', 'mime' )) { // we will pass the preferences by reference that the plugin can easily update them if( empty( $row['storage'][$row2['attachment_id']] )) { - $row['storage'][$row2['attachment_id']] = array(); + $row['storage'][$row2['attachment_id']] = []; } $row['storage'][$row2['attachment_id']] = $func( $row2, $row['storage'][$row2['attachment_id']] ); } else { @@ -253,19 +251,19 @@ class BitBoardPost extends LibertyComment { /** * This function gets a list of posts */ - function getList( &$pListHash ) { + public function getList( &$pListHash ) { global $gBitUser, $gBitSystem; $this->prepGetList( $pListHash ); $joinSql = $selectSql = $whereSql = ''; - $ret = array(); + $ret = []; $contentId = $this->mCommentId; // $mid = 'ORDER BY `thread_forward_sequence` ASC'; - $bindVars = array(); + $bindVars = []; if( !empty( $pListHash['content_id'] ) ) { if (is_array( $contentId ) ) { $mid2 = 'in ('.implode(',', array_fill(0, count( $pListHash['content_id'] ), '?')).')'; @@ -289,7 +287,7 @@ class BitBoardPost extends LibertyComment { array_push( $bindVars, (int)$pListHash['board_id'] ); } - if( BitBase::verifyId( $pListHash['user_id'] ) ) { + if( BitBase::verifyId( $pListHash['user_id'] ?? 0 ) ) { $whereSql .= ' AND lc.`user_id`=? '; array_push( $bindVars, $pListHash['user_id'] ); } @@ -311,25 +309,21 @@ class BitBoardPost extends LibertyComment { LEFT JOIN `".BIT_DB_PREFIX."boards_posts` post ON (post.`comment_id` = lcom.`comment_id`) $whereSql ORDER BY ".$this->mDb->convertSortmode( $pListHash['sort_mode'] ); - $ret = array(); + $ret = []; if( $result = $this->mDb->query( $sql, $bindVars, $pListHash['max_records'], $pListHash['offset'] ) ) { while( $row = $result->FetchRow() ) { if (empty($row['anon_name'])) $row['anon_name'] = "Anonymous"; - if( !empty( $row['avatar_file_name'] )) { - $row['user_avatar_url'] = liberty_fetch_thumbnail_url( array( - 'source_file' => liberty_mime_get_source_file( array( 'user_id'=>$row['avatar_user_id'], 'file_name'=>$row['avatar_file_name'], 'mime_type'=>$row['avatar_mime_type'], 'attachment_id'=>$row['avatar_attachment_id'] ) ), - 'size' => 'avatar' - )); - } else { - $row['user_avatar_url'] = FALSE; - } + $row['user_avatar_url'] = ( !empty( $row['avatar_file_name'] ) ) ? \Bitweaver\Liberty\liberty_fetch_thumbnail_url( array( + 'source_file' => \Bitweaver\Liberty\liberty_mime_get_source_file( array( 'user_id' => $row['avatar_user_id'], 'file_name' => $row['avatar_file_name'], 'mime_type' => $row['avatar_mime_type'], 'attachment_id' => $row['avatar_attachment_id'] ) ), + 'size' => 'avatar', + ) ) : false; unset($row['avatar_file_name']); if (!empty($row['warned_message'])) { $row['warned_message'] = str_replace("\n","
\n",$row['warned_message']); } $row['data'] = trim($row['data']); - $row['user_url']=BitUser::getDisplayUrlFromHash($row); + $row['user_url']=RoleUser::getDisplayUrlFromHash($row); $row['parsed_data'] = self::parseDataHash( $row ); $row['level'] = substr_count ( $row['thread_forward_sequence'], '.' ) - 1; $row['topic_id'] = boards_get_topic_comment( $row['thread_forward_sequence'] ); @@ -348,15 +342,15 @@ class BitBoardPost extends LibertyComment { /** * This function counts the posts relating to a topic */ - function getNumComments($pContentId = NULL) { + public function getNumComments($pContentId = null) { $ret = 0; $contentId = $this->mCommentId; - $bindVars = array(); + $bindVars = []; $joinSql = $selectSql = $whereSql = ''; - $paramHash = array( 'include_comments' => TRUE ); + $paramHash = array( 'include_comments' => true ); $this->getServicesSql( 'content_list_sql_function', $selectSql, $joinSql, $whereSql, $bindVars, $this, $paramHash ); if ($pContentId) { @@ -375,8 +369,8 @@ class BitBoardPost extends LibertyComment { /** * This function generates a valid lookup URL */ - function getDisplayUrl() { - $ret = NULL; + public function getDisplayUrl() { + $ret = null; if( $this->isValid() ) { $urlHash['comment_id'] = $this->mCommentId; $urlHash['topic_id'] = $this->getTopicId(); @@ -387,12 +381,12 @@ class BitBoardPost extends LibertyComment { /** * Generates the URL to the bitboard page - * @return the link to display the page. + * @return string link to display the page. */ public static function getDisplayUrlFromHash( &$pParamHash ) { global $gBitSystem; - $ret = NULL; + $ret = null; if( static::verifyId( $pParamHash['comment_id'] ) ) { if( $gBitSystem->isFeatureActive( 'pretty_urls' ) || $gBitSystem->isFeatureActive( 'pretty_urls_extended' ) ) { $rewrite_tag = $gBitSystem->isFeatureActive( 'pretty_urls_extended' ) ? 'view/' : ''; @@ -408,20 +402,31 @@ class BitBoardPost extends LibertyComment { return $ret; } - function getTopicId() { + /** + * Summary of getContactUrl + * @return string + */ + public function getContactUrl(): string { + return ''; + } + /** + * Summary of getTopicId + * @return int + */ + public function getTopicId() { return boards_get_topic_comment( $this->getField( 'thread_forward_sequence') ); } - function modApprove() { + public function modApprove() { $data['is_approved'] = 1; $this->setMetaData($data); } - function modReject() { + public function modReject() { $this->deleteComment(); } - function modWarn($message) { + public function modWarn($message) { global $gBitSystem, $gBitUser; if (empty($message)) { @@ -432,27 +437,25 @@ class BitBoardPost extends LibertyComment { $this->setMetaData($data); if ($gBitSystem->isPackageActive('messages')) { - require_once(MESSAGES_PKG_CLASS_PATH.'Messages.php'); - - $u = new BitUser($this->mInfo['user_id']); + $u = new RoleUser($this->mInfo['user_id']); $u->load(); $userInfo = $u->mInfo; $pm = new Messages(); $message = "Your post \"".$this->mInfo['title']."\" [http://".$_SERVER['HTTP_HOST'].$this->getContactUrl()."] has been warned with the following message:\n$message\n"; - $msgHash = array( + $msgHash = [ 'to_login' => $userInfo['login'], 'to' => $userInfo['real_name'], - 'subject' => tra( 'Warned Post' ).': '.$this->mInfo['title'], + 'subject' => KernelTools::tra( 'Warned Post' ) . ': ' . $this->mInfo['title'], 'priority' => 4, - ); + ]; $pm->postMessage( $msgHash ); } } - function setMetaData($data) { + public function setMetaData($data) { if ($this->isValid()) { - $key = array('comment_id' => $this->mCommentId); + $key = [ 'comment_id' => $this->mCommentId ]; $query_sel = "SELECT COUNT(*) FROM `".BIT_DB_PREFIX."boards_posts` WHERE comment_id=?"; $c = $this->mDb->getOne( $query_sel , array_values($key)); if ($c == 0) { @@ -465,4 +468,3 @@ class BitBoardPost extends LibertyComment { } } } -?> diff --git a/includes/classes/BitBoardTopic.php b/includes/classes/BitBoardTopic.php old mode 100644 new mode 100755 index 1f12a89..68e52bd --- a/includes/classes/BitBoardTopic.php +++ b/includes/classes/BitBoardTopic.php @@ -14,8 +14,13 @@ /** * required setup */ -require_once( LIBERTY_PKG_CLASS_PATH.'LibertyComment.php' ); -require_once( BOARDS_PKG_CLASS_PATH.'BitBoardPost.php' ); +namespace Bitweaver\Boards; +use Bitweaver\BitBase; +use Bitweaver\KernelTools; +use Bitweaver\Liberty\LibertyBase; +use Bitweaver\Liberty\LibertyComment; +use Bitweaver\Liberty\LibertyMime; +use function sprintf; /** * This is used to uniquely identify the object @@ -32,6 +37,7 @@ class BitBoardTopic extends LibertyMime { * @public */ public $mRootId; + public $mRootObj; /** * the content id of the topic comment object @@ -42,7 +48,7 @@ class BitBoardTopic extends LibertyMime { /** * During initialisation, be sure to call our base constructors **/ - function __construct( $pRootId=NULL ) { + function __construct( $pRootId=null ) { parent::__construct(); $this->mRootId = (int)$pRootId; @@ -51,22 +57,22 @@ class BitBoardTopic extends LibertyMime { $this->mUpdateContentPerm = 'p_boards_update'; $this->mAdminContentPerm = 'p_boards_admin'; - $this->mRootObj = NULL; //a reference to the root obj + $this->mRootObj = null; //a reference to the root obj } /** * Load the data from the database - * @param pParamHash be sure to pass by reference in case we need to make modifcations to the hash + * @param array pParamHash be sure to pass by reference in case we need to make modifcations to the hash **/ - function load( $pContentId = NULL, $pPluginParams = NULL ) { + function load( $pContentId = null, $pPluginParams = null ) { global $gBitUser, $gBitSystem; if( $this->verifyId( $this->mRootId ) || $this->verifyId( $this->mContentId ) ) { // This is a significant performance optimization $lookupColumn = $this->verifyId( $this->mRootId ) ? 'lcom.`comment_id`' : 'lc.`content_id`'; - $bindVars = array(); + $bindVars = []; $selectSql = $joinSql = $whereSql = ''; - array_push( $bindVars, $lookupId = @BitBase::verifyId( $this->mRootId ) ? $this->mRootId : $this->mContentId ); - $paramHash = array( array( 'include_comments' => TRUE ) ); + array_push( $bindVars, $lookupId = BitBase::verifyId( $this->mRootId ) ? $this->mRootId : $this->mContentId ); + $paramHash = array( array( 'include_comments' => true ) ); $this->getServicesSql( 'content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars, $this, $paramHash ); if (!($gBitUser->hasPermission('p_boards_update') || $gBitUser->hasPermission('p_boards_posts_update'))) { @@ -140,7 +146,7 @@ class BitBoardTopic extends LibertyMime { public static function lookupByMigratePost( $pMigratePostId ) { global $gBitDb; - $ret = NULL; + $ret = null; if( BitBase::verifyId( $pMigratePostId ) ) { $path = $gBitDb->getOne( "SELECT lcom.`thread_forward_sequence` FROM `".BIT_DB_PREFIX."boards_posts` bp INNER JOIN `".BIT_DB_PREFIX."liberty_comments` lcom ON(bp.`comment_id`=lcom.`comment_id`) WHERE bp.`migrate_post_id`=?", array( $pMigratePostId ) ); if( $path ) { @@ -152,14 +158,14 @@ class BitBoardTopic extends LibertyMime { public static function lookupByMigrateTopic( $pMigrateTopicId ) { global $gBitDb; - $ret = NULL; + $ret = null; if( BitBase::verifyId( $pMigrateTopicId ) ) { $ret = $gBitDb->getOne( "SELECT lcom.`comment_id` FROM `".BIT_DB_PREFIX."boards_topics` bt INNER JOIN `".BIT_DB_PREFIX."liberty_comments` lcom ON(bt.`parent_id`=lcom.`content_id`) WHERE `migrate_topic_id`=?", array( $pMigrateTopicId ) ); } return $ret; } - function verify( &$pParamHash ) { + public function verify( array &$pParamHash ): bool { if( isset( $pParamHash['is_locked'] ) ) { if( !is_numeric( $pParamHash['is_locked'] ) || $pParamHash['is_locked'] > 1 || $pParamHash['is_locked'] < 0 ) { $this->mErrors[]=("Invalid topic state"); @@ -191,9 +197,9 @@ class BitBoardTopic extends LibertyMime { /** * This function stickies a topic */ - function store( &$pParamHash ) { + public function store( array &$pParamHash ): bool { global $gBitSystem; - $ret = FALSE; + $ret = false; if( $this->mCommentContentId && $this->verify( $pParamHash ) ) { //$pParamHash = (($pParamHash + 1)%2); $query_sel = "SELECT * FROM `".BIT_DB_PREFIX."boards_topics` WHERE `parent_id` = ?"; @@ -204,7 +210,7 @@ class BitBoardTopic extends LibertyMime { $pParamHash['topic_store']['parent_id'] = $this->mCommentContentId; $result = $this->mDb->associateInsert( 'boards_topics', $pParamHash['topic_store'] ); } - $ret = TRUE; + $ret = true; } return $ret; } @@ -214,7 +220,7 @@ class BitBoardTopic extends LibertyMime { */ function lock($state) { global $gBitSystem; - $ret = FALSE; + $ret = false; if ($state==null || !is_numeric($state) || $state > 1 || $state<0) { $this->mErrors[]=("Invalid current state"); } else { @@ -238,7 +244,7 @@ class BitBoardTopic extends LibertyMime { */ function sticky($state) { global $gBitSystem; - $ret = FALSE; + $ret = false; if ($state==null || !is_numeric($state) || $state > 1 || $state<0) { $this->mErrors[]=("Invalid current state"); } else { @@ -252,7 +258,7 @@ class BitBoardTopic extends LibertyMime { $query_up = "UPDATE `".BIT_DB_PREFIX."boards_topics` SET `is_sticky` = ? WHERE `parent_id` = ?"; $result = $this->mDb->query( $query_up, array( $state, $this->mCommentContentId) ); } - $ret = TRUE; + $ret = true; } return $ret; } @@ -276,7 +282,7 @@ class BitBoardTopic extends LibertyMime { $lcom->storeComment($lcom_hash); // map the move to the topic table - $data = array(); + $data = []; $data['parent_id']=$lcom->mContentId; $data['is_moved']=$this->mRootId; $this->mDb->associateInsert( BIT_DB_PREFIX."boards_topics", $data ); @@ -293,7 +299,7 @@ class BitBoardTopic extends LibertyMime { // end transaction $this->CompleteTrans(); - return TRUE; + return true; } /** @@ -306,9 +312,9 @@ class BitBoardTopic extends LibertyMime { LibertyMime::prepGetList( $pParamHash ); $selectSql = $joinSql = $whereSql = ''; - $bindVars = array(); + $bindVars = []; $pParamHash['include_comments'] = 'y'; - $this->getServicesSql( 'content_list_sql_function', $selectSql, $joinSql, $whereSql, $bindVars, NULL, $pParamHash ); + $this->getServicesSql( 'content_list_sql_function', $selectSql, $joinSql, $whereSql, $bindVars, null, $pParamHash ); // this will set $find, $sort_mode, $max_records and $offset extract( $pParamHash ); @@ -327,8 +333,8 @@ class BitBoardTopic extends LibertyMime { // if we have the board's board_id (b) we use that, or if we have its content_id we can use that if( (!empty( $pParamHash['b'] ) && $this->verifyId( $pParamHash['b'] )) || (!empty( $pParamHash['content_id'] ) && $this->verifyId( $pParamHash['content_id'] )) ) { - $joinSql .= " INNER JOIN `${BIT_DB_PREFIX}boards_map` map ON (map.`topic_content_id` = lcom.`root_id`)"; - $joinSql .= " INNER JOIN `${BIT_DB_PREFIX}boards` b ON (b.`content_id` = map.`board_content_id`)"; + $joinSql .= " INNER JOIN `{$BIT_DB_PREFIX}boards_map` map ON (map.`topic_content_id` = lcom.`root_id`)"; + $joinSql .= " INNER JOIN `{$BIT_DB_PREFIX}boards` b ON (b.`content_id` = map.`board_content_id`)"; if(!empty($pParamHash['b'])) { $whereSql .= " AND b.`board_id` = ?"; $bindVars[] = (int)$pParamHash['b']; @@ -343,21 +349,19 @@ class BitBoardTopic extends LibertyMime { // use adodb's substr property $substr = $this->mDb->substr(); - if ( $this->mDb->mType == 'firebird' ) { - $substrSql = "SUBSTRING(s_lcom.`thread_forward_sequence` FROM 1 FOR 10) LIKE SUBSTRING(lcom.`thread_forward_sequence` FROM 1 FOR 10)"; - } else { - $substrSql = "$substr(s_lcom.`thread_forward_sequence`, 1, 10) LIKE $substr(lcom.`thread_forward_sequence`, 1, 10)"; - } + $substrSql = $this->mDb->mType == 'firebird' || $this->mDb->mType == 'pdo' + ? "SUBSTRING(s_lcom.`thread_forward_sequence` FROM 1 FOR 10) LIKE SUBSTRING(lcom.`thread_forward_sequence` FROM 1 FOR 10)" + : "$substr(s_lcom.`thread_forward_sequence`, 1, 10) LIKE $substr(lcom.`thread_forward_sequence`, 1, 10)"; if ($gBitSystem->isFeatureActive('boards_posts_anon_moderation') && !($gBitUser->hasPermission('p_boards_update') || $gBitUser->hasPermission('p_boards_post_update'))) { $whereSql .= " AND ((post.`is_approved` = 1) OR (lc.`user_id` >= 0))"; } if ($gBitSystem->isFeatureActive('boards_posts_anon_moderation') && ($gBitUser->hasPermission('p_boards_update') || $gBitUser->hasPermission('p_boards_post_update'))) { $selectSql .= ", ( SELECT COUNT(*) - FROM `${BIT_DB_PREFIX}liberty_comments` AS s_lcom + FROM `{$BIT_DB_PREFIX}liberty_comments` AS s_lcom INNER JOIN `".BIT_DB_PREFIX."liberty_content` s_lc ON (s_lcom.`content_id` = s_lc.`content_id`) - LEFT JOIN `${BIT_DB_PREFIX}boards_posts` s ON( s_lcom.`comment_id` = s.`comment_id` ) - WHERE (".$substrSql.") AND ((s_lc.`user_id` < 0) AND (s.`is_approved` = 0 OR s.`is_approved` IS NULL))) AS unreg"; + LEFT JOIN `{$BIT_DB_PREFIX}boards_posts` s ON( s_lcom.`comment_id` = s.`comment_id` ) + WHERE (".$substrSql.") AND ((s_lc.`user_id` < 0) AND (s.`is_approved` = 0 OR s.`is_approved` IS null))) AS unreg"; } else { $selectSql .= ", 0 AS unreg"; } @@ -401,10 +405,10 @@ class BitBoardTopic extends LibertyMime { ) AS last_post $selectSql - FROM `${BIT_DB_PREFIX}liberty_comments` lcom - INNER JOIN `${BIT_DB_PREFIX}liberty_content` lc ON( lc.`content_id` = lcom.`content_id` ) - LEFT JOIN `${BIT_DB_PREFIX}boards_topics` th ON (th.`parent_id`=lcom.`content_id`) - LEFT JOIN `${BIT_DB_PREFIX}boards_posts` post ON (post.`comment_id` = lcom.`comment_id`) + FROM `{$BIT_DB_PREFIX}liberty_comments` lcom + INNER JOIN `{$BIT_DB_PREFIX}liberty_content` lc ON( lc.`content_id` = lcom.`content_id` ) + LEFT JOIN `{$BIT_DB_PREFIX}boards_topics` th ON (th.`parent_id`=lcom.`content_id`) + LEFT JOIN `{$BIT_DB_PREFIX}boards_posts` post ON (post.`comment_id` = lcom.`comment_id`) $joinSql WHERE lcom.`root_id`=lcom.`parent_id` @@ -417,24 +421,20 @@ class BitBoardTopic extends LibertyMime { "; $query_cant = "SELECT count(*) - FROM `${BIT_DB_PREFIX}liberty_comments` lcom - INNER JOIN `${BIT_DB_PREFIX}liberty_content` lc ON( lc.`content_id` = lcom.`content_id` ) - LEFT JOIN `${BIT_DB_PREFIX}boards_topics` th ON (th.`parent_id`=lcom.`content_id`) - LEFT JOIN `${BIT_DB_PREFIX}boards_posts` post ON (post.`comment_id` = lcom.`comment_id`) + FROM `{$BIT_DB_PREFIX}liberty_comments` lcom + INNER JOIN `{$BIT_DB_PREFIX}liberty_content` lc ON( lc.`content_id` = lcom.`content_id` ) + LEFT JOIN `{$BIT_DB_PREFIX}boards_topics` th ON (th.`parent_id`=lcom.`content_id`) + LEFT JOIN `{$BIT_DB_PREFIX}boards_posts` post ON (post.`comment_id` = lcom.`comment_id`) $joinSql WHERE lcom.`root_id`=lcom.`parent_id` $whereSql"; $result = $this->mDb->query( $query, $bindVars, $max_records, $offset ); - $ret = array(); + $ret = []; while( $res = $result->fetchRow() ) { if (empty($res['anon_name'])) $res['anon_name'] = "Anonymous"; - if ($res['th_is_moved']>0) { - $res['url']=BOARDS_PKG_URL."index.php?t=".$res['th_is_moved']; - } else { - $res['url']=BOARDS_PKG_URL."index.php?t=".$res['th_thread_id']; - } + $res['url'] = ( $res['th_is_moved'] > 0 ) ? BOARDS_PKG_URL . "index.php?t=" . $res['th_is_moved'] : BOARDS_PKG_URL . "index.php?t=" . $res['th_thread_id']; $llc_data = BitBoardTopic::getLastPost($res); $res = array_merge($res,$llc_data); BitBoardTopic::track($res); @@ -452,11 +452,10 @@ class BitBoardTopic extends LibertyMime { function getLastPost($data) { global $gBitSystem; - if ( $this->mDb->mType == 'firebird' ) { - $substrSql = "SUBSTRING(lcom.`thread_forward_sequence` FROM 1 FOR 10)"; - } else { - $substrSql = "".$this->mDb->substr()."(lcom.`thread_forward_sequence`, 1, 10)"; - } + $substrSql = $this->mDb->mType == 'firebird' || $this->mDb->mType == 'pdo' + ? "SUBSTRING(lcom.`thread_forward_sequence` FROM 1 FOR 10)" + : "".$this->mDb->substr()."(lcom.`thread_forward_sequence`, 1, 10)"; + $whereSql = ''; if ($gBitSystem->isFeatureActive('boards_posts_anon_moderation')) { $whereSql = " AND ((post.`is_approved` = 1) OR (lc.`user_id` >= 0))"; @@ -465,7 +464,7 @@ class BitBoardTopic extends LibertyMime { $query="SELECT lc.`last_modified` AS llc_last_modified, lc.`user_id` AS llc_user_id, lc.`content_id` AS llc_content_id, lcom.`anon_name` AS l_anon_name FROM `".BIT_DB_PREFIX."liberty_comments` lcom INNER JOIN `".BIT_DB_PREFIX."liberty_content` lc ON (lcom.`content_id` = lc.`content_id`) - LEFT JOIN `${BIT_DB_PREFIX}boards_posts` post ON (post.`comment_id` = lcom.`comment_id`) + LEFT JOIN `{$BIT_DB_PREFIX}boards_posts` post ON (post.`comment_id` = lcom.`comment_id`) WHERE (".$substrSql.") LIKE '".sprintf("%09d.",$data['th_thread_id'])."%' $whereSql ORDER BY lc.`last_modified` DESC "; @@ -476,11 +475,11 @@ class BitBoardTopic extends LibertyMime { /** * Generates the URL to the bitboard page - * @return the link to display the page. + * @return string the link to display the page. */ public static function getDisplayUrlFromHash( &$pParamHash ) { global $gBitSystem; - $ret = NULL; + $ret = null; if( !empty( $pParamHash['topic_id'] ) && static::verifyId( $pParamHash['topic_id'] ) ) { $topicId = $pParamHash['topic_id']; @@ -499,7 +498,7 @@ class BitBoardTopic extends LibertyMime { return $ret; } - public static function isLocked( $pThreadId ) { + public static function isThreadLocked( $pThreadId ) { global $gBitSystem; /* // remove mixed static / dynamic function invocation @@ -514,10 +513,10 @@ class BitBoardTopic extends LibertyMime { } public static function isLockedMsg( $parent_id ) { - // $parentComment = new LibertyComment(NULL,$parent_id); + // $parentComment = new LibertyComment(null,$parent_id); // $topicId = $parentComment->mInfo['thread_forward_sequence']; if (!empty($parent_id)) { - return BitBoardTopic::isLocked($parent_id); + return BitBoardTopic::isThreadLocked($parent_id); } return false; } @@ -530,42 +529,48 @@ class BitBoardTopic extends LibertyMime { if (!$pThreadId) { $pThreadId = $this->mRootId; } - if (is_numeric($pThreadId)) { - $topicId = sprintf("%09d.",$pThreadId); - } */ - return $gBitSystem->mDb->getOne("SELECT SUM(`notify`) FROM `".BIT_DB_PREFIX."boards_tracking` WHERE topic_id=?", array( (int)$topicId ) ); + $topicId = ( is_numeric( $pThreadId ) ) ? sprintf( "%09d.", $pThreadId ) : 0; + + return $gBitSystem->mDb->getOne("SELECT SUM(`notify`) FROM `".BIT_DB_PREFIX."boards_tracking` WHERE topic_id=?", [ (int) $topicId ] ); } return false; } - function getNotificationData($pThreadId) { - global $gBitSystem, $gBitUser; + public function getNotification($pThreadId) { + global $gBitSystem; if ($gBitSystem->isPackageActive('boards') && $gBitSystem->isFeatureActive('boards_thread_track')) { if (!$pThreadId) { $pThreadId = $this->mRootId; } + BitBoardTopic::getNotificationData($pThreadId); + } + } + public static function getNotificationData($pThreadId) { + global $gBitSystem, $gBitUser; + if ($gBitSystem->isPackageActive('boards') && $gBitSystem->isFeatureActive('boards_thread_track')) { if (is_numeric($pThreadId)) { - $topicId = sprintf("%09d.",$pThreadId); + $topicId = \sprintf("%09d.",$pThreadId); } + $query = "SELECT uu.user_id, uu.email, uu.login, uu.real_name, trk.`track_date`, trk.`notify` AS track_notify, trk.`notify_date` AS track_notify_date FROM `".BIT_DB_PREFIX."boards_tracking` trk LEFT JOIN `".BIT_DB_PREFIX."users_users` uu ON( uu.`user_id` = trk.`user_id` ) WHERE topic_id=?"; - $result = $gBitSystem->mDb->query( $query, array( $topicId ) ); - $ret = array(); - $ret['users']=array(); + $result = $gBitSystem->mDb->query( $query, [ $topicId ] ); + $ret = []; + $ret['users']=[]; while( $res = $result->fetchRow() ) { - $res['user'] =( isset( $res['real_name'] )? $res['real_name'] : $res['login'] ); + $res['user'] =( $res['real_name'] ?? $res['login'] ); $ret['users'][$res['login']] = $res; } - $ret['topic'] = new BitBoardTopic(intval($topicId)); + $ret['topic'] = new BitBoardTopic(\intval($topicId)); $ret['topic']->load(); return $ret; } - return array(); + return []; } function sendNotification($user) { @@ -610,20 +615,20 @@ class BitBoardTopic extends LibertyMime { $flip['is_locked']['req']=2; $flip['is_locked']['id']=$arr['th_thread_id']; $flip['is_locked']['idname']='t'; - $flip['is_locked']['up']='fa-lock'; - $flip['is_locked']['upname']=tra('Thread Locked'); - $flip['is_locked']['down']='fa-unlock'; - $flip['is_locked']['downname']=tra('Thread Unlocked'); + $flip['is_locked']['up']='icon-lock'; + $flip['is_locked']['upname']= KernelTools::tra('Thread Locked'); + $flip['is_locked']['down']='icon-unlock'; + $flip['is_locked']['downname']= KernelTools::tra('Thread Unlocked'); $flip['is_locked']['perm']='p_boards_update'; $flip['is_sticky']['state']=$arr['th_is_sticky']; $flip['is_sticky']['req'] = 3; $flip['is_sticky']['id']=$arr['th_thread_id']; $flip['is_sticky']['idname']='t'; - $flip['is_sticky']['up']='fa-circle-exclamation'; - $flip['is_sticky']['upname']=tra('Sticky Thread'); - $flip['is_sticky']['down']='fa-list-ul'; - $flip['is_sticky']['downname']=tra('Non Sticky Thread'); + $flip['is_sticky']['up']='icon-exclamation-sign'; + $flip['is_sticky']['upname']= KernelTools::tra('Sticky Thread'); + $flip['is_sticky']['down']='icon-list'; + $flip['is_sticky']['downname']= KernelTools::tra('Non Sticky Thread'); $flip['is_sticky']['perm']='p_boards_update'; if ($gBitSystem->isFeatureActive('boards_thread_notification') && $gBitUser->isRegistered()) { @@ -631,10 +636,10 @@ class BitBoardTopic extends LibertyMime { $flip['notify']['req']=5; $flip['notify']['id']=$arr['th_thread_id']; $flip['notify']['idname']='t'; - $flip['notify']['up']='fa-bell'; - $flip['notify']['upname']=tra('Reply Notification'); + $flip['notify']['up']='icon-bell-alt'; + $flip['notify']['upname']= KernelTools::tra('Reply Notification'); $flip['notify']['down']='icon-bell'; - $flip['notify']['downname']=tra('Reply Notification Disabled'); + $flip['notify']['downname']= KernelTools::tra('Reply Notification Disabled'); $flip['notify']['perm']='p_boards_read'; } if ($gBitSystem->isFeatureActive('boards_thread_track') && $gBitUser->isRegistered()) { @@ -642,10 +647,10 @@ class BitBoardTopic extends LibertyMime { $flip['new']['req']=4; $flip['new']['id']=$arr['th_thread_id']; $flip['new']['idname']='t'; - $flip['new']['up']='fa-asterisk'; - $flip['new']['upname']=tra('New Posts'); -// $flip['new']['down']='fa-comment'; -// $flip['new']['downname']=tra('No new posts'); + $flip['new']['up']='icon-asterisk'; + $flip['new']['upname']= KernelTools::tra('New Posts'); +// $flip['new']['down']='icon-comment-alt'; +// $flip['new']['downname']= KernelTools::tra('No new posts'); $flip['new']['perm']='p_boards_read'; } @@ -682,7 +687,7 @@ class BitBoardTopic extends LibertyMime { global $gBitUser, $gBitSystem; if ($gBitSystem->isFeatureActive('boards_thread_track') && $gBitUser->isRegistered()) { $topicId = sprintf("%09d.",$this->mRootId); - $ret = FALSE; + $ret = false; if ($pState==null || !is_numeric($pState) || $pState > 1 || $pState<0) { $this->mErrors[]=("Invalid current state"); } else { @@ -702,7 +707,7 @@ class BitBoardTopic extends LibertyMime { global $gBitUser, $gBitSystem; if ($gBitSystem->isFeatureActive('boards_thread_track') && $gBitUser->isRegistered()) { $topicId = sprintf("%09d.",$this->mRootId); - $ret = FALSE; + $ret = false; if ($pState==null || !is_numeric($pState) || $pState > 1 || $pState<0) { $this->mErrors[]=("Invalid current state"); } else { @@ -733,7 +738,7 @@ class BitBoardTopic extends LibertyMime { global $gBitUser, $gBitSystem; if($gBitUser->isRegistered() && ($gBitSystem->isFeatureActive('boards_thread_track') || $gBitSystem->isFeatureActive('boards_thread_notify'))) { $selectSql .= ", trk.`track_date`, trk.`notify` AS track_notify, trk.`notify_date` AS track_notify_date "; - $joinSql .= " LEFT JOIN `".BIT_DB_PREFIX."boards_tracking` trk ON (trk.`topic_id`=lcom.`thread_forward_sequence` AND ( trk.`user_id` = ".$gBitUser->mUserId." OR trk.`user_id` IS NULL ) ) "; + $joinSql .= " LEFT JOIN `".BIT_DB_PREFIX."boards_tracking` trk ON (trk.`topic_id`=lcom.`thread_forward_sequence` AND ( trk.`user_id` = ".$gBitUser->mUserId." OR trk.`user_id` IS null ) ) "; } } @@ -745,11 +750,7 @@ class BitBoardTopic extends LibertyMime { if (empty($res['llc_last_modified'])) { $res['llc_last_modified']=0; } - if ($res['llc_last_modified']>$res['track_date']) { - $res['track']['mod'] = true; - } else { - $res['track']['mod'] = false; - } + $res['track']['mod'] = ( $res['llc_last_modified'] > $res['track_date'] ) ? true : false; } else { $res['track']['on'] = false; } @@ -775,4 +776,3 @@ class BitBoardTopic extends LibertyMime { return $this->mRootObj; } } -?> diff --git a/includes/edit_topic_inc.php b/includes/edit_topic_inc.php old mode 100644 new mode 100755 index c1cbbf2..952d7af --- a/includes/edit_topic_inc.php +++ b/includes/edit_topic_inc.php @@ -24,7 +24,7 @@ if( isset( $_REQUEST["submit_mult"] ) && isset( $_REQUEST["checked"] ) && $_REQU // user cancelled - just continue on, doing nothing } elseif( empty( $_REQUEST['confirm'] ) ) { $formHash['b'] = $_REQUEST['b']; - $formHash['delete'] = TRUE; + $formHash['delete'] = true; $formHash['submit_mult'] = 'remove_boards'; foreach( $_REQUEST["checked"] as $del ) { $formHash['input'][] = ''; @@ -40,12 +40,12 @@ if( isset( $_REQUEST["submit_mult"] ) && isset( $_REQUEST["checked"] ) && $_REQU $deleteComment = new LibertyComment( $deleteId ); if( $deleteComment->isValid() && $gBitUser->hasPermission('p_liberty_admin_comments') ) { if( !$deleteComment->expunge() ) { - $gBitSmarty->assignByRef( 'errors', $deleteComment->mErrors ); + $gBitSmarty->assign( 'errors', $deleteComment->mErrors ); } } } if( !empty( $errors ) ) { - $gBitSmarty->assignByRef( 'errors', $errors ); + $gBitSmarty->assign( 'errors', $errors ); } } } diff --git a/includes/list_boards_inc.php b/includes/list_boards_inc.php old mode 100644 new mode 100755 index c269de1..f368e0c --- a/includes/list_boards_inc.php +++ b/includes/list_boards_inc.php @@ -23,8 +23,8 @@ $gBitSystem->verifyPackage( 'boards' ); $gBitSystem->verifyPermission( 'p_boards_read' ); // Get a list of boards -$ns = array(); -$board_all_cids =array(); +$ns = []; +$board_all_cids =[]; // @TODO move pigeonholes to its own file library or something if($gBitSystem->isPackageActive('pigeonholes')) { @@ -33,11 +33,11 @@ if($gBitSystem->isPackageActive('pigeonholes')) { $p = new Pigeonholes(); $s = new LibertyStructure(); - $listHash = array('load_only_root'=> TRUE); + $listHash = array('load_only_root'=> true); $l = $p->getList($listHash); foreach ($l as $e) { $d = $s->getSubTree( $e['structure_id'] ); - $d_o = array(); + $d_o = []; foreach ($d as $c) { $pos_var = &$d_o; if($c['level']!=0) { @@ -45,22 +45,22 @@ if($gBitSystem->isPackageActive('pigeonholes')) { $pos_var = &$d_o; foreach ($pos as $pos_v) { if (!isset($pos_var['children'])) { - $pos_var['children']=array(); + $pos_var['children']=[]; } if (!isset($pos_var['children'][$pos_v-1])) { - $pos_var['children'][$pos_v-1]=array(); + $pos_var['children'][$pos_v-1]=[]; } $pos_var = &$pos_var['children'][$pos_v-1]; } } if (empty($pos_var['data'])) { - $pos_var['children']=array(); + $pos_var['children']=[]; $pos_var['data']=$c; - $mlHash=array(); + $mlHash=[]; $mlHash['content_id']=$c['content_id']; $mlHash['content_type_guid']=BITBOARD_CONTENT_TYPE_GUID; $pos_var['members']=$p->getMemberList($mlHash); - $board_cids =array(); + $board_cids =[]; foreach ($pos_var['members'] as $boardKey) { $board_cids[] = $boardKey['content_id']; } @@ -79,13 +79,13 @@ if($gBitSystem->isPackageActive('pigeonholes')) { } // get our boards list -$ret =array(); +$ret =[]; if($gBitSystem->isPackageActive('pigeonholes')) { // $ret['data']['title']="Uncategorised Boards"; } else { // $ret['data']['title']="Board List"; } -$ret['children']=array(); +$ret['children']=[]; $listHash = array('nboards'=>$board_all_cids,'paginationOff'=>'y'); $board = new BitBoard(); $ret['members'] = $board->getList($listHash); @@ -97,7 +97,7 @@ if (count($ret['members']) == 1) { $ns[] = $ret; } -$gBitSmarty->assignByRef('ns',$ns); +$gBitSmarty->assign('ns',$ns); // this might be for getting a count of nested boards - not entirely sure, if you figure it out please clarify this comment. function countBoards(&$a) { diff --git a/includes/lookup_inc.php b/includes/lookup_inc.php old mode 100644 new mode 100755 index 68a7937..69b33d2 --- a/includes/lookup_inc.php +++ b/includes/lookup_inc.php @@ -11,12 +11,12 @@ require_once( BOARDS_PKG_CLASS_PATH.'BitBoardTopic.php'); require_once( BOARDS_PKG_CLASS_PATH.'BitBoardPost.php' ); require_once( BOARDS_PKG_CLASS_PATH.'BitBoard.php' ); // if t supplied, use that -if( @BitBase::verifyId( $_REQUEST['t'] ) ) { +if( BitBase::verifyId( $_REQUEST['t'] ?? 0 ) ) { $gContent = new BitBoardTopic( $_REQUEST['t'] ); // if p supplied, use that -} elseif( @BitBase::verifyId( $_REQUEST['p'] ) ) { +} elseif( BitBase::verifyId( $_REQUEST['p'] ?? 0 ) ) { $gContent = new BitBoardPost( $_REQUEST['p'] ); -} elseif( @BitBase::verifyId( $_REQUEST['b'] ) ) { +} elseif( BitBase::verifyId( $_REQUEST['b'] ?? 0 ) ) { $gContent = new BitBoard( $_REQUEST['b'] ); } elseif (isset($_REQUEST['p'])) { $gContent = new BitBoardPost(); @@ -28,6 +28,6 @@ if( @BitBase::verifyId( $_REQUEST['t'] ) ) { } $gContent->load(); -$gBitSmarty->assignByRef( "gContent", $gContent ); +$gBitSmarty->assign( "gContent", $gContent ); ?> diff --git a/includes/user_preferences_inc.php b/includes/user_preferences_inc.php old mode 100644 new mode 100755 index 201acd9..27a56bd --- a/includes/user_preferences_inc.php +++ b/includes/user_preferences_inc.php @@ -1,26 +1,28 @@ array( + 'boards_show_avatars' => [ 'pref' => 'boards_show_avatars', 'label' => "Show Avatars", 'type' => "checkbox", 'default' => 'y', 'note' => "", - ), + ], */ -); +]; if (!empty( $_REQUEST['boards'] ) ) { foreach( $boardsSettings as $option => $op) { if ($op['type']=="checkbox") { - $editUser->storePreference($op['pref'], !empty( $_REQUEST['boards'][$option]) ? 'y' : 'n', 'users'); + $editUser->storePreference($op['pref'], !empty( $_REQUEST['boards'][$option]) ? 'y' : 'n'); } else { - $editUser->storePreference($op['pref'], !empty( $_REQUEST['boards'][$option]) ? $_REQUEST['boards'][$option] : '', 'users'); + $editUser->storePreference($op['pref'], !empty( $_REQUEST['boards'][$option]) ? $_REQUEST['boards'][$option] : ''); } } } @@ -38,7 +40,7 @@ if (!empty($content_type) && !empty($content_data)) { $signatureContent->mInfo['format_guid']=$editUser->getPreference('signature_content_type'); $signatureContent->mInfo['data']=$content_data; } -$gBitSmarty->assignByRef( 'signatureContent', $signatureContent ); +$gBitSmarty->assign( 'signatureContent', $signatureContent ); if( isset( $_REQUEST["format_guid"] ) ) { @@ -60,8 +62,6 @@ if( !empty( $_REQUEST["save_bitboarduprefs"] ) ) { // Check if all Request values are delivered, and if not, set them // to avoid error messages. This can happen if some features are // disabled - $editUser->storePreference('signature_content_type',$signatureContent->mInfo['format_guid'], 'users'); - $editUser->storePreference('signature_content_data',$signatureContent->mInfo['data'], 'users'); + $editUser->storePreference('signature_content_type',$signatureContent->mInfo['format_guid']); + $editUser->storePreference('signature_content_data',$signatureContent->mInfo['data']); } - -?> diff --git a/includes/view_board_inc.php b/includes/view_board_inc.php old mode 100644 new mode 100755 index 98a26a0..6b6fa33 --- a/includes/view_board_inc.php +++ b/includes/view_board_inc.php @@ -11,14 +11,16 @@ /** * required setup */ -require_once( '../kernel/includes/setup_inc.php' ); +namespace Bitweaver\Boards; +require_once '../kernel/includes/setup_inc.php'; +use Bitweaver\BitBase; +use Bitweaver\HttpStatusCodes; // Is package installed and enabled $gBitSystem->verifyPackage( 'boards' ); // if we're getting a migrate id then lets move on right away -if ( @BitBase::verifyId( $_REQUEST['migrate_board_id'] ) ) { - require_once( BOARDS_PKG_CLASS_PATH.'BitBoard.php' ); +if ( BitBase::verifyId( $_REQUEST['migrate_board_id'] ?? 0 ) ) { if( $_REQUEST['b'] = BitBoard::lookupByMigrateBoard( $_REQUEST['migrate_board_id'] ) ) { bit_redirect( BOARDS_PKG_URL.'index.php?b='. $_REQUEST['b'] ); @@ -28,10 +30,10 @@ if ( @BitBase::verifyId( $_REQUEST['migrate_board_id'] ) ) { $_REQUEST['board_id'] = BitBase::getParameter( $_REQUEST, 'b' ); // Load up the board -require_once( BOARDS_PKG_INCLUDE_PATH.'lookup_inc.php' ); +require_once BOARDS_PKG_INCLUDE_PATH.'lookup_inc.php'; if( !$gContent->isValid() ) { - $gBitSystem->fatalError( "The board you requested could not be found. View all boards", NULL, NULL, HttpStatusCodes::HTTP_GONE ); + $gBitSystem->fatalError( "The board you requested could not be found. View all boards", null, null, HttpStatusCodes::HTTP_GONE ); } // approve or reject ananymous comments @@ -43,7 +45,7 @@ if (!empty($_REQUEST['action'])) { $gBitUser->verifyTicket(); // Load up the comment as a board post - require_once( BOARDS_PKG_CLASS_PATH.'BitBoardPost.php' ); + require_once BOARDS_PKG_CLASS_PATH.'BitBoardPost.php'; $comment = new BitBoardPost($_REQUEST['comment_id']); $comment->loadComment(); @@ -75,7 +77,7 @@ if (!empty($_REQUEST['action'])) { * * @TODO perhaps move this into the action process above */ -require_once( BOARDS_PKG_INCLUDE_PATH.'edit_topic_inc.php' ); +require_once BOARDS_PKG_INCLUDE_PATH.'edit_topic_inc.php'; // Ok finally we can get on with viewing our board @@ -89,10 +91,10 @@ $commentsParentId=$gContent->mContentId; $comments_return_url= BOARDS_PKG_URL."index.php?b=".urlencode($gContent->mBitBoardId); // @TODO not clear why we load up comments and topics after this when its likely to get both. If someone figures it out please clarify. -require_once( BOARDS_PKG_INCLUDE_PATH.'boards_comments_inc.php' ); +require_once BOARDS_PKG_INCLUDE_PATH.'boards_comments_inc.php'; // get the topics for this board -require_once( BOARDS_PKG_CLASS_PATH.'BitBoardTopic.php' ); +require_once BOARDS_PKG_CLASS_PATH.'BitBoardTopic.php'; $threads = new BitBoardTopic( $gContent->mContentId ); @@ -101,16 +103,15 @@ $threads->mRootObj = $gContent; $threadsListHash = $_REQUEST; $threadList = $threads->getList( $threadsListHash ); -$gBitSmarty->assignByRef( 'threadList', $threadList ); +$gBitSmarty->assign( 'threadList', $threadList ); // getList() has now placed all the pagination information in $_REQUEST['listInfo'] -$gBitSmarty->assignByRef( 'listInfo', $threadsListHash['listInfo'] ); +$gBitSmarty->assign( 'listInfo', $threadsListHash['listInfo'] ); -$gBitSmarty->assignByRef( 'board', $gContent ); +$gBitSmarty->assign( 'board', $gContent ); $gBitSmarty->assign( 'cat_url', BOARDS_PKG_URL."index.php"); //?ct=".urlencode($gContent->mInfo['content_type_guid'])); $gBitThemes->loadAjax( 'mochikit' ); // Display the template -$gBitSystem->display( 'bitpackage:boards/list_topics.tpl', tra( 'Message Board Threads: ' . $gContent->getField('title') ) , array( 'display_mode' => 'display' )); -?> +$gBitSystem->display( 'bitpackage:boards/list_topics.tpl', tra( 'Message Board Threads: ' . $gContent->getField('title') ) , array( 'display_mode' => 'display' )); \ No newline at end of file diff --git a/includes/view_topic_inc.php b/includes/view_topic_inc.php old mode 100644 new mode 100755 index efee35e..ceec213 --- a/includes/view_topic_inc.php +++ b/includes/view_topic_inc.php @@ -7,19 +7,19 @@ /** * required setup */ -require_once( '../kernel/includes/setup_inc.php' ); - -// we need all three -require_once( BOARDS_PKG_CLASS_PATH.'BitBoard.php' ); -require_once( BOARDS_PKG_CLASS_PATH.'BitBoardTopic.php' ); -require_once( BOARDS_PKG_CLASS_PATH.'BitBoardPost.php' ); +use Bitweaver\BitBase; +use Bitweaver\HttpStatusCodes; +use Bitweaver\Boards\BitBoard; +use Bitweaver\Boards\BitBoardTopic; +use Bitweaver\Boards\BitBoardPost; +require_once '../kernel/includes/setup_inc.php'; // if we're getting a migrate id then lets move on right away -if( @BitBase::verifyId( $_REQUEST['migrate_topic_id'] ) ) { +if( BitBase::verifyId( $_REQUEST['migrate_topic_id'] ?? 0 ) ) { if( $_REQUEST['t'] = BitBoardTopic::lookupByMigrateTopic( $_REQUEST['migrate_topic_id'] ) ) { bit_redirect( BOARDS_PKG_URL.'index.php?t='. $_REQUEST['t'] ); } -} elseif( @BitBase::verifyId( $_REQUEST['migrate_post_id'] ) ) { +} elseif( BitBase::verifyId( $_REQUEST['migrate_post_id'] ?? 0 ) ) { if( $_REQUEST['t'] = BitBoardTopic::lookupByMigratePost( $_REQUEST['migrate_post_id'] ) ) { bit_redirect( BOARDS_PKG_URL.'index.php?t='. $_REQUEST['t'] ); } @@ -34,7 +34,7 @@ if (!empty($_REQUEST['action'])) { $comment = new BitBoardPost($_REQUEST['comment_id']); $comment->loadComment(); if (!$comment->isValid()) { - $gBitSystem->fatalError( tra("Invalid Comment"), NULL, NULL, HttpStatusCodes::HTTP_GONE ); + $gBitSystem->fatalError( tra("Invalid Comment"), null, null, HttpStatusCodes::HTTP_GONE ); } switch ($_REQUEST['action']) { case 1: @@ -59,7 +59,7 @@ $thread = new BitBoardTopic($_REQUEST['t']); $thread->load(); if( !$thread->isValid() ) { - $gBitSystem->fatalError( tra("Unknown discussion"), NULL, NULL, HttpStatusCodes::HTTP_GONE ); + $gBitSystem->fatalError( tra("Unknown discussion"), null, null, HttpStatusCodes::HTTP_GONE ); } $thread->verifyViewPermission(); @@ -67,10 +67,10 @@ $thread->verifyViewPermission(); // load up the root board we need it $gBoard = new BitBoard(null,$thread->mInfo['board_content_id']); $gBoard->load(); -$gBitSmarty->assignByRef( 'board', $gBoard ); +$gBitSmarty->assign( 'board', $gBoard ); // force root board to be gContent $gContent = &$gBoard; -$gBitSmarty->assignByRef('gContent', $gContent); +$gBitSmarty->assign('gContent', $gContent); // if you know what this is please comment it @@ -79,7 +79,7 @@ if (empty($thread->mInfo['th_root_id'])) { //Invalid as a result of rejecting the post, redirect to the board bit_redirect( $gBoard->getDisplayUrl() ); } else { - $gBitSystem->fatalError(tra( "Invalid topic selection." ), NULL, NULL, HttpStatusCodes::HTTP_GONE ); + $gBitSystem->fatalError(tra( "Invalid topic selection." ), null, null, HttpStatusCodes::HTTP_GONE ); } } @@ -90,8 +90,8 @@ $thread->invokeServices( 'content_display_function', $displayHash ); $thread->readTopic(); -$gBitSmarty->assignByRef( 'thread', $thread ); -$gBitSmarty->assign( 'topic_locked', BitBoardTopic::isLocked( $thread->mCommentContentId ) ); +$gBitSmarty->assign( 'thread', $thread ); +$gBitSmarty->assign( 'topic_locked', BitBoardTopic::isThreadLocked( $thread->mCommentContentId ) ); // Get the thread of comments @@ -106,7 +106,7 @@ if( empty( $_REQUEST["comments_style"] ) ) { $_REQUEST["comments_style"] = "flat"; } -require_once( BOARDS_PKG_INCLUDE_PATH.'boards_comments_inc.php' ); +require_once BOARDS_PKG_INCLUDE_PATH.'boards_comments_inc.php'; if( $gBitUser->isRegistered() ) { $postComment['registration_date']=$gBitUser->mInfo['registration_date']; @@ -116,7 +116,7 @@ if( $gBitUser->isRegistered() ) { // display warnings - might be for edit processes - if you know please comment -$warnings = array(); +$warnings = []; if (!empty($_REQUEST['warning'])) { foreach ($_REQUEST['warning'] as $id => $state) { if (strcasecmp($state,'show')==0) { @@ -124,11 +124,10 @@ if (!empty($_REQUEST['warning'])) { } } } -$gBitSmarty->assignByRef('warnings',$warnings); +$gBitSmarty->assign('warnings',$warnings); // ajax support $gBitThemes->loadAjax( 'mochikit' ); $gBitSystem->display('bitpackage:boards/list_posts.tpl', "Show Thread: " . $thread->getField('title') , array( 'display_mode' => 'display' )); -?> diff --git a/index.php b/index.php old mode 100644 new mode 100755 index 0783f2e..3b4c578 --- a/index.php +++ b/index.php @@ -4,7 +4,7 @@ // All Rights Reserved. See below for details and a complete list of authors. // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details. // Initialization -require_once( '../kernel/includes/setup_inc.php' ); +require_once '../kernel/includes/setup_inc.php'; $gBitSystem->verifyPackage( 'boards' ); if( !empty( $_REQUEST['t'] ) || !empty( $_REQUEST['migrate_topic_id'] ) || !empty( $_REQUEST['migrate_post_id'] ) ) { diff --git a/mailing_list.php b/mailing_list.php old mode 100644 new mode 100755 index d6c5ee0..4f2e0c4 --- a/mailing_list.php +++ b/mailing_list.php @@ -12,7 +12,7 @@ /** * required setup */ -require_once( '../kernel/includes/setup_inc.php' ); +require_once '../kernel/includes/setup_inc.php'; require_once( BOARDS_PKG_CLASS_PATH.'BitBoardTopic.php' ); require_once( BOARDS_PKG_CLASS_PATH.'BitBoardPost.php' ); require_once( BOARDS_PKG_CLASS_PATH.'BitBoard.php' ); @@ -37,7 +37,7 @@ if( $boardSyncInbox = BitBoard::getBoardSyncInbox() ) { if( !empty( $_REQUEST['create_list'] ) ) { //------ Email List ------// if( !($error = mailman_newlist( array( 'listname' => $_REQUEST['boards_mailing_list'], 'admin-password'=>$_REQUEST['boards_mailing_list_password'], 'listadmin-addr'=>$gBitUser->getField( 'email' ) ) )) ) { - $gContent->storePreference( 'boards_mailing_list', !empty( $_REQUEST['boards_mailing_list'] ) ? $_REQUEST['boards_mailing_list'] : NULL ); + $gContent->storePreference( 'boards_mailing_list', !empty( $_REQUEST['boards_mailing_list'] ) ? $_REQUEST['boards_mailing_list'] : null ); $gContent->storePreference( 'boards_mailing_list_password', $_REQUEST['boards_mailing_list_password'] ); } else { $gBitSmarty->assign( 'errorMsg', $error ); @@ -51,7 +51,7 @@ if( !empty( $_REQUEST['create_list'] ) ) { } elseif( !empty( $_REQUEST['delete_list'] ) ) { if( $gContent->getPreference( 'boards_mailing_list' ) ) { if( empty( $_REQUEST['confirm'] ) ) { - $formHash['delete_list'] = TRUE; + $formHash['delete_list'] = true; $formHash['b'] = $gContent->getField( 'board_id' ); $gBitSystem->confirmDialog( $formHash, array( @@ -61,8 +61,8 @@ if( !empty( $_REQUEST['create_list'] ) ) { ); } else { if( !($error = mailman_rmlist( $gContent->getPreference( 'boards_mailing_list' ) )) ) { - $gContent->storePreference( 'boards_mailing_list', NULL ); - $gContent->storePreference( 'boards_mailing_list_password', NULL ); + $gContent->storePreference( 'boards_mailing_list', null ); + $gContent->storePreference( 'boards_mailing_list_password', null ); bit_redirect( BOARDS_PKG_URL."mailing_list.php?b=".$gContent->getField( 'board_id' ) ); } else { $gBitSmarty->assign( 'errorMsg', $error ); @@ -70,7 +70,7 @@ if( !empty( $_REQUEST['create_list'] ) ) { } } } elseif( !empty( $_REQUEST['save_list_address'] ) ) { - $gContent->storePreference( 'board_sync_list_address', (!empty( $_REQUEST['board_sync_list_address'] ) ? $_REQUEST['board_sync_list_address'] : NULL ) ); + $gContent->storePreference( 'board_sync_list_address', (!empty( $_REQUEST['board_sync_list_address'] ) ? $_REQUEST['board_sync_list_address'] : null ) ); } elseif( $gContent->getPreference( 'boards_mailing_list' ) ) { // check for submits that need boards_mailing_list if( !empty( $_REQUEST['subscribe_boardsync'] ) ) { @@ -93,13 +93,13 @@ if( $gContent->getBoardMailingList() ) { $gBitSmarty->assign( 'boardsMailingList', $gContent->getBoardMailingList() ); if ( $gContent->hasUserPermission( 'p_boards_boards_members_view' ) ){ $members = mailman_list_members( $gContent->getPreference( 'boards_mailing_list' ) ); - $gBitSmarty->assignByRef( 'listMembers', $members ); + $gBitSmarty->assign( 'listMembers', $members ); } } else { $gBitSmarty->assign( 'suggestedListName', preg_replace( '/[^a-z0-9]/', '', strtolower( $gContent->getTitle() ) ) ); } // display -$gBitSmarty->assignByRef( 'board', $gContent ); +$gBitSmarty->assign( 'board', $gContent ); $gBitSystem->display( "bitpackage:boards/mailing_list.tpl", $gContent->getTitle() ." ". tra( 'Message Board Mailing List' ) , array( 'display_mode' => 'list' )); ?> diff --git a/modules/help_mod_recent_posts.tpl b/modules/help_mod_recent_posts.tpl old mode 100644 new mode 100755 index 0c34f39..b0d4272 --- a/modules/help_mod_recent_posts.tpl +++ b/modules/help_mod_recent_posts.tpl @@ -1,10 +1,10 @@

- {tr}Recent board postings. If set, the parameter b specifies a board to display.{/tr} + Recent board postings. If set, the parameter b specifies a board to display.
- {tr}Example:{/tr} b=5 + Example: b=5

b
-
{tr}Numeric{/tr}
+
Numeric
\ No newline at end of file diff --git a/modules/mod_recent_posts.php b/modules/mod_recent_posts.php old mode 100644 new mode 100755 index b677497..99af120 --- a/modules/mod_recent_posts.php +++ b/modules/mod_recent_posts.php @@ -32,7 +32,7 @@ if( !empty( $module_params['b'] ) ) { } elseif( !empty( $_REQUEST['b'] ) && empty( $module_params['all_boards'] ) ) { $listHash['board_id'] = $_REQUEST['b']; } -$_template->tpl_vars['modRecentPostsBoardId'] = new Smarty_variable( !empty( $listHash['board_id'] ) ); +$gBitSmarty->assign( 'modRecentPostsBoardId', !empty( $listHash['board_id'] ) ); if( BitBase::verifyId( $gQueryUserId ) ) { $listHash['user_id'] = $gQueryUserId; @@ -40,7 +40,7 @@ if( BitBase::verifyId( $gQueryUserId ) ) { $post = new BitBoardPost(); if( $postList = $post->getList( $listHash ) ) { - $_template->tpl_vars['modLastBoardPosts'] = new Smarty_variable( $postList ); + $gBitSmarty->assign( 'modLastBoardPosts', $postList ); } ?> diff --git a/modules/mod_recent_posts.tpl b/modules/mod_recent_posts.tpl old mode 100644 new mode 100755 index 8981422..ae3970c --- a/modules/mod_recent_posts.tpl +++ b/modules/mod_recent_posts.tpl @@ -1,16 +1,16 @@ {strip} -{if $gBitSystem->isPackageActive('boards') && $modLastBoardPosts} +{if $gBitSystem->isPackageActive('boards') and $modLastBoardPosts} {bitmodule title=$moduleTitle name="last_board_posts"} {/bitmodule} {/if} diff --git a/rss.php b/rss.php old mode 100644 new mode 100755 index ca6b13e..432fabb --- a/rss.php +++ b/rss.php @@ -9,7 +9,7 @@ /** * required setup */ -require_once( '../kernel/includes/setup_inc.php' ); +require_once '../kernel/includes/setup_inc.php'; $gBitSystem->verifyPackage( 'boards' ); $gBitSystem->verifyPackage( 'rss' ); @@ -41,7 +41,7 @@ if( !empty( $_REQUEST['get_feed'] ) ) { } } $feedlink['url'] .= 'version='.$_REQUEST['format'].( $gBitSystem->getConfig( 'rssfeed_httpauth' ) && $gBitUser->isRegistered()?'&httpauth=y':''); - $feedlink['title'] = ( $gContent->getField('title') != NULL ?$gContent->getField('title'):tra('Boards')).' - '.$feedFormat[$_REQUEST['format']]; + $feedlink['title'] = ( $gContent->getField('title') != null ?$gContent->getField('title'):tra('Boards')).' - '.$feedFormat[$_REQUEST['format']]; $feedlink['format'] = $_REQUEST['format']; } else { $feedlink['format'] = $gBitSystem->getConfig( 'rssfeed_default_version' ); diff --git a/styles/boards.css b/styles/boards.css old mode 100644 new mode 100755 index 9453b67..9f478bf --- a/styles/boards.css +++ b/styles/boards.css @@ -1,25 +1,82 @@ -form.mb-threading div {display:inline;} -.boards .mb-threading {} - -.boards tr.odd.unapproved {background:#faa;} -.boards tr.even.unapproved {background:#fac;} -.boards tr.odd.moved {background:#aaf;} -.boards tr.even.moved {background:#acf;} -.boards div.indent .indent {margin-left:2em;} -.boards tr.highlight {background:#fca;} -.boards .mb-post .warning {} - -.boards .mb-post .indent1 {margin-left:20px;} -.boards .mb-post .indent2 {margin-left:35px;} -.boards .mb-post .indent3 {margin-left:50px;} -.boards .mb-post .indent4 {margin-left:60px;} -.boards .mb-post .indent5 {margin-left:70px;} -.boards .mb-post .indent6 {margin-left:80px;} -.boards .mb-post .indent7 {margin-left:90px;} - -.boards .mb-post {clear:both;} -.boards .mb-post .content {width:auto} -.boards .mb-post .header {} -.boards .mb-post .userinfo {float:left;width:140px;} -.boards .mb-post .showavatar {margin-left:145px;} -.boards .mb-post .signature {clear:both;} +form.mb-threading div { + display: inline; +} + +.boards .mb-threading {} + +.boards tr.odd.unapproved { + background: #faa; +} + +.boards tr.even.unapproved { + background: #fac; +} + +.boards tr.odd.moved { + background: #aaf; +} + +.boards tr.even.moved { + background: #acf; +} + +.boards div.indent .indent { + margin-left: 2em; +} + +.boards tr.highlight { + background: #fca; +} + +.boards .mb-post .warning {} + +.boards .mb-post .indent1 { + margin-left: 20px; +} + +.boards .mb-post .indent2 { + margin-left: 35px; +} + +.boards .mb-post .indent3 { + margin-left: 50px; +} + +.boards .mb-post .indent4 { + margin-left: 60px; +} + +.boards .mb-post .indent5 { + margin-left: 70px; +} + +.boards .mb-post .indent6 { + margin-left: 80px; +} + +.boards .mb-post .indent7 { + margin-left: 90px; +} + +.boards .mb-post { + clear: both; +} + +.boards .mb-post .content { + width: auto +} + +.boards .mb-post .header {} + +.boards .mb-post .userinfo { + float: left; + width: 140px; +} + +.boards .mb-post .showavatar { + margin-left: 145px; +} + +.boards .mb-post .signature { + clear: both; +} \ No newline at end of file diff --git a/templates/admin_boards.tpl b/templates/admin_boards.tpl old mode 100644 new mode 100755 index c6f3ca8..e320d8e --- a/templates/admin_boards.tpl +++ b/templates/admin_boards.tpl @@ -10,25 +10,25 @@ {section name=ix loop=$boards} {sectionelse} - + {/section} {/forminput}
- +
{/legend} *} {legend legend="List Settings"} - + {foreach from=$formBitBoardsLists key=item item=output}
{formlabel label=$output.label for=$item} {forminput label="checkbox"} {html_checkboxes name="$item" values="y" checked=$gBitSystem->getConfig($item) labels=false id=$item} - {formhelp note=$output.note page=$output.page} + {formhelp note=$output.note page=$output.page|default:''} {/forminput}
{/foreach} @@ -38,7 +38,7 @@
{forminput}

List to Board Sync

-

{tr}List to Board Sync allows a bitweaver board to mirror messages that are posted to a mailing list. A single, master email inbox entered below is used for *all* email list subscriptions. Then, configure individual boards to indicate which mailing list to which it is subscribed. The Board Sync cron script will import messages from the master email inbox.{/tr}

+

List to Board Sync allows a bitweaver board to mirror messages that are posted to a mailing list. A single, master email inbox entered below is used for *all* email list subscriptions. Then, configure individual boards to indicate which mailing list to which it is subscribed. The Board Sync cron script will import messages from the master email inbox.

{/forminput}
{foreach from=$formBitBoardsSync key=item item=output} @@ -46,7 +46,7 @@ {formlabel label=$output.label for=$item} {forminput} - {formhelp note=$output.note page=$output.page} + {formhelp note=$output.note page=$output.page|default:''} {/forminput} {/foreach} @@ -54,7 +54,7 @@
{forminput}

Board to List Sync

-

{tr}Board to List Sync is the opposite of the above. It allows a bitweaver board to send a message to mailing list. You must complete the "List to Board Sync" configuration above for this feature to work.{/tr} {tr}Please see configuration requirements prior to utilizing this feature.{/tr}

+

Board to List Sync is the opposite of the above. It allows a bitweaver board to send a message to mailing list. You must complete the "List to Board Sync" configuration above for this feature to work. Please see configuration requirements prior to utilizing this feature.

{/forminput}
@@ -69,7 +69,7 @@ {formlabel label=$output.label for=$item} {forminput label="checkbox"} {html_checkboxes name="$item" values="y" checked=$gBitSystem->getConfig($item) labels=false id=$item} - {formhelp note=$output.note page=$output.page} + {formhelp note=$output.note page=$output.page|default:''} {/forminput} {/foreach} @@ -122,7 +122,7 @@ {/legend}
- +
{/form} {/strip} diff --git a/templates/board_assign.tpl b/templates/board_assign.tpl old mode 100644 new mode 100755 index 4867e38..90cd151 --- a/templates/board_assign.tpl +++ b/templates/board_assign.tpl @@ -1,7 +1,7 @@ {strip}
-

{tr}Assign Content to Boards{/tr}

+

Assign Content to Boards

@@ -36,7 +36,7 @@
- +
{/form} {else} @@ -47,7 +47,7 @@ {if $board.map} {capture assign=title} {if ! $board.integrity} - {booticon iname="fa-triangle-exclamation" iexplain="Integrity Check Failed"} + {booticon iname="icon-warning-sign" iexplain="Integrity Check Failed"} {/if} {$board.title|escape} {/capture} @@ -56,19 +56,19 @@ {if ! $board.integrity} {formfeedback warning="Integrity Check Failed"} {/if} - + - - - - + + + + {foreach item=mapping from=$board.map} @@ -78,14 +78,14 @@ {/foreach}
{tr}Assigned Content{/tr}Assigned Content
{tr}Content Type{/tr}{tr}Content Title{/tr}{tr}Posts{/tr}{tr}Action{/tr}Content TypeContent TitlePostsAction
{$mapping.thread_count} - {booticon iname="fa-trash" iexplain="Remove from board"} + {booticon iname="icon-trash" ipackage="icons" iexplain="Remove from board"}
- +
{/form} {/if} diff --git a/templates/board_cat.tpl b/templates/board_cat.tpl old mode 100644 new mode 100755 index e9ee0cb..c311ffc --- a/templates/board_cat.tpl +++ b/templates/board_cat.tpl @@ -2,15 +2,15 @@
{if $child.data.title} {$child.data.title|escape} - {elseif $gBitSystem->isPackageActive('pigeonholes') && count($ns) > 1} - {tr}Uncategorized{/tr} + {elseif $gBitSystem->isPackageActive('pigeonholes') and count($ns) > 1} + Uncategorized {/if}
{if count($child.members) > 0} {include file="bitpackage:boards/board_table.tpl" boardsList=$child.members heading=$heading} {/if} - {if !empty($child.sub_count) && count($child.children)>0} + {if !empty($child.sub_count) and count($child.children)>0} {foreach from=$child.children item=schild} {include file="bitpackage:boards/board_cat.tpl" child=$schild color=$color} {/foreach} diff --git a/templates/board_edit.tpl b/templates/board_edit.tpl old mode 100644 new mode 100755 index b64af5b..eb53d98 --- a/templates/board_edit.tpl +++ b/templates/board_edit.tpl @@ -25,9 +25,9 @@

{if $gContent->isValid()} - {tr}{tr}Edit{/tr} {$gContent->getTitle()|escape}{/tr} + Edit {$gContent->getTitle()|escape} {else} - {tr}Create New Board{/tr} + Create New Board {/if}

@@ -55,7 +55,7 @@ {/jstabs}
- +
{/form}
diff --git a/templates/board_table.tpl b/templates/board_table.tpl old mode 100644 new mode 100755 index 6f425a6..3f346c3 --- a/templates/board_table.tpl +++ b/templates/board_table.tpl @@ -17,10 +17,10 @@ 0} unapproved{/if}"> {* topic tracking icons *} - {if $board.track.on && $board.track.mod} - {booticon iname="fa-asterisk" iexplain="New Posts"} + {if $board.track.on and $board.track.mod} + {booticon iname="icon-asterisk" ipackage="icons" ipath="large" iexplain="New Posts" iforce="icon"} {else} - {booticon iname="fa-asterisk" iexplain="New Posts"} + {booticon iname="icon-asterisk" ipackage="icons" ipath="large" iexplain="New Posts" iforce="icon"} {/if} {$board_title}
{$board.parsed_data} @@ -38,7 +38,7 @@
by {if $board.last.user_id < 0}{$board.last.l_anon_name|escape}{else}{displayname user_id=$board.last.user_id}{/if}
{if $board.last.last_modified > 0}{$board.last.last_modified|reltime}{/if} {/if} - {if $gBitUser->hasPermission('p_boards_update') || $gBitUser->hasPermission('p_boards_post_update')} + {if $gBitUser->hasPermission('p_boards_update') or $gBitUser->hasPermission('p_boards_post_update')} {if $board.unreg > 0}{$board.unreg}{/if} {/if} diff --git a/templates/boards_edit_mini_inc.tpl b/templates/boards_edit_mini_inc.tpl old mode 100644 new mode 100755 index 5b0a334..9403a6c --- a/templates/boards_edit_mini_inc.tpl +++ b/templates/boards_edit_mini_inc.tpl @@ -1,4 +1,4 @@ -{if $gBitUser->hasPermission('p_boards_link_content') && $gContent->mContentTypeGuid != $smarty.const.BITBOARD_CONTENT_TYPE_GUID} +{if $gBitUser->hasPermission('p_boards_link_content') and $gContent->mContentTypeGuid != $smarty.const.BITBOARD_CONTENT_TYPE_GUID} {* {$gContent->mContentTypeGuid} *}
{formlabel label="Linked Board"} @@ -10,7 +10,7 @@ {html_options class="form-control" name="linked_board_cid" options=$boardList selected=$boardInfo.board_content_id} {/if} {else} - {tr}No discussion boards have been created.{/tr} + No discussion boards have been created. {/if} {formhelp note="Comments added will appear on the selected message board."} {/forminput} diff --git a/templates/boards_rss_form.tpl b/templates/boards_rss_form.tpl old mode 100644 new mode 100755 index 4601f51..ee544eb --- a/templates/boards_rss_form.tpl +++ b/templates/boards_rss_form.tpl @@ -1,7 +1,7 @@ {strip}
-

{tr}RSS Syndication{/tr}

+

RSS Syndication

@@ -34,7 +34,7 @@
{formlabel label="Feed" for="pkg"} {forminput} - {if $gContent->isValid()}{tr}{$gContent->getField('title')} Feed{/tr}{else}{tr}Recent Discussions{/tr}{/if} + {if $gContent->isValid()}{$gContent->getField('title')} Feed{else}Recent Discussions{/if} {formhelp note=""} {/forminput}
diff --git a/templates/boards_service_icons.tpl b/templates/boards_service_icons.tpl old mode 100644 new mode 100755 index de8c7b0..fd79aae --- a/templates/boards_service_icons.tpl +++ b/templates/boards_service_icons.tpl @@ -1,3 +1,3 @@ -{if $boardInfo.board_id} - {booticon ipackage="boards" iname="fa-comments" iexplain="Discuss"} [{$boardInfo.post_count}] +{if !empty($boardInfo.board_id)} + {booticon ipackage="boards" iname="icon-comments" iexplain="Discuss"} [{$boardInfo.post_count}] {/if} diff --git a/templates/comment_post.tpl b/templates/comment_post.tpl old mode 100644 new mode 100755 index 072fb61..6bec11a --- a/templates/comment_post.tpl +++ b/templates/comment_post.tpl @@ -2,11 +2,11 @@ {strip}
-
+
{formfeedback hash=$formfeedback} {if $post_comment_preview} -

{tr}Comments Preview{/tr}

+

Comments Preview

{include file='bitpackage:liberty/display_comment.tpl' comment=$postComment}
@@ -17,7 +17,7 @@ - {if $smarty.request.post_comment_request || $smarty.request.post_comment_preview} + {if $smarty.request.post_comment_request or $smarty.request.post_comment_preview} {legend legend="Post"} @@ -31,14 +31,14 @@
{capture assign="textarea_help"} - {tr}Use [http://www.foo.com] or [http://www.foo.com|description] for links.
HTML tags are not allowed inside comments.{/tr} + Use [http://www.foo.com] or [http://www.foo.com|description] for links.
HTML tags are not allowed inside comments. {/capture} {textarea noformat=1 label="Comment" id="commentpost" name="comment_data" rows="6" edit=$postComment.data}
-   -   - +   +   +
{/legend} {/if} diff --git a/templates/flipswitch.tpl b/templates/flipswitch.tpl old mode 100644 new mode 100755 index 2331fcc..922eab2 --- a/templates/flipswitch.tpl +++ b/templates/flipswitch.tpl @@ -14,13 +14,13 @@ $flip_downname=>$flip.$flip_name.downname {if $gContent->hasUserPermission( $flip.$flip_name.perm )} {if $flip.$flip_name.state==1} - {booticon ipackage=icons iname=$flip.$flip_name.up iexplain=$flip.$flip_name.upname} + {booticon ipackage=icons iname=$flip.$flip_name.up iexplain=$flip.$flip_name.upname iforce="icon"} {else} - {booticon ipackage=icons iname=$flip.$flip_name.down iexplain=$flip.$flip_name.downname} + {booticon ipackage=icons iname=$flip.$flip_name.down iexplain=$flip.$flip_name.downname iforce="icon"} {/if} {elseif $flip.$flip_name.state==1} - {booticon iname=$flip.$flip_name.up iexplain=$flip.$flip_name.upname} + {booticon ipackage=icons iname=$flip.$flip_name.up iexplain=$flip.$flip_name.upname iforce="icon"} {/if} {/strip} diff --git a/templates/html_head_inc.tpl b/templates/html_head_inc.tpl old mode 100644 new mode 100755 index 7b6066d..1cac695 --- a/templates/html_head_inc.tpl +++ b/templates/html_head_inc.tpl @@ -46,12 +46,12 @@ /* ]]> */ {if $gBitSystem->isPackageActive( 'rss' )} - {if $board && $smarty.request.b} - - - {elseif $thread && $smarty.request.t} - - + {if $board and $smarty.request.b} + + + {elseif $thread and $smarty.request.t} + + {/if} {/if} {/if} diff --git a/templates/legend_inc.tpl b/templates/legend_inc.tpl old mode 100644 new mode 100755 index 9d90f71..541ad79 --- a/templates/legend_inc.tpl +++ b/templates/legend_inc.tpl @@ -2,9 +2,9 @@ {if $topicicons}
    -
  • {booticon iname="fa-lock" iexplain="Thread Closed"} {tr}Thread Closed{/tr}
  • -
  • {booticon iname="fa-circle-exclamation" iexplain="Sticky"} {tr}Sticky{/tr}
  • -
  • {booticon iname="fa-asterisk" iexplain="New Posts"} {tr}New Posts{/tr}
  • +
  • {booticon iname="icon-lock" ipackage="icons" ipath=large iexplain="Thread Closed" iforce="icon"} Thread Closed
  • +
  • {booticon iname="icon-exclamation-sign" ipackage="icons" ipath=large iexplain="Sticky" iforce="icon"} Sticky
  • +
  • {booticon iname="icon-asterisk" ipackage="icons" ipath=large iexplain="New Posts" iforce="icon"} New Posts
{/if} diff --git a/templates/list_boards.tpl b/templates/list_boards.tpl old mode 100644 new mode 100755 index 0cde976..552a221 --- a/templates/list_boards.tpl +++ b/templates/list_boards.tpl @@ -2,7 +2,7 @@ {strip}
-

{tr}{if $smarty.const.BOARDS_PKG_DIR != 'boards'}{$smarty.const.BOARDS_PKG_DIR|ucfirst}{else}Message Boards{/if}{/tr}

+

{if $smarty.const.BOARDS_PKG_DIR != 'boards'}{$smarty.const.BOARDS_PKG_DIR|ucfirst}{else}Message Boards{/if}

@@ -12,7 +12,7 @@ {include file="bitpackage:boards/board_cat.tpl" child=$child color=$color} {/if} {foreachelse} - {tr}No message boards found{/tr} + No message boards found {/foreach} {include file="bitpackage:boards/legend_inc.tpl" boardicons=1} diff --git a/templates/list_posts.tpl b/templates/list_posts.tpl old mode 100644 new mode 100755 index e65857c..42e92ab --- a/templates/list_posts.tpl +++ b/templates/list_posts.tpl @@ -4,7 +4,7 @@ @@ -15,13 +15,13 @@ {* always go back to page 1 since changing any of these values repaginates and makes the current page number meaningless *} - + +        {/form} {if $gBitSystem->isPackageActive( 'rss' )} - {booticon iname="fa-rss" iexplain="Get RSS Feed"} + {booticon iname="icon-rss" ipackage=rss iexplain="Get RSS Feed"} {/if} {assign var=flip value=$thread->getFlipFlop()} {foreach from=$flip item=flip_s key=flip_name} @@ -47,32 +47,32 @@

{$thread->getTitle()|escape}

{if $thread->getField('root_content_type_guid') != $smarty.const.BITBOARD_CONTENT_TYPE_GUID} - {tr}Comment on{/tr} {$thread->getField('root_title')|default:$thread->getField('root_content_id')|escape} + Comment on {$thread->getField('root_title')|default:$thread->getField('root_content_id')|escape} {/if}
- {if !$topic_locked && $board->hasPostCommentsPermission()} + {if !$topic_locked and $board->hasPostCommentsPermission()} {/if} {formfeedback hash=$formfeedback} {foreach item=comment from=$comments} -
+
{assign var=thread_mInfo value=$thread->mInfo} {displaycomment comment=$comment template=$comment_template}
{foreachelse}

- {tr}No posts found{/tr} + No posts found

{/foreach} {if $post_comment_preview} -

{tr}Preview{/tr}

+

Preview

{assign var=post_is_preview value=1} {displaycomment comment=$postComment template=$comment_template} @@ -80,17 +80,17 @@
{/if} - {if !$topic_locked && $board->hasPostCommentsPermission()} + {if !$topic_locked and $board->hasPostCommentsPermission()} {/if} - {libertypagination ihash=$commentsPgnHash} + {pagination ihash=$commentsPgnHash}
-{if $gBitSystem->isFeatureActive('boards_post_anon_moderation') && ($smarty.request.post_comment_request || !empty($smarty.request.post_comment_submit)) && !$gBitUser->isRegistered()} +{if $gBitSystem->isFeatureActive('boards_post_anon_moderation') and ($smarty.request.post_comment_request or !empty($smarty.request.post_comment_submit)) and !$gBitUser->isRegistered()} {formfeedback warning="Your post will not be shown immediately it will have to be approved by a moderator"} {/if} diff --git a/templates/list_topics.tpl b/templates/list_topics.tpl old mode 100644 new mode 100755 index e22b576..0b05eb8 --- a/templates/list_topics.tpl +++ b/templates/list_topics.tpl @@ -1,26 +1,28 @@ {* $Header$ *} +{if empty($print_page)}{assign var=print_page value=false}{/if} + {strip}
- {if $print_page ne 'y'} + {if !$print_page} {include file="bitpackage:liberty/services_inc.tpl" serviceLocation='icon' serviceHash=$board->mInfo} - {if $board->getPreference('boards_mailing_list') || $board->hasAdminPermission()} - {booticon iname="fa-envelope" iexplain="Edit Board Mailing List"} + {if $board->getPreference('boards_mailing_list') or $board->hasAdminPermission()} + {booticon ipackage="icons" iname="icon-envelope" iexplain="Edit Board Mailing List"} {/if} {if $gBitSystem->isPackageActive( 'rss' )} - {booticon iname="fa-rss" iexplain="Get RSS Feed"} + {booticon iname="icon-rss" ipackage=rss iexplain="Get RSS Feed"} {/if} {if $board->hasUpdatePermission()} - {booticon iname="fa-pen-to-square" iexplain="Edit Message Board"} + {booticon iname="icon-edit" ipackage="icons" iexplain="Edit Message Board"} {/if} - {if $board->hasUserPermission( 'p_boards_remove', TRUE, TRUE )} - {booticon iname="fa-trash" iexplain="Remove Message Board"} + {if $board->hasUserPermission( 'p_boards_remove', true, true )} + {booticon iname="icon-trash" ipackage="icons" iexplain="Remove Message Board"} {/if} {/if} {*if $board->hasPostCommentsPermission()} @@ -48,12 +50,12 @@ {if !$gBitSystem->isFeatureActive('boards_thread_verbrose')} - {tr}New Topic{/tr} + New Topic - {tr}Title{/tr} - {tr}Last Reply{/tr} - {if $board->hasUpdatePermission() || $gBitUser->hasPermission('p_boards_post_update')} - Anon + Title + Last Reply + {if $board->hasUpdatePermission() or $gBitUser->hasPermission('p_boards_post_update')} + Anon {/if} {if $board->hasUpdatePermission()} Actions @@ -62,11 +64,11 @@ {/if} {foreach item=thread from=$threadList} - isFeatureActive('boards_post_anon_moderation') && $thread.unreg > 0}unapproved{elseif $thread.th_moved>0}moved{/if} {if $thread.th_sticky==1} highlight{/if}" > + isFeatureActive('boards_post_anon_moderation') and $thread.unreg > 0}unapproved{elseif $thread.th_moved>0}moved{/if} {if $thread.th_sticky==1} highlight{/if}" > {* topic status icons *} {if $thread.th_moved>0} - {booticon ipackage="icons" iname="fa-share" iexplain="Moved Topic"} + {booticon ipackage="icons" iname="icon-share" iexplain="Moved Topic"} {else} {assign var=flip value=$thread.flip} {foreach from=$flip item=flip_s key=flip_name} @@ -79,7 +81,7 @@ {include file="bitpackage:liberty/services_inc.tpl" serviceLocation='list' serviceHash=$thread} - {tr}by{/tr} {if $thread.flc_user_id < 0}{$thread.anon_name|escape}{else}{displayname user_id=$thread.flc_user_id}{/if} {tr}on{/tr} {$thread.flc_created|reltime:short|escape} + by {if $thread.flc_user_id < 0}{$thread.anon_name|escape}{else}{displayname user_id=$thread.flc_user_id}{/if} on {$thread.flc_created|reltime:short|escape} @@ -87,31 +89,31 @@ {if $thread.post_count > 1}{if $thread.llc_user_id < 0}{$thread.l_anon_name|escape}{else}{displayname user_id=$thread.llc_user_id}{/if}{else}{/if} - {if $board->hasUpdatePermission() || $gBitUser->hasPermission('p_boards_post_update')} + {if $board->hasUpdatePermission() or $gBitUser->hasPermission('p_boards_post_update')} {if $thread.unreg > 0}{$thread.unreg}{/if} {/if} - {if $board->hasUpdatePermission() || $gBitUser->hasPermission('p_boards_post_update')} + {if $board->hasUpdatePermission() or $gBitUser->hasPermission('p_boards_post_update')} {* modcomments handles this *} - {if $thread.flc_user_id<0 && $thread.first_approved==0 && !$gBitSystem->isPackageActive('modcomments')} - - {booticon iname="fa-circle-plus" iexplain="Approve First Post"} + {if $thread.flc_user_id<0 and $thread.first_approved==0 and !$gBitSystem->isPackageActive('modcomments')} + + {booticon iname="icon-plus-sign" ipackage="icons" iexplain="Approve First Post" iforce="icon"} - - {booticon iname="fa-circle-minus" iexplain="Reject First Post"} + + {booticon iname="icon-minus-sign" ipackage="icons" iexplain="Reject First Post" iforce="icon"} {/if} - {if $thread.th_moved==0 && $board->hasAdminPermission()} + {if $thread.th_moved==0 and $board->hasAdminPermission()} {*smartlink ititle="Edit" ifile="edit.php" ibiticon="liberty/edit" board_id=$thread.board_id*} {booticon iname="fa-share" iexplain="Move Thread"} - {booticon iname="fa-trash" iexplain="Delete Thread"} + title="Move Thread">{booticon ipackage=icons iname="icon-share" iexplain="Move Thread" iforce="icon"} + {booticon iname="icon-trash" ipackage="icons" iexplain="Delete Thread" iforce="icon"} {/if} - {if $thread.th_moved==0 && $board->hasAdminPermission()} + {if $thread.th_moved==0 and $board->hasAdminPermission()} @@ -120,7 +122,7 @@ {foreachelse} - {tr}No topics have been posted.{/tr} + No topics have been posted. {/foreach} @@ -128,19 +130,19 @@ {if $board->hasAdminPermission()}
- +
{/if} {/form} @@ -149,7 +151,7 @@
-{if $gBitSystem->isFeatureActive('boards_post_anon_moderation') && $smarty.request.post_comment_request && !$gBitUser->isRegistered()} +{if $gBitSystem->isFeatureActive('boards_post_anon_moderation') and $smarty.request.post_comment_request and !$gBitUser->isRegistered()} {formfeedback warning="Your post will not be shown immediately it will have to be approved by a moderator"} {/if} diff --git a/templates/mailing_list.tpl b/templates/mailing_list.tpl old mode 100644 new mode 100755 index 983f280..1642be2 --- a/templates/mailing_list.tpl +++ b/templates/mailing_list.tpl @@ -2,7 +2,7 @@
-

{tr}Mailing List{/tr}: {$board->getDisplayLink()}

+

Mailing List: {$board->getDisplayLink()}

@@ -23,10 +23,10 @@ {formlabel label="Subscribe"} {forminput} {if mailman_findmember($board->getPreference('boards_mailing_list'),$gBitUser->getField('email'))} -

{tr}You are currently subscribed to the mailing list using the email:{/tr} {$gBitUser->getField('email')}

+

You are currently subscribed to the mailing list using the email: {$gBitUser->getField('email')}

{else} -

{tr}You are currently not subscribed to the mailing list.{/tr}

+

You are currently not subscribed to the mailing list.

{/if} {/forminput} @@ -45,7 +45,7 @@ {foreach from=$listMembers key=userId item=member}
  • {displayname email=$member} <{$member}>
  • {foreachelse} -
  • {tr}The group has no members.{/tr}
  • +
  • The group has no members.
  • {/foreach} {/jstab} @@ -67,7 +67,7 @@ {formlabel label="Mailing List Address" for="boardsync"} {forminput} - {if $boardsMailingList && $boardsMailingList != $gContent->getPreference('board_sync_list_address')} + {if $boardsMailingList and $boardsMailingList != $gContent->getPreference('board_sync_list_address')} {formfeedback warning="The Mailing List Address does not match the configured board mailing list."} {/if} {formhelp note="All messages posted to this email address will mirrored on the board. The 'Board Sync Inbox' email account must be subscribed to this list and receive the messages in its INBOX."} @@ -86,10 +86,10 @@ {formlabel label="Subscribe"} {forminput} {if mailman_findmember($board->getPreference('boards_mailing_list'),$boardSyncInbox)} -

    {$boardSyncInbox} {tr}is subscribed to{/tr} {$boardsMailingList}

    +

    {$boardSyncInbox} is subscribed to {$boardsMailingList}

    {else} -

    {$boardSyncInbox} {tr}is currently not subscribed to the mailing list.{/tr}

    +

    {$boardSyncInbox} is currently not subscribed to the mailing list.

    {/if} {/forminput} @@ -99,8 +99,8 @@
    {formlabel label="Board Sync" for="boardsync"} {forminput} - {tr}Board Sync is not available since the Board Sync master email box has not been configured.{/tr} {if !$gBitUser->isAdmin()}{tr}Check with your site administrator.{/tr}{/if} - {if $gBitUser->isAdmin()}{tr}See the global Board Settings for master email box configuration.{/tr}{/if} + Board Sync is not available since the Board Sync master email box has not been configured. {if !$gBitUser->isAdmin()}Check with your site administrator.{/if} + {if $gBitUser->isAdmin()}See the global Board Settings for master email box configuration.{/if} {/forminput}
    {/if} @@ -130,7 +130,7 @@ {/forminput}
    {else} - {if $gBitSystem->getConfig('server_mailman_bin') && $gBitSystem->getConfig('boards_sync_user') && $gBitSystem->getConfig('boards_sync_mail_server')} + {if $gBitSystem->getConfig('server_mailman_bin') and $gBitSystem->getConfig('boards_sync_user') and $gBitSystem->getConfig('boards_sync_mail_server')} {legend legend="Group Mailing List"}
    @@ -157,11 +157,11 @@ {if !$gBitSystem->getConfig('server_mailman_bin')} {formfeedback error="Mailman is not configured."} {/if} - {if !$gBitSystem->getConfig('boards_sync_user') || !$gBitSystem->getConfig('boards_sync_user')} + {if !$gBitSystem->getConfig('boards_sync_user') or !$gBitSystem->getConfig('boards_sync_user')} {formfeedback error="List to Board Sync is not configured."} {/if} {if $gBitUser->isAdmin()} - {tr}See Boards Administration{/tr} + See Boards Administration {/if} {/if} {/if} diff --git a/templates/menu_boards.tpl b/templates/menu_boards.tpl old mode 100644 new mode 100755 index 09ca341..d72de90 --- a/templates/menu_boards.tpl +++ b/templates/menu_boards.tpl @@ -1,12 +1,12 @@ {strip} -{if $packageMenuTitle} {tr}{$packageMenuTitle}{/tr} {/if} +{if !empty($packageMenuTitle)} {$packageMenuTitle} {/if} {/strip} diff --git a/templates/menu_boards_admin.tpl b/templates/menu_boards_admin.tpl old mode 100644 new mode 100755 index ec414ed..7826867 --- a/templates/menu_boards_admin.tpl +++ b/templates/menu_boards_admin.tpl @@ -1,2 +1,7 @@ -{tr}Boards{/tr} - +{strip} + +{/strip} \ No newline at end of file diff --git a/templates/post_display.tpl b/templates/post_display.tpl old mode 100644 new mode 100755 index aa87944..a5b95aa --- a/templates/post_display.tpl +++ b/templates/post_display.tpl @@ -1,5 +1,5 @@ {strip} -{if $comments_style eq 'threaded' && $comment.level} +{if $comments_style eq 'threaded' and $comment.level}
    {else}
    @@ -13,10 +13,10 @@ {else} {displayname hash=$comment}
    - {if $comment.user_id != $smarty.const.ANONYMOUS_USER_ID && !empty($comment.user_avatar_url)} -
    {tr}Profile Picture{/tr}
    + {if $comment.user_id != $smarty.const.ANONYMOUS_USER_ID and !empty($comment.user_avatar_url)} +
    Profile Picture
    {/if} -
    {tr}Joined: {/tr}{$comment.registration_date|bit_short_date}
    +
    Joined: {$comment.registration_date|bit_short_date}
    {/if}
    @@ -25,29 +25,31 @@
    {if !$post_is_preview}
    - {if $print_page ne 'y' && $comment.deleted==0 } - {if !$topic_locked && $board->hasPostCommentsPermission()} - {booticon iname="fa-comment" iexplain="Reply to this Post"} - {booticon iname="fa-comment-quote" iexplain="Reply with Quote to this Post"} + {if $print_page ne 'y' and $comment.deleted==0 } + {if !$topic_locked and $board->hasPostCommentsPermission()} + {booticon iname="icon-comment-alt" ipackage="icons" iexplain="Reply to this Post" iforce="icon"} {/if} - {if $comment.is_editable || $gContent->hasUserPermission('p_liberty_edit_comments')} - {booticon iname="fa-pen-to-square" iexplain="Edit"} + {if !$topic_locked and $board->hasPostCommentsPermission()} + {booticon ipackage="icons" iname="icon-comment" iexplain="Reply with Quote to this Post" iforce="icon"} + {/if} + {if $comment.is_editable or $gContent->hasUserPermission('p_liberty_edit_comments')} + {booticon iname="icon-edit" ipackage="icons" iexplain="Edit" iforce="icon"} {/if} {if $board->hasUserPermission( 'p_liberty_admin_comments' )} - {booticon iname="fa-trash" iexplain="Remove"} + {booticon iname="icon-trash" ipackage="icons" iexplain="Remove" iforce="icon"} {/if} - {if $board->hasUpdatePermission() && (($comment.user_id<0 && $comment.is_approved==0)||$comment.user_id>=0) && !$comment.is_warned} - {if $comment.user_id<0 && $comment.is_approved==0} - - {booticon iname="fa-circle-plus" iexplain="Approve Post"} + {if $board->hasUpdatePermission() and (($comment.user_id<0 and $comment.is_approved==0)or$comment.user_id>=0) and !$comment.is_warned} + {if $comment.user_id<0 and $comment.is_approved==0} + + {booticon iname="icon-plus-sign" ipackage="icons" iexplain="Approve Post" iforce="icon"} - - {booticon iname="fa-circle-minus" iexplain="Reject Post"} + + {booticon iname="icon-minus-sign" ipackage="icons" iexplain="Reject Post" iforce="icon"} - {elseif !$comment.is_warned && $comment.user_id>=0} - - {booticon iname="fa-triangle-exclamation" iexplain="Warn Post"} + {elseif !$comment.is_warned and $comment.user_id>=0} + + {booticon iname="icon-warning-sign" ipackage="icons" iexplain="Warn Post" iforce="icon"}