Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions check-eof.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
*
* @package SMF
* @author Simple Machines https://www.simplemachines.org
* @copyright 2022 Simple Machines and individual contributors
* @copyright 2025 Simple Machines and individual contributors
* @license https://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.1.0
* @version 3.0 Alpha 4
*/

// Stuff we will ignore.
Expand All @@ -18,9 +18,6 @@
'./tests/',
'./vendor/',
'./.git',
'./Sources/minify/',
'./Sources/ReCaptcha/',
'./ZxcvbnPhp/',

// We will ignore Settings.php if this is a live dev site.
'./Settings.php',
Expand Down Expand Up @@ -64,4 +61,4 @@
} catch (Exception $e) {
fwrite(STDERR, $e->getMessage() . "\n");
exit(1);
}
}
40 changes: 8 additions & 32 deletions check-smf-license.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,52 +5,28 @@
*
* @package SMF
* @author Simple Machines https://www.simplemachines.org
* @copyright 2024 Simple Machines and individual contributors
* @copyright 2025 Simple Machines and individual contributors
* @license https://www.simplemachines.org/about/smf/license.php BSD
*
* @version 3.0 Alpha 1
* @version 3.0 Alpha 4
*/

// Stuff we will ignore.
$ignoreFiles = [
// Index files.
'\./attachments/index\.php',
'\./avatars/index\.php',
'\./avatars/[A-Za-z0-9]+/index\.php',
'\./cache/index\.php',
'\./custom_avatar/index\.php',
'\./Packages/index\.php',
'\./Packages/backups/index\.php',
'\./Smileys/[A-Za-z0-9]+/index\.php',
'\./Smileys/index\.php',
'\./Sources/index\.php',
'\./Sources/[\w/]+/index\.php',
'\./other/Schema/[\w/]+/*\.php',
'\./Themes/default/index\.php',
'\./Themes/default/[\w/]+/index\.php',
'\./Themes/index\.php',
// Index files in subdirectories.
'\./(?:\w+/)+\bindex\.php',

// Language Files are ignored as they don't use the License format.
'./Themes/default/languages/[A-Za-z0-9]+\.english\.php',
'./Languages/en_US/[A-Za-z0-9]+\.php',
'./Themes/default/languages/en_US/[A-Za-z0-9]+\.php',
'\./Languages/index\.php',
'./Themes/default/languages/',
'\./Languages/',

// Cache and miscellaneous.
'\./cache/',
'\./other/db_last_error\.php',
'\./other/update_[A-Za-z0-9_]+\.php',
'\./tests/',
'\./vendor/',

// Minify Stuff.
'\./Sources/minify/',

// random_compat().
'\./Sources/random_compat/',

// ReCaptcha Stuff.
'\./Sources/ReCaptcha/',
// Everything in other except install.php, upgrade.php, Settings.php and Settings_bak.php.
'\./other/(?!install|upgrade|Settings)\w+\.php',

// We will ignore Settings.php if this is a live dev site.
'\./Settings\.php',
Expand Down
5 changes: 1 addition & 4 deletions runTools.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
#!/bin/bash

find . -type f -name "*.php" -print0 \
-o -path "./Sources/minify" -prune \
-o -path "./Sources/random_compat" -prune \
-o -path "./Sources/ReCaptcha" -prune \
| xargs -0 -n1 -P4 php -l \
| (! grep -v "No syntax errors detected" )

php check-signed-off.php
php check-eof.php
php check-smf-license.php
php check-smf-languages.php
php check-version.php
php check-version.php
34 changes: 34 additions & 0 deletions secure-vendor-dir.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

/**
* Simple Machines Forum (SMF)
*
* @package SMF
* @author Simple Machines https://www.simplemachines.org
* @copyright 2025 Simple Machines and individual contributors
* @license https://www.simplemachines.org/about/smf/license.php BSD
*
* @version 3.0 Alpha 4
*/

$dirs = ['./vendor'];

$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator(
'./vendor',
RecursiveDirectoryIterator::SKIP_DOTS | FilesystemIterator::UNIX_PATHS,
),
RecursiveIteratorIterator::SELF_FIRST
);

foreach ($iterator as $item) {
if ($item->isDir()) {
$dirs[] = $item->getPathname();
}
}

foreach ($dirs as $key => $dir) {
if (!file_exists($dir . '/index.php')) {
copy('./Sources/index.php', $dir . '/index.php');
}
}