-
Notifications
You must be signed in to change notification settings - Fork 32
feat:2.0 composer integration #1683
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
fiammybe
wants to merge
33
commits into
ImpressCMS:develop
Choose a base branch
from
fiammybe:2.0-composer-integration
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,764
−71,048
Open
Changes from 22 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
cef288c
feat: initial working integration of composer
fiammybe d5a2e71
feat: initial get list of uninstalled composer packages
fiammybe 0983059
feat:SimplePie upgrade to 1.8.1 using composer now
fiammybe 111c81e
feat:move htmlpurify to use the composer lib. Doesn't give errors, bu…
fiammybe ccc6eef
fix:update php requirements to 7.4
fiammybe e01274b
Replace icms Autoloader with the composer one
fiammybe b9e2bf0
update composer.json
fiammybe 0fee111
fix: require composer autoload in installer
fiammybe a6e1616
Merge remote-tracking branch 'upstream/2.0.x' into 2.0-composer-integ…
fiammybe a199444
fix: the theme block can be empty, resulting in a fatal error in PHP …
fiammybe c300c73
restored the working code. The include was assuming autoloading via C…
fiammybe 1c3506f
Removed included HTMLPurifier and replaced it with composer variant
fiammybe 519c86a
make getThemesList return always an array
fiammybe 061e876
add simplepie via composer, remove included version
fiammybe 41129f3
add WideImage via composer, remove included version
fiammybe c9af922
revert to original modulesadmin.php
fiammybe 4d8f83b
Update htdocs/composer.json to be les explicit
fiammybe 77908f2
update composer.json: refine authors section, update license, remove …
fiammybe f2b4151
fix: close the scripts section in the composer.json
fiammybe da42fec
removed the license entry until we are certain how to fill it in. Better
fiammybe 7f24acd
Move vendor folder as part of the installer, and make the site work with
fiammybe 24683bf
Move the vendor folder on system module update for existing sites
fiammybe dfee61a
verify the $_autoload path before using it
fiammybe 9f9d414
use strict comparisons in common.php
fiammybe 0b42b51
Use strict comparison for directory entries
fiammybe e6baa7f
Improve copy validation and file counting
fiammybe 7b9c1aa
rolling back unfinished change
fiammybe 0ef2c1b
fix:correct SimplePie class case
fiammybe 864fa81
Modernize Versionchecker style and SimplePie fix
fiammybe b0330aa
Make baseLocation handle missing server variables
fiammybe 2d9ac28
Validate multi_login and guard REMOTE_ADDR
fiammybe 1d21159
Log missing REMOTE_ADDR in online presence
fiammybe cd432fc
Follow symlinks when iterating directories
fiammybe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| { | ||
| "name": "impresscms/impresscms", | ||
| "description": "ImpressCMS - A dynamic and user-friendly Content Management System", | ||
| "type": "project", | ||
| "keywords": [ | ||
| "cms", | ||
| "content-management", | ||
| "php", | ||
| "mysql", | ||
| "web" | ||
| ], | ||
| "homepage": "https://www.impresscms.org/", | ||
| "authors": [ | ||
| { | ||
| "name": "Marc-André Lanciault", | ||
| "homepage": "https://www.impresscms.org/userinfo.php?uid=168", | ||
| "role": "Developer" | ||
| }, | ||
| { | ||
| "name": "Steve Kenow", | ||
| "homepage": "https://www.impresscms.org/userinfo.php?uid=54", | ||
| "role": "Developer" | ||
| }, | ||
| { | ||
| "name": "David Janssens", | ||
| "homepage": "https://www.impresscms.org/userinfo.php?uid=1102", | ||
| "role": "Developer" | ||
| }, | ||
| { | ||
| "name": "Raimondas Rimkevičius", | ||
| "homepage": "https://www.impresscms.org/userinfo.php?uid=489", | ||
| "role": "Developer" | ||
| } | ||
| ], | ||
| "require": { | ||
| "php": ">=7.4.0", | ||
| "ext-gd": "*", | ||
| "ext-json": "*", | ||
| "ext-mbstring": "*", | ||
| "ext-mysqli": "*", | ||
| "ext-pcre": "*", | ||
| "ext-pdo": "*", | ||
| "ext-session": "*", | ||
| "ext-xml": "*", | ||
| "ext-zlib": "*", | ||
| "composer/composer": "^2.8", | ||
| "ezyang/htmlpurifier": "^4.19", | ||
| "simplepie/simplepie": "^1.9", | ||
| "smottt/wideimage": "^1.1" | ||
| }, | ||
| "require-dev": {}, | ||
| "autoload": { | ||
| "psr-4": { | ||
| "Icms\\": "libraries/icms/" | ||
| }, | ||
| "psr-0": { | ||
| "icms_": "libraries/" | ||
| }, | ||
| "classmap": [ | ||
| "libraries/icms.php" | ||
| ] | ||
| }, | ||
| "config": { | ||
| "optimize-autoloader": true, | ||
| "classmap-authoritative": false, | ||
| "apcu-autoloader": true, | ||
| "sort-packages": true, | ||
| "allow-plugins": { | ||
| "*": false | ||
| }, | ||
| "cache-dir": "var/cache/composer", | ||
| "vendor-dir": "vendor" | ||
| }, | ||
| "scripts": {}, | ||
| "minimum-stability": "stable", | ||
| "prefer-stable": true | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,14 +42,88 @@ | |
|
|
||
| // -- Include common functions and constants file | ||
| require_once ICMS_ROOT_PATH . "/include/constants.php"; | ||
|
|
||
| // Load Composer autoloader - prefer trust path location for security. | ||
| // After installation, the vendor directory lives in ICMS_TRUST_PATH (outside | ||
| // the web root). Fall back to ICMS_ROOT_PATH for pre-install or legacy setups. | ||
| $_icms_autoload_from_trustpath = false; | ||
| if (file_exists(ICMS_TRUST_PATH . "/vendor/autoload.php")) { | ||
| $_icms_autoload = ICMS_TRUST_PATH . "/vendor/autoload.php"; | ||
| $_icms_autoload_from_trustpath = true; | ||
| } else { | ||
| $_icms_autoload = ICMS_ROOT_PATH . "/vendor/autoload.php"; | ||
| } | ||
| require_once $_icms_autoload; | ||
fiammybe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| unset($_icms_autoload); | ||
|
|
||
| // When vendor lives in the trust path the Composer-generated autoloader files | ||
| // compute $baseDir as dirname(dirname(__DIR__)) relative to trustpath/vendor/, | ||
| // which resolves to trustpath/ instead of the web root. Every icms_* class | ||
| // lookup therefore targets trustpath/libraries/ – a directory that does not | ||
| // exist because libraries/ always stays in ICMS_ROOT_PATH. | ||
| // | ||
| // Register a prepended SPL autoloader (runs before Composer's now-broken one) | ||
| // that maps all three categories of ImpressCMS-native classes to the correct | ||
| // ICMS_ROOT_PATH/libraries location: | ||
| // | ||
| // "icms" (classmap entry) → libraries/icms.php | ||
| // "icms_*" (PSR-0 style) → libraries/<underscore/separated/path>.php | ||
| // "Icms\*" (PSR-4 style) → libraries/icms/<Namespace/Path>.php | ||
| if ($_icms_autoload_from_trustpath) { | ||
| $_icms_root_lib = ICMS_ROOT_PATH . DIRECTORY_SEPARATOR . "libraries"; | ||
| spl_autoload_register( | ||
| static function (string $class) use ($_icms_root_lib): void { | ||
| // Classmap: bare "icms" abstract base class → libraries/icms.php | ||
| if ($class === "icms") { | ||
| $file = $_icms_root_lib . DIRECTORY_SEPARATOR . "icms.php"; | ||
| if (is_file($file)) { | ||
| require_once $file; | ||
| } | ||
| return; | ||
| } | ||
| // PSR-0: icms_core_DataFilter → libraries/icms/core/DataFilter.php | ||
| if (strncmp($class, "icms_", 5) === 0) { | ||
| $file = | ||
| $_icms_root_lib . | ||
| DIRECTORY_SEPARATOR . | ||
| str_replace("_", DIRECTORY_SEPARATOR, $class) . | ||
| ".php"; | ||
| if (is_file($file)) { | ||
| require_once $file; | ||
| } | ||
| return; | ||
| } | ||
| // PSR-4: Icms\Core\DataFilter → libraries/icms/Core/DataFilter.php | ||
| if (strncmp($class, "Icms\\", 5) === 0) { | ||
| $file = | ||
| $_icms_root_lib . | ||
| DIRECTORY_SEPARATOR . | ||
| "icms" . | ||
| DIRECTORY_SEPARATOR . | ||
| str_replace("\\", DIRECTORY_SEPARATOR, substr($class, 5)) . | ||
| ".php"; | ||
| if (is_file($file)) { | ||
| require_once $file; | ||
| } | ||
| } | ||
| }, | ||
| true, // throw (required SPL signature argument) | ||
| true, // prepend – run BEFORE Composer's broken path resolution | ||
| ); | ||
| unset($_icms_root_lib); | ||
| } | ||
| unset($_icms_autoload_from_trustpath); | ||
|
|
||
| include_once ICMS_INCLUDE_PATH . "/functions.php"; | ||
| include_once ICMS_INCLUDE_PATH . "/debug_functions.php"; | ||
| include_once ICMS_INCLUDE_PATH . "/version.php"; | ||
|
|
||
| if (!isset($xoopsOption)) $xoopsOption = array(); | ||
| if (!isset($xoopsOption)) { | ||
| $xoopsOption = []; | ||
| } | ||
|
|
||
| // load core language file before the initialization of the boot sequence | ||
| icms_loadLanguageFile('core', 'theme'); | ||
| icms_loadLanguageFile("core", "theme"); | ||
|
|
||
| // -- Initialize kernel and launch bootstrap | ||
| require_once ICMS_LIBRARIES_PATH . "/icms.php"; | ||
|
|
@@ -60,63 +134,91 @@ | |
|
|
||
| // Disable gzip compression if PHP is run under CLI mode or if multi-language is enabled | ||
| // To be refactored | ||
| if (empty($_SERVER['SERVER_NAME']) || substr(PHP_SAPI, 0, 3) == 'cli' || $GLOBALS['icmsConfigMultilang']) { | ||
| $icmsConfig['gzip_compression'] = 0; | ||
| if ( | ||
| empty($_SERVER["SERVER_NAME"]) || | ||
| substr(PHP_SAPI, 0, 3) == "cli" || | ||
| $GLOBALS["icmsConfigMultilang"] | ||
| ) { | ||
| $icmsConfig["gzip_compression"] = 0; | ||
| } | ||
|
|
||
| if ($icmsConfig['gzip_compression'] == 1 && extension_loaded('zlib') && !ini_get('zlib.output_compression')) { | ||
| ini_set('zlib.output_compression', TRUE); | ||
| if (ini_get('zlib.output_compression_level') < 0) { | ||
| ini_set('zlib.output_compression_level', 6); | ||
| if ( | ||
| $icmsConfig["gzip_compression"] == 1 && | ||
| extension_loaded("zlib") && | ||
| !ini_get("zlib.output_compression") | ||
| ) { | ||
| ini_set("zlib.output_compression", true); | ||
| if (ini_get("zlib.output_compression_level") < 0) { | ||
| ini_set("zlib.output_compression_level", 6); | ||
| } | ||
| if (!zlib_get_coding_type()) { | ||
| ini_set('zlib.output_compression', FALSE); | ||
| ob_start('ob_gzhandler'); | ||
| ini_set("zlib.output_compression", false); | ||
| ob_start("ob_gzhandler"); | ||
| } | ||
| } | ||
|
|
||
| /* | ||
| * This address the strict compliance for PHP 5.3/5.4, but the rest of our timezone handling | ||
| * can be improved beyond this. ~skenow | ||
| */ | ||
| date_default_timezone_set(timezone_name_from_abbr("", $icmsConfig['default_TZ'] * 3600, 0)); | ||
| date_default_timezone_set( | ||
| timezone_name_from_abbr("", $icmsConfig["default_TZ"] * 3600, 0), | ||
| ); | ||
|
|
||
| // -- Include site-wide lang file | ||
| icms_loadLanguageFile('core', 'global'); | ||
| icms_loadLanguageFile('core', 'core'); | ||
| icms_loadLanguageFile('system', 'common'); | ||
| @define('_GLOBAL_LEFT', @_ADM_USE_RTL == 1 ? 'right' : 'left'); | ||
| @define('_GLOBAL_RIGHT', @_ADM_USE_RTL == 1 ? 'left' : 'right'); | ||
| icms_loadLanguageFile("core", "global"); | ||
| icms_loadLanguageFile("core", "core"); | ||
| icms_loadLanguageFile("system", "common"); | ||
| @define("_GLOBAL_LEFT", @_ADM_USE_RTL == 1 ? "right" : "left"); | ||
| @define("_GLOBAL_RIGHT", @_ADM_USE_RTL == 1 ? "left" : "right"); | ||
|
|
||
| // -- Include page-specific lang file | ||
| if (isset($xoopsOption['pagetype']) && FALSE === strpos($xoopsOption['pagetype'], '.')) { | ||
| icms_loadLanguageFile('core', $xoopsOption['pagetype']); | ||
| if ( | ||
| isset($xoopsOption["pagetype"]) && | ||
| false === strpos($xoopsOption["pagetype"], ".") | ||
| ) { | ||
| icms_loadLanguageFile("core", $xoopsOption["pagetype"]); | ||
| } | ||
|
|
||
| defined("XOOPS_USE_MULTIBYTES") or define("XOOPS_USE_MULTIBYTES", 0); | ||
|
|
||
| if (!empty($_POST['xoops_theme_select']) && in_array($_POST['xoops_theme_select'], $icmsConfig['theme_set_allowed'])) { | ||
| $icmsConfig['theme_set'] = $_POST['xoops_theme_select']; | ||
| $_SESSION['xoopsUserTheme'] = $_POST['xoops_theme_select']; | ||
| } elseif (!empty($_POST['theme_select']) && in_array($_POST['theme_select'], $icmsConfig['theme_set_allowed'])) { | ||
| $icmsConfig['theme_set'] = $_POST['theme_select']; | ||
| $_SESSION['xoopsUserTheme'] = $_POST['theme_select']; | ||
| } elseif (!empty($_SESSION['xoopsUserTheme']) && in_array($_SESSION['xoopsUserTheme'], $icmsConfig['theme_set_allowed'])) { | ||
| $icmsConfig['theme_set'] = $_SESSION['xoopsUserTheme']; | ||
| if ( | ||
| !empty($_POST["xoops_theme_select"]) && | ||
| in_array($_POST["xoops_theme_select"], $icmsConfig["theme_set_allowed"]) | ||
| ) { | ||
| $icmsConfig["theme_set"] = $_POST["xoops_theme_select"]; | ||
| $_SESSION["xoopsUserTheme"] = $_POST["xoops_theme_select"]; | ||
| } elseif ( | ||
| !empty($_POST["theme_select"]) && | ||
| in_array($_POST["theme_select"], $icmsConfig["theme_set_allowed"]) | ||
| ) { | ||
| $icmsConfig["theme_set"] = $_POST["theme_select"]; | ||
| $_SESSION["xoopsUserTheme"] = $_POST["theme_select"]; | ||
| } elseif ( | ||
| !empty($_SESSION["xoopsUserTheme"]) && | ||
| in_array($_SESSION["xoopsUserTheme"], $icmsConfig["theme_set_allowed"]) | ||
| ) { | ||
| $icmsConfig["theme_set"] = $_SESSION["xoopsUserTheme"]; | ||
| } | ||
|
|
||
| if ($icmsConfig['closesite'] == 1) { | ||
| include ICMS_INCLUDE_PATH . '/site-closed.php'; | ||
| if ($icmsConfig["closesite"] == 1) { | ||
| include ICMS_INCLUDE_PATH . "/site-closed.php"; | ||
fiammybe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| icms::launchModule(); | ||
|
|
||
| if ($icmsConfigPersona['multi_login']) { | ||
| if ($icmsConfigPersona["multi_login"]) { | ||
| if (is_object(icms::$user)) { | ||
| $online_handler = icms::handler('icms_core_Online'); | ||
| $online_handler->write(icms::$user->getVar('uid'), icms::$user->getVar('uname'), time(), 0, $_SERVER['REMOTE_ADDR']); | ||
| $online_handler = icms::handler("icms_core_Online"); | ||
| $online_handler->write( | ||
| icms::$user->getVar("uid"), | ||
| icms::$user->getVar("uname"), | ||
| time(), | ||
| 0, | ||
| $_SERVER["REMOTE_ADDR"], | ||
| ); | ||
|
||
| } | ||
| } | ||
|
|
||
| // -- finalize boot process | ||
| icms::$preload->triggerEvent('finishCoreBoot'); | ||
| icms::$preload->triggerEvent("finishCoreBoot"); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.