diff options
| author | Lester Caine <lester@lsces.co.uk> | 2026-05-14 09:49:08 +0100 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2026-05-14 09:49:08 +0100 |
| commit | ef793a806a8d5a479c29c061780c56f62c4d3535 (patch) | |
| tree | dabe63be7a0cf383196bccfeb8743310e1d28fba /admin | |
| parent | 39508ee5ad8908fa720db48fcf7923f309fdce9d (diff) | |
| download | boards-ef793a806a8d5a479c29c061780c56f62c4d3535.tar.gz boards-ef793a806a8d5a479c29c061780c56f62c4d3535.tar.bz2 boards-ef793a806a8d5a479c29c061780c56f62c4d3535.zip | |
php-cs-fixer tidies to php8.5 standards
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'admin')
| -rwxr-xr-x | admin/admin_boards_inc.php | 6 | ||||
| -rwxr-xr-x | admin/boardsync_inc.php | 157 | ||||
| -rwxr-xr-x | admin/phpbb_migrate.php | 1 | ||||
| -rwxr-xr-x | admin/schema_inc.php | 14 | ||||
| -rw-r--r-- | admin/update_lists.php | 4 | ||||
| -rwxr-xr-x | admin/upgrades/1.0.1.php | 43 |
6 files changed, 110 insertions, 115 deletions
diff --git a/admin/admin_boards_inc.php b/admin/admin_boards_inc.php index 3ece564..52be909 100755 --- a/admin/admin_boards_inc.php +++ b/admin/admin_boards_inc.php @@ -10,7 +10,9 @@ // $gBitSmarty->assign('home_bitboard', $_REQUEST["homeBitBoards"]); //} -namespace Bitweaver\Boards;; +namespace Bitweaver\Boards; + +; $formBitBoardsLists = [ 'boards_thread_track' => [ @@ -74,7 +76,7 @@ if( $processForm ) { foreach( $formBoardsEmailText as $text ) { $gBitSystem->storeConfig( $text, !empty( $_REQUEST[$text] ) ? trim( $_REQUEST[$text] ) : null, BOARDS_PKG_NAME ); } - + } $board = new BitBoard(); diff --git a/admin/boardsync_inc.php b/admin/boardsync_inc.php index 86b521a..4149f8b 100755 --- a/admin/boardsync_inc.php +++ b/admin/boardsync_inc.php @@ -5,12 +5,12 @@ function board_sync_run($pLog = false) { $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}'; - + // Can we open the mailbox? if( $mbox = imap_open( $connectionString, $gBitSystem->getConfig( 'boards_sync_user' ), $gBitSystem->getConfig( 'boards_sync_password' ) ) ) { $MC = imap_check($mbox); - + // Fetch an overview for all messages in INBOX of mailbox has messages if( $MC->Nmsgs ) { // print($MC->Nmsgs); @@ -20,7 +20,7 @@ function board_sync_run($pLog = false) { if ($pLog) print "Processing Msg#: ".$msgNum."\n"; $deleteMsg = false; $header = imap_headerinfo( $mbox, $msgNum ); - + // Is this a moderation message? if( preg_match('/.*? post from .*? requires approval/', $header->subject) ) { if ($pLog) print "Is Moderation Request.\n"; @@ -80,7 +80,7 @@ function board_sync_run($pLog = false) { } } } - + // final cleanup imap_expunge( $mbox ); imap_close( $mbox ); @@ -91,17 +91,17 @@ function board_sync_run($pLog = false) { bit_error_log( "Failed to clear directory: ".$dir." in boards package mailinglist synchronization." ); } } - + } else { bit_error_log( __FILE__." failed imap_open $connectionString ".imap_last_error() ); } - + } function board_parse_msg_parts( &$pPartHash, $pMbox, $pMsgId, $pMsgPart, $pPartNum, $pLog ) { - //fetch part - $part=imap_fetchbody( $pMbox, $pMsgId, $pPartNum); + //fetch part + $part=imap_fetchbody( $pMbox, $pMsgId, $pPartNum); switch( $pMsgPart->encoding ) { case '3': // BASE64 $part = base64_decode($part); @@ -127,8 +127,8 @@ function board_parse_msg_parts( &$pPartHash, $pMbox, $pMsgId, $pMsgPart, $pPartN // Note: alternatively one might run a check to make sure the text is really utf-8, regardless of the header // use strtolower on the attributes since different php installs do not reconcile casing consistantly if( strtolower( $params->attribute ) == 'charset' && strtolower( $params->value ) != 'utf-8' ){ - if ($pLog) print( "Msg part ".$pPartNum." charset: ".$params->value."\n" ); - $part = @iconv($params->value, 'UTF-8', $part ); + if ($pLog) print( "Msg part ".$pPartNum." charset: ".$params->value."\n" ); + $part = @iconv($params->value, 'UTF-8', $part ); } } } @@ -140,7 +140,7 @@ function board_parse_msg_parts( &$pPartHash, $pMbox, $pMsgId, $pMsgPart, $pPartN if( !preg_match( '/signature/i', $pMsgPart->subtype ) ) { //get filename of attachment if present $filename=''; - foreach( array( 'dparameters', 'parameters' ) as $prm ) { + foreach( [ 'dparameters', 'parameters' ] as $prm ) { if( empty( $filename ) ) { // if there are any dparameters present in this part if( !empty($pMsgPart->$prm) && count( $pMsgPart->$prm ) > 0 ){ @@ -165,12 +165,12 @@ function board_parse_msg_parts( &$pPartHash, $pMbox, $pMsgId, $pMsgPart, $pPartN } } break; - - } - - //if subparts... recurse into function and parse them too! - if( !empty( $pMsgPart->parts ) ){ - foreach ($pMsgPart->parts as $pno=>$parr){ + + } + + //if subparts... recurse into function and parse them too! + if( !empty( $pMsgPart->parts ) ){ + foreach ($pMsgPart->parts as $pno=>$parr){ board_parse_msg_parts( $pPartHash, $pMbox, $pMsgId, $parr, ( $pPartNum.'.'.( $pno + 1 ) ), $pLog); } } @@ -181,25 +181,25 @@ function board_sync_get_user( $pFrom ) { if( preg_match_all('/[^<\s]+@[^>\s]+/', $pFrom, $matches) ) { foreach( $matches[0] as $email ) { - $ret = $gBitUser->getUserInfo( array( 'email'=>$email ) ); + $ret = $gBitUser->getUserInfo( [ 'email'=>$email ] ); if( !empty($ret) ) { return $ret; } } } - return $gBitUser->getUserInfo( array( 'user_id'=>-1 ) ); + return $gBitUser->getUserInfo( [ 'user_id'=>-1 ] ); } function cache_check_content_prefs( $pName, $pValue, $pLower = false ) { global $gBitDb, $gBitSystem; static $prefs; - if( empty($prefs[$pLower][$pName]) ) { - $bindVars = array( $pName ); + if( empty($prefs[$pLower][$pName]) ) { + $bindVars = [ $pName ]; $prefs[$pLower][$pName] = $gBitDb->getAssoc( "SELECT " . - ($pLower ? 'LOWER(`pref_value`)' : '`pref_value`'). - ", `content_id` FROM `".BIT_DB_PREFIX."liberty_content_prefs` WHERE `pref_name`=?", $bindVars ); + ($pLower ? 'LOWER(`pref_value`)' : '`pref_value`'). + ", `content_id` FROM `".BIT_DB_PREFIX."liberty_content_prefs` WHERE `pref_name`=?", $bindVars, ); } if( !empty($prefs[$pLower][$pName][$pValue]) ) { @@ -221,7 +221,7 @@ function board_sync_process_message( $pMbox, $pMsgNum, $pMsgHeader, $pMsgStructu // @TODO comment or clean up, not sure why this is here -wjames5 if( empty($message_id) ) { $message_id = board_sync_get_headerinfo( $pMsgHeader, 'message_id' ); - } + } $subject = board_sync_get_headerinfo( $pMsgHeader, 'Subject' ); if( empty( $message_id ) ){ @@ -230,7 +230,6 @@ function board_sync_process_message( $pMbox, $pMsgNum, $pMsgHeader, $pMsgStructu if ($pLog) print("Processing: ".$message_id."\n"); if ($pLog) print(" Subject: ".$subject."\n"); - $matches = []; $toAddresses = []; $allRecipients = ""; @@ -243,7 +242,7 @@ function board_sync_process_message( $pMbox, $pMsgNum, $pMsgHeader, $pMsgStructu $allRecipients .= (( $allRecipients != "" )?",":"") . $pMsgHeader->ccaddress; if ($pLog) print (" CC addresses: " . $pMsgHeader->ccaddress . "\n"); } - + if ($pLog) print (" All Recipients: ". $allRecipients ."\n"); $allSplit = split( ',', $allRecipients ); foreach( $allSplit as $s ) { @@ -251,21 +250,21 @@ function board_sync_process_message( $pMbox, $pMsgNum, $pMsgHeader, $pMsgStructu $matches = []; if( strpos( $s, '<' ) !== false ) { if( preg_match( "/\s*(.*)\s*<\s*(.*)\s*>/", $s, $matches ) ) { - $toAddresses[] = array( 'name'=>$matches[1], 'email'=>$matches[2] ); + $toAddresses[] = [ 'name'=>$matches[1], 'email'=>$matches[2] ]; } elseif( preg_match('/<\s*(.*)\s*>\s*(.*)\s*/', $s, $matches) ) { - $toAddresses[] = array( 'email'=>$matches[1], 'name'=>$matches[2] ); + $toAddresses[] = [ 'email'=>$matches[1], 'name'=>$matches[2] ]; } } elseif( validate_email_syntax( $s ) ) { - $toAddresses[] = array( 'email'=>$s ); + $toAddresses[] = [ 'email'=>$s ]; } } } else { foreach ($pDeliveredTo as $address) { - $toAddresses[] = array('email' => $address); + $toAddresses[] = ['email' => $address]; } } if ($pLog) print_r($toAddresses); - + $date = board_sync_get_headerinfo($pMsgHeader, 'Date'); $from = board_sync_get_headerinfo($pMsgHeader, 'from'); $fromaddress = $from[0]->mailbox."@".$from[0]->host; @@ -289,11 +288,11 @@ function board_sync_process_message( $pMbox, $pMsgNum, $pMsgHeader, $pMsgStructu $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 ) ); + $contentId = $gBitDb->getOne( $sql, [ $message_id, $boardContentId ] ); } if( empty($contentId) ) { if( !empty( $in_reply_to ) ) { - if( $parent = $gBitDb->GetRow( "SELECT `content_id`, `root_id` FROM `".BIT_DB_PREFIX."liberty_comments` WHERE `message_guid`=?", array( $in_reply_to ) ) ) { + if( $parent = $gBitDb->GetRow( "SELECT `content_id`, `root_id` FROM `".BIT_DB_PREFIX."liberty_comments` WHERE `message_guid`=?", [ $in_reply_to ] ) ) { $replyId = $parent['content_id']; $rootId = $parent['root_id']; } else { @@ -302,7 +301,7 @@ function board_sync_process_message( $pMbox, $pMsgNum, $pMsgHeader, $pMsgStructu $rootId = $boardContentId; } // if no reply to message guid then match on title - this looks dangerous as titles could easily be duplicated -wjames - } elseif( $parent = $gBitDb->GetRow( "SELECT lcom.`content_id`, lcom.`root_id` FROM `".BIT_DB_PREFIX."liberty_comments` lcom INNER JOIN `".BIT_DB_PREFIX."liberty_content` lc ON(lcom.`content_id`=lc.`content_id`) WHERE lc.`title`=?", array( preg_replace( '/re: /i', '', $subject ) ) ) ) { + } elseif( $parent = $gBitDb->GetRow( "SELECT lcom.`content_id`, lcom.`root_id` FROM `".BIT_DB_PREFIX."liberty_comments` lcom INNER JOIN `".BIT_DB_PREFIX."liberty_content` lc ON(lcom.`content_id`=lc.`content_id`) WHERE lc.`title`=?", [ preg_replace( '/re: /i', '', $subject ) ] ) ) { $replyId = $parent['content_id']; $rootId = $parent['root_id']; // attach to board as first level comment e.g. new topic @@ -324,9 +323,9 @@ function board_sync_process_message( $pMbox, $pMsgNum, $pMsgHeader, $pMsgStructu } $storeRow['root_id'] = $rootId; $storeRow['parent_id'] = $replyId; - + $partHash = []; - + switch( $pMsgStructure->type ) { case '0': if ($pLog) print( "Structure Type: text\n" ); @@ -347,7 +346,7 @@ function board_sync_process_message( $pMbox, $pMsgNum, $pMsgHeader, $pMsgStructu } $plainBody = ""; $htmlBody = ""; - + foreach( array_keys( $partHash ) as $i ) { if( !empty( $partHash[$i]['plain'] ) ) { $plainBody .= $partHash[$i]['plain']; @@ -356,15 +355,15 @@ function board_sync_process_message( $pMbox, $pMsgNum, $pMsgHeader, $pMsgStructu $htmlBody .= $partHash[$i]['html']; } if( !empty( $partHash[$i]['attachment'] ) ) { - $storeRow['_files_override'][] = array( - 'tmp_name'=> $partHash[$i]['attachment'], - 'type'=>$gBitSystem->verifyMimeType( $partHash[$i]['attachment'] ), - 'size'=>filesize( $partHash[$i]['attachment'] ), - 'name'=>basename( $partHash[$i]['attachment'] ), - 'user_id'=>$userInfo['user_id'] ); + $storeRow['_files_override'][] = [ + 'tmp_name'=> $partHash[$i]['attachment'], + 'type'=>$gBitSystem->verifyMimeType( $partHash[$i]['attachment'] ), + 'size'=>filesize( $partHash[$i]['attachment'] ), + 'name'=>basename( $partHash[$i]['attachment'] ), + 'user_id'=>$userInfo['user_id'], ]; } } - + if( !empty( $htmlBody ) ) { $storeRow['edit'] = $htmlBody; $storeRow['format_guid'] = 'bithtml'; @@ -372,33 +371,32 @@ function board_sync_process_message( $pMbox, $pMsgNum, $pMsgHeader, $pMsgStructu $storeRow['edit'] = nl2br( $plainBody ); $storeRow['format_guid'] = 'bithtml'; } - + // Nuke all email addresses from the body. if( !empty($storeRow['edit']) ) { $storeRow['edit'] = ereg_replace( '[-!#$%&\`*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'. '(localhost|[-!$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'. - '[-!$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+)', '', $storeRow['edit'] ); + '[-!$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+)', '', $storeRow['edit'], ); } - + // We trust the user from this source // and count on moderation to handle links global $gBitUser; $gBitUser->setPermissionOverride('p_liberty_trusted_editor', true); - - // Check to add attachments - + // Check to add attachments + // NOTE: we temporarily change the gBitUser here! // This is so we can run a proper content permissions check // for attachment permission against the parent - // board object. This is sort of a hack to deal + // board object. This is sort of a hack to deal // with the fact that LibertyContent does not have a // means to check the permissions of any user except gBitUser -wjames5 - + // Important store a reference so we can switch back when we are done $gBitUserOrg = $gBitUser; - + // Load the message sending user if( $userInfo['user_id'] != ANONYMOUS_USER_ID ) { $userClass = $gBitSystem->getConfig( 'user_class', 'BitPermUser' ); @@ -409,25 +407,25 @@ function board_sync_process_message( $pMbox, $pMsgNum, $pMsgHeader, $pMsgStructu // flip gBitUser to our message sender $gBitUser = $newBitUser; } - + // Load the parent board $board = new BitBoard( null, $boardContentId ); $board->load(); - + // Check the permission for the user on the board - if( $gBitSystem->isFeatureActive( 'comments_allow_attachments' ) && $board->hasUserPermission( 'p_liberty_attach_attachments' ) ){ + if( $gBitSystem->isFeatureActive( 'comments_allow_attachments' ) && $board->hasUserPermission( 'p_liberty_attach_attachments' ) ){ // note we grant the permission to the anonymous user which will become gBitUser once again $gBitUserOrg->setPermissionOverride('p_liberty_attach_attachments', true); }; - + // Clear the reference to this board so we dont mistakenly use it later unset( $board ); - + // Important: switch gBitUser back! $gBitUser = $gBitUserOrg; - + // End check to add attachments to comments to the parent board - + // Check for an empty body // Duplicate subject if we have it if (empty($storeRow['edit'])) { @@ -438,14 +436,13 @@ function board_sync_process_message( $pMbox, $pMsgNum, $pMsgHeader, $pMsgStructu $storeRow['edit'] = "."; } } - - + $storeComment = new LibertyComment( null ); $gBitDb->StartTrans(); if( $storeComment->storeComment($storeRow) ) { // undo the attachment permission $gBitUser->setPermissionOverride('p_liberty_attach_attachments', false); - + // set moderation approval if( !$pModerate && $gBitSystem->isPackageActive('moderation') && $gBitSystem->isPackageActive('modcomments') ) { global $gModerationSystem, $gBitUser; @@ -457,37 +454,35 @@ function board_sync_process_message( $pMbox, $pMsgNum, $pMsgHeader, $pMsgStructu $gBitUser->setPermissionOverride('p_admin', false); } } - + if( !empty( $storeRow['message_guid'] ) ){ // map the message guid to the comment - $storeComment->mDb->query( "UPDATE `".BIT_DB_PREFIX."liberty_comments` SET `message_guid`=? WHERE `content_id`=?", array( $storeRow['message_guid'], $storeComment->mContentId ) ); - + $storeComment->mDb->query( "UPDATE `".BIT_DB_PREFIX."liberty_comments` SET `message_guid`=? WHERE `content_id`=?", [ $storeRow['message_guid'], $storeComment->mContentId ] ); + // Store the confirm code if( $pModerate ) { $storeComment->storePreference('board_confirm_code', $pModerate); } - + // done $gBitDb->CompleteTrans(); 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; - } - } else { + + } if( count( $storeComment->mErrors ) == 1 && !empty( $storeComment->mErrors['store'] ) && $storeComment->mErrors['store'] == 'Duplicate comment.' ) { return true; - } else { + } foreach( $storeComment->mErrors as $error ){ bit_error_log( $error ); } $gBitDb->RollbackTrans(); return false; - } - } - } else { + } if ($pLog) print "Message Exists: $contentId : $boardContentId : $message_id : $pModerate\n"; // If this isn't a moderation message if( $pModerate === false ) { @@ -520,10 +515,10 @@ function board_sync_process_message( $pMbox, $pMsgNum, $pMsgHeader, $pMsgStructu $storeComment->storePreference('board_confirm_code', $pModerate); } return true; - } - } else { - if ($pLog) print "No Board match found for $to[email]\n"; + } + if ($pLog) print "No Board match found for $to[email]\n"; + } } return false; @@ -554,8 +549,8 @@ function board_sync_get_headerinfo( $header, $key ){ function board_sync_delivered_to( $raw_headers ) { $ret = null; - if (isset($raw_headers) && - preg_match_all("/Delivered-To:\s*(.*)\s*/", $raw_headers, $deliveredTo) > 0) { + if (isset($raw_headers) && + preg_match_all("/Delivered-To:\s*(.*)\s*/", $raw_headers, $deliveredTo) > 0) { $ret = []; foreach ($deliveredTo[1] as $address) { // Make sure the Delivered-To: address is valid. @@ -568,8 +563,8 @@ function board_sync_delivered_to( $raw_headers ) { } function is_utf8($string) { - // From http://w3.org/International/questions/qa-forms-utf-8.html - return preg_match('%^(?: + // From http://w3.org/International/questions/qa-forms-utf-8.html + return preg_match('%^(?: [\x09\x0A\x0D\x20-\x7E] # ASCII | [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs diff --git a/admin/phpbb_migrate.php b/admin/phpbb_migrate.php index c787780..1a5c0e5 100755 --- a/admin/phpbb_migrate.php +++ b/admin/phpbb_migrate.php @@ -58,7 +58,6 @@ function migrate_phpbb() { die; } - $gBitDb->StartTrans(); if( $forumList = $gBitDb->getAssoc( "SELECT `forum_id`,`forum_name`, `forum_desc`,`content_id` FROM " . FORUMS_TABLE . " bbf LEFT JOIN `".BIT_DB_PREFIX."liberty_content` lc ON (lc.`content_type_guid`='bitboard' AND bbf.`forum_name`=lc.`title`) ORDER BY bbf.forum_id" ) ) { vd( $forumList ); flush(); diff --git a/admin/schema_inc.php b/admin/schema_inc.php index be6958a..25dd6cf 100755 --- a/admin/schema_inc.php +++ b/admin/schema_inc.php @@ -1,5 +1,5 @@ <?php -$tables = [ +$tables = [ 'boards_posts' => " comment_id I4 PRIMARY, is_approved I1 NOTNULL DEFAULT(0), @@ -19,7 +19,7 @@ $tables = [ 'boards_sections' => " section_id I4 PRIMARY, section_title C(255) - ", + ", 'boards' => " board_id I4 PRIMARY, content_id I4 NOTNULL, @@ -41,7 +41,7 @@ $tables = [ track_date I4 NOTNULL DEFAULT(0), notify I1 NOTNULL DEFAULT(0), notify_date I4 NOTNULL DEFAULT(0) - " + ", ]; global $gBitInstaller; @@ -79,21 +79,21 @@ $gBitInstaller->registerUserPermissions( BOARDS_PKG_NAME, [ ] ); // ### Default Preferences -$gBitInstaller->registerPreferences( BOARDS_PKG_NAME, [ +$gBitInstaller->registerPreferences( BOARDS_PKG_NAME, [ [ BOARDS_PKG_NAME, 'boards_thread_track', 'y' ], ] ); if(defined('RSS_PKG_NAME')) { - $gBitInstaller->registerPreferences( BOARDS_PKG_NAME, [ + $gBitInstaller->registerPreferences( BOARDS_PKG_NAME, [ [ RSS_PKG_NAME, BOARDS_PKG_NAME.'_rss', 'y'], ] ); } // ### Register content types -$gBitInstaller->registerContentObjects( BOARDS_PKG_NAME, [ +$gBitInstaller->registerContentObjects( BOARDS_PKG_NAME, [ 'BitBoard'=>BOARDS_PKG_CLASS_PATH.'BitBoard.php', ] ); // Requirements -$gBitInstaller->registerRequirements( BOARDS_PKG_NAME, [ +$gBitInstaller->registerRequirements( BOARDS_PKG_NAME, [ 'liberty' => [ 'min' => '5.0.0' ], ] ); diff --git a/admin/update_lists.php b/admin/update_lists.php index 195fcc7..86ce546 100644 --- a/admin/update_lists.php +++ b/admin/update_lists.php @@ -24,11 +24,11 @@ if( !$gBitUser->isAdmin() ){ if( !empty( $_REQUEST['update'] ) ) { // get all mailman lists $query = "SELECT pref_value AS listname FROM `".BIT_DB_PREFIX."liberty_content_prefs` lcp WHERE lcp.`pref_name` = ?"; - $lists = $gBitSystem->mDb->getArray( $query, array('boards_mailing_list') ); + $lists = $gBitSystem->mDb->getArray( $query, ['boards_mailing_list'] ); foreach( $lists as $list ){ // update list configuration - if( $error = mailman_config_list( array( 'listname' => $list['listname'] ) ) ) { + if( $error = mailman_config_list( [ 'listname' => $list['listname'] ] ) ) { echo $error."<br />"; }else{ echo "List: ".$list['listname']." has been updated.<br />"; diff --git a/admin/upgrades/1.0.1.php b/admin/upgrades/1.0.1.php index 6eef1b9..85c9d36 100755 --- a/admin/upgrades/1.0.1.php +++ b/admin/upgrades/1.0.1.php @@ -4,36 +4,36 @@ */ global $gBitInstaller; -$infoHash = array( +$infoHash = [ 'package' => BOARDS_PKG_NAME, 'version' => str_replace( '.php', '', basename( __FILE__ )), 'description' => "Add boards sections and positioning.", 'post_upgrade' => null, -); -$gBitInstaller->registerPackageUpgrade( $infoHash, array( +]; +$gBitInstaller->registerPackageUpgrade( $infoHash, [ -array( 'DATADICT' => array( - array( 'CREATE' => array( +[ 'DATADICT' => [ + [ 'CREATE' => [ 'boards_sections' => " section_id I4 PRIMARY, section_title C(255) - ", - )), + ", + ]], // insert new column - array( 'ALTER' => array( - 'boards' => array( - 'section_id' => array( '`section_id`', 'I4' ), - 'pos' => array( '`pos`', 'I4' ), - ))), - array( 'CREATEINDEX' => array( - 'boards_sections_idx' => array( 'boards', 'section_id', [] ), - )), - array( 'CREATESEQUENCE' => array( + [ 'ALTER' => [ + 'boards' => [ + 'section_id' => [ '`section_id`', 'I4' ], + 'pos' => [ '`pos`', 'I4' ], + ], ]], + [ 'CREATEINDEX' => [ + 'boards_sections_idx' => [ 'boards', 'section_id', [] ], + ]], + [ 'CREATESEQUENCE' => [ 'boards_sections_id_seq', - )), -)), + ]], +]], -array( 'PHP' => ' +[ 'PHP' => ' // Is package installed and enabled global $gBitSystem; @@ -88,8 +88,7 @@ while( $topic = $map_errors->fetchRow() ) { } $oTopic->CompleteTrans(); -' ), +' ], - -)); +]); ?> |
