Skip to content

Commit

Permalink
Merge branch 'SimpleMachines:release-2.1' into release-test
Browse files Browse the repository at this point in the history
  • Loading branch information
live627 committed Nov 14, 2022
2 parents 471cba7 + 4762d0c commit 5683113
Show file tree
Hide file tree
Showing 306 changed files with 47,593 additions and 7,061 deletions.
2 changes: 1 addition & 1 deletion .github/crowdin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ files: [
},
{
source: "Themes/default/languages/PersonalMessage.english.php",
translation: "%locale%/Themes/default/languages/PersonalMessages.%language%.php",
translation: "%locale%/Themes/default/languages/PersonalMessage.%language%.php",
},
{
source: "Themes/default/languages/Post.english.php",
Expand Down
21 changes: 12 additions & 9 deletions .github/workflows/crowdin_wf.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CrowdIn workflow for SMF

name: CrowdIn
name: CrowdIn - Update SMF_2-1 branch once per release

# Controls when the action will run.
on:
Expand All @@ -12,6 +12,12 @@ on:
types: [ published ]
branches: [ master ]

env:
# Use GitHub Secrets here, so sensitive stuff isn't in the publicly visible workflow
# Note that the CrowdIn API token will accept either a user's personal CrowdIn token
# or an "API" token, generated via the CrowdIn console client using the "crowdin init" command.
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_API_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }}
# Only one job, the crowdin sync
jobs:
crowdin-sync:
Expand All @@ -22,9 +28,13 @@ jobs:
steps:

- name: Checkout
# This prevents all the forks from attempting to run the interface...
if: env.CROWDIN_API_TOKEN != null
uses: actions/checkout@v2

- name: crowdin-action
# This prevents all the forks from attempting to run the interface...
if: env.CROWDIN_API_TOKEN != null
# You need to pin to a specific version for some reason...
uses: crowdin/github-action@1.0.19
with:
Expand All @@ -36,11 +46,4 @@ jobs:
# At the moment, it really does not like embedded spaces (2/2021)
crowdin_branch_name: 'SMF_2-1'
# Path to crowdin.yml, no leading /
config: .github/crowdin.yml

env:
# Use GitHub Secrets here, so sensitive stuff isn't in the publicly visible workflow
# Note that the CrowdIn API token will accept either a user's personal CrowdIn token
# or an "API" token, generated via the CrowdIn console client using the "crowdin init" command.
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_API_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }}
config: '.github/crowdin.yml'
53 changes: 53 additions & 0 deletions .github/workflows/crowdin_wf_next.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# CrowdIn workflow for SMF

name: CrowdIn NEXT - Update SMF_2-1_NEXT branch periodically

# Controls when the action will run.
on:
# Sundays, 7th minute, 7th hour
schedule:
- cron: "7 7 * * 0"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Auto pushes when a release is tagged
release:
types: [ published ]
branches: [ master ]

env:
# Use GitHub Secrets here, so sensitive stuff isn't in the publicly visible workflow
# Note that the CrowdIn API token will accept either a user's personal CrowdIn token
# or an "API" token, generated via the CrowdIn console client using the "crowdin init" command.
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_API_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }}
# Only one job, the crowdin sync
jobs:
crowdin-sync:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Checkout the source, then invoke the GitHub CrowdIn Action
steps:

- name: Checkout
# This prevents all the forks from attempting to run the interface...
if: env.CROWDIN_API_TOKEN != null
uses: actions/checkout@v2

- name: crowdin-action
# This prevents all the forks from attempting to run the interface...
if: env.CROWDIN_API_TOKEN != null
# You need to pin to a specific version for some reason...
uses: crowdin/github-action@1.0.19
with:
# Push sources (the english files) to CrowdIn; do not push translations (non-english) in either direction
upload_sources: true
upload_translations: false
download_translations: false
# The crowdin_branch_name is the name of the highest level folder in your "Files" tab in CrowdIn
# At the moment, it really does not like embedded spaces (2/2021)
crowdin_branch_name: 'SMF_2-1_NEXT'
# Path to crowdin.yml, no leading /
config: '.github/crowdin.yml'
38 changes: 38 additions & 0 deletions .github/workflows/label-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Label cleanup

on:
pull_request_target:
types:
- closed

jobs:
remove-label:
name: Cleanup after PR Triage
if: github.event.pull_request.merged
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v4
with:
script: |
const labels = [
'Work in progress',
'PR: draft',
'PR: unreviewed',
'PR: reviewed-changes-requested',
'PR: partially-approved',
'PR: reviewed-approved'
];
for (const label of labels)
try
{
await github.issues.removeLabel({
name: label,
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo
});
}
catch (e)
{
core.warning(`failed to remove label: ${label}: ${e.message}`);
}
38 changes: 33 additions & 5 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: PHP Check

on:
push:
branches:
- '*'
pull_request:
branches:
- release-2.1
pull_request:

jobs:
build:
Expand All @@ -23,7 +23,7 @@ jobs:

- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-dist --no-progress --no-suggest
run: composer install --prefer-dist --no-progress --ansi

- run: php -v

Expand All @@ -37,5 +37,33 @@ jobs:
php ./vendor/simplemachines/build-tools/check-smf-languages.php
php ./vendor/simplemachines/build-tools/check-version.php
lint:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1 ]

name: PHP ${{ matrix.php }} Syntax Check
steps:
- uses: actions/checkout@v2

- name: Setup PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-php-

- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-dist --no-progress --ansi

- name: Lint PHP files
run: vendor/bin/phplint . --exclude=vendor -w
run: vendor/bin/phplint -w --exclude .git --exclude vendor --ansi .
18 changes: 6 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# [SMF](https://www.simplemachines.org)
[![Build Status](https://travis-ci.org/SimpleMachines/SMF2.1.svg?branch=release-2.1)](https://travis-ci.org/SimpleMachines/SMF2.1)
![Build Status](https://github.com/SimpleMachines/SMF/actions/workflows/php.yml/badge.svg)
![CrowdIn Status](https://github.com/SimpleMachines/SMF/actions/workflows/crowdin_wf.yml/badge.svg)

This is a SMF 2.1 development repository.
This the development repository for Simple Machines Forum.
The software is licensed under [BSD 3-clause license](https://opensource.org/licenses/BSD-3-Clause).

Contributions to documentation are licensed under [CC-by-SA 3](https://creativecommons.org/licenses/by-sa/3.0). Third party libraries or sets of images are under their own licenses.
Expand All @@ -14,9 +15,7 @@ Please see the [Developer's Certificate of Origin](https://github.com/SimpleMach
by signing off your contributions, you acknowledge that you can and do license your submissions under the license of the project.

## Branches organization:
* ***master*** - is the main branch, only used to merge in a "final release"
* ***development*** - is the branch where the development of the "next" version/s happens
* ***release-2.1*** - is the branch where bug fixes for the version 2.1 are applied
* ***release-2.1*** - is the branch where updates for version 2.1 are applied

## How to contribute:
* fork the repository. If you are not used to Github, please check out [fork a repository](https://help.github.com/fork-a-repo).
Expand All @@ -27,16 +26,11 @@ by signing off your contributions, you acknowledge that you can and do license y
* send a pull request to us.

## How to submit a pull request:
* If you want to send a bug fix for the version 2.1, send it to the branch ***release-2.1***
* If you want to send a new feature, use the branch ***development***
* You should never send any pull request against the master branch
For more information, the ideal branching we would like to follow is the one described in [this article](http://nvie.com/posts/a-successful-git-branching-model/)

Please, feel free to play around. That's what we're doing. ;)
* If you want to send a bug fix for version 2.1, send it to the branch ***release-2.1***

## Security matters:

Lastly, if you have a security issue you would like to notify us about regarding SMF - not just for 2.1, but for any version -
please file a [security report](https://www.simplemachines.org/about/smf/security.php) on our website: https://www.simplemachines.org/about/smf/security.php

This will enable the team to review it and prepare patches as appropriate before exploits are widely known, which helps keep everyone safe.
This will enable the team to review it and prepare patches as appropriate before exploits are widely known, which helps keep everyone safe.
38 changes: 21 additions & 17 deletions SSI.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
*
* @package SMF
* @author Simple Machines https://www.simplemachines.org
* @copyright 2021 Simple Machines and individual contributors
* @copyright 2022 Simple Machines and individual contributors
* @license https://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.1 RC3
* @version 2.1.3
*/

// Don't do anything if SMF is already loaded.
if (defined('SMF'))
return true;

define('SMF', 'SSI');
define('SMF_VERSION', '2.1 RC3');
define('SMF_VERSION', '2.1.3');
define('SMF_FULL_VERSION', 'SMF ' . SMF_VERSION);
define('SMF_SOFTWARE_YEAR', '2021');
define('JQUERY_VERSION', '3.5.1');
define('SMF_SOFTWARE_YEAR', '2022');
define('JQUERY_VERSION', '3.6.0');
define('POSTGRE_TITLE', 'PostgreSQL');
define('MYSQL_TITLE', 'MySQL');
define('SMF_USER_AGENT', 'Mozilla/5.0 (' . php_uname('s') . ' ' . php_uname('m') . ') AppleWebKit/605.1.15 (KHTML, like Gecko) SMF/' . strtr(SMF_VERSION, ' ', '.'));
Expand All @@ -30,11 +30,11 @@

// We're going to want a few globals... these are all set later.
global $maintenance, $msubject, $mmessage, $mbname, $language;
global $boardurl, $boarddir, $sourcedir, $webmaster_email, $cookiename;
global $boardurl, $boarddir, $sourcedir, $webmaster_email, $cookiename, $db_character_set;
global $db_type, $db_server, $db_name, $db_user, $db_prefix, $db_persist, $db_error_send, $db_last_error, $db_show_debug;
global $db_connection, $db_port, $modSettings, $context, $sc, $user_info, $topic, $board, $txt;
global $smcFunc, $ssi_db_user, $scripturl, $ssi_db_passwd, $db_passwd, $cache_enable, $cachedir;
global $auth_secret;
global $auth_secret, $cache_accelerator, $cache_memcached;

if (!defined('TIME_START'))
define('TIME_START', microtime(true));
Expand Down Expand Up @@ -81,6 +81,10 @@
require_once($sourcedir . '/Class-BrowserDetect.php');
require_once($sourcedir . '/Subs-Auth.php');

// Ensure we don't trip over disabled internal functions
if (version_compare(PHP_VERSION, '8.0.0', '>='))
require_once($sourcedir . '/Subs-Compat.php');

// Create a variable to store some SMF specific functions in.
$smcFunc = array();

Expand Down Expand Up @@ -546,7 +550,7 @@ function ssi_queryPosts($query_where = '', $query_where_params = array(), $query
'preview' => $smcFunc['strlen']($preview) > 128 ? $smcFunc['substr']($preview, 0, 128) . '...' : $preview,
'body' => $row['body'],
'time' => timeformat($row['poster_time']),
'timestamp' => forum_time(true, $row['poster_time']),
'timestamp' => $row['poster_time'],
'href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . ';topicseen#new',
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'] . '" rel="nofollow">' . $row['subject'] . '</a>',
'new' => !empty($row['is_read']),
Expand Down Expand Up @@ -721,7 +725,7 @@ function ssi_recentTopics($num_recent = 8, $exclude_boards = null, $include_boar
'short_subject' => shorten_subject($row['subject'], 25),
'preview' => $row['body'],
'time' => timeformat($row['poster_time']),
'timestamp' => forum_time(true, $row['poster_time']),
'timestamp' => $row['poster_time'],
'href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . ';topicseen#new',
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#new" rel="nofollow">' . $row['subject'] . '</a>',
// Retained for compatibility - is technically incorrect!
Expand Down Expand Up @@ -1889,7 +1893,7 @@ function ssi_todaysBirthdays($output_method = 'echo')
'include_birthdays' => true,
'num_days_shown' => empty($modSettings['cal_days_for_index']) || $modSettings['cal_days_for_index'] < 1 ? 1 : $modSettings['cal_days_for_index'],
);
$return = cache_quick_get('calendar_index_offset_' . ($user_info['time_offset'] + $modSettings['time_offset']), 'Subs-Calendar.php', 'cache_getRecentEvents', array($eventOptions));
$return = cache_quick_get('calendar_index_offset_' . $user_info['time_offset'], 'Subs-Calendar.php', 'cache_getRecentEvents', array($eventOptions));

// The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary
call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions));
Expand Down Expand Up @@ -1919,7 +1923,7 @@ function ssi_todaysHolidays($output_method = 'echo')
'include_holidays' => true,
'num_days_shown' => empty($modSettings['cal_days_for_index']) || $modSettings['cal_days_for_index'] < 1 ? 1 : $modSettings['cal_days_for_index'],
);
$return = cache_quick_get('calendar_index_offset_' . ($user_info['time_offset'] + $modSettings['time_offset']), 'Subs-Calendar.php', 'cache_getRecentEvents', array($eventOptions));
$return = cache_quick_get('calendar_index_offset_' . $user_info['time_offset'], 'Subs-Calendar.php', 'cache_getRecentEvents', array($eventOptions));

// The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary
call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions));
Expand Down Expand Up @@ -1948,7 +1952,7 @@ function ssi_todaysEvents($output_method = 'echo')
'include_events' => true,
'num_days_shown' => empty($modSettings['cal_days_for_index']) || $modSettings['cal_days_for_index'] < 1 ? 1 : $modSettings['cal_days_for_index'],
);
$return = cache_quick_get('calendar_index_offset_' . ($user_info['time_offset'] + $modSettings['time_offset']), 'Subs-Calendar.php', 'cache_getRecentEvents', array($eventOptions));
$return = cache_quick_get('calendar_index_offset_' . $user_info['time_offset'], 'Subs-Calendar.php', 'cache_getRecentEvents', array($eventOptions));

// The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary
call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions));
Expand Down Expand Up @@ -1985,7 +1989,7 @@ function ssi_todaysCalendar($output_method = 'echo')
'include_events' => true,
'num_days_shown' => empty($modSettings['cal_days_for_index']) || $modSettings['cal_days_for_index'] < 1 ? 1 : $modSettings['cal_days_for_index'],
);
$return = cache_quick_get('calendar_index_offset_' . ($user_info['time_offset'] + $modSettings['time_offset']), 'Subs-Calendar.php', 'cache_getRecentEvents', array($eventOptions));
$return = cache_quick_get('calendar_index_offset_' . $user_info['time_offset'], 'Subs-Calendar.php', 'cache_getRecentEvents', array($eventOptions));

// The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary
call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions));
Expand Down Expand Up @@ -2173,7 +2177,7 @@ function ssi_boardNews($board = null, $limit = null, $start = null, $length = nu
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.png" alt="' . $row['icon'] . '">',
'subject' => $row['subject'],
'time' => timeformat($row['poster_time']),
'timestamp' => forum_time(true, $row['poster_time']),
'timestamp' => $row['poster_time'],
'body' => $row['body'],
'href' => $scripturl . '?topic=' . $row['id_topic'] . '.0',
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $row['num_replies'] . ' ' . ($row['num_replies'] == 1 ? $txt['ssi_comment'] : $txt['ssi_comments']) . '</a>',
Expand Down Expand Up @@ -2293,7 +2297,7 @@ function ssi_recentEvents($max_events = 7, $output_method = 'echo')
ORDER BY cal.start_date DESC
LIMIT ' . $max_events,
array(
'current_date' => strftime('%Y-%m-%d', forum_time(false)),
'current_date' => smf_strftime('%Y-%m-%d', time()),
'no_board' => 0,
)
);
Expand All @@ -2308,8 +2312,8 @@ function ssi_recentEvents($max_events = 7, $output_method = 'echo')
// Censor the title.
censorText($row['title']);

if ($row['start_date'] < strftime('%Y-%m-%d', forum_time(false)))
$date = strftime('%Y-%m-%d', forum_time(false));
if ($row['start_date'] < smf_strftime('%Y-%m-%d', time()))
$date = smf_strftime('%Y-%m-%d', time());
else
$date = $row['start_date'];

Expand Down
4 changes: 2 additions & 2 deletions Sources/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
*
* @package SMF
* @author Simple Machines https://www.simplemachines.org
* @copyright 2021 Simple Machines and individual contributors
* @copyright 2022 Simple Machines and individual contributors
* @license https://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.1 RC3
* @version 2.1.0
*/

if (!defined('SMF'))
Expand Down
Loading

0 comments on commit 5683113

Please sign in to comment.