diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..6762b78 --- /dev/null +++ b/.htaccess @@ -0,0 +1,61 @@ +################################################################################ +# ConLite AMR plugin simple rewrite rules set. +# +# Contains few easy to handle rewrite rules. +# +# @version 1.0.0 +# @author Ortwin Pinke +# @author Murat Purc +# @copyright 2019 ConLite Team +# @link http://www.conlite.org +# +# Versions before 1.0 copyright 4fb, author Murat Purc +# +# $Id: htaccess_simple.txt 145 2019-10-25 16:00:47Z oldperl $ +################################################################################ + +#SetEnv CONLITE_ENVIRONMENT development + + + + # Enable rewrite engine + RewriteEngine on + + # Specify a base URL-path for the rules + RewriteBase /cms + + # Catch some common exploits in query string to get rid of them + # NOTE: Conditions to prevent protocols (ftp, http[s]) in query string could + # be a disadvantage in some cases + RewriteCond %{QUERY_STRING} contenido_path=.*$ [NC,OR] + RewriteCond %{QUERY_STRING} cfg\[path\]=.*$ [NC,OR] + RewriteCond %{QUERY_STRING} _PHPLIB\[libdir\]=.*$ [NC,OR] + RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR] + RewriteCond %{QUERY_STRING} ftp://.*$ [NC,OR] + RewriteCond %{QUERY_STRING} http[s]*://.*$ [NC] + RewriteRule ^.* - [F,L] # all matching conditions from above will end in nirvana + + # Rewrite request to root to front_content.php + RewriteRule ^$ front_content.php [QSA,L] + + # Exclude following request from rewriting + # tests for favicon.ico, valid symlinks (-s), not empty files (-l) and folders (-d) + RewriteCond %{REQUEST_URI} ^/favicon.ico$ [OR] + RewriteCond %{REQUEST_FILENAME} -s [OR] + RewriteCond %{REQUEST_FILENAME} -l [OR] + RewriteCond %{REQUEST_FILENAME} -d + RewriteRule ^.*$ - [NC,L] + + # Pass other requests to front_content.php + RewriteRule ^.*$ front_content.php [QSA,NC,L] + + + +# Some rules to compress files. +# NOTE: Following settings are not mod rewrite specific, but enabling mod_deflate +# for some file types can help to reduce bandwith. + + + SetOutputFilter DEFLATE + + diff --git a/setup/lib/defines.php b/setup/lib/defines.php index 85bb996..6273f89 100644 --- a/setup/lib/defines.php +++ b/setup/lib/defines.php @@ -1,37 +1,18 @@ + * @author Murat Purc + * @copyright (c) 2020, ConLite.org + * @license https://www.gnu.org/licenses/gpl-3.0.de.html GNU General Public License 3 + * @link https://conlite.org ConLite Portal + * @since file available since contenido release <= 4.8.15 * - * $Id$ - */ - -/** - * Project: - * Contenido Content Management System - * - * Description: - * - * Requirements: - * @con_php_req 5 - * - * - * @package Contenido Setup - * @version 0.2.1 - * @author unknown - * @copyright four for business AG - * @license http://www.contenido.org/license/LIZENZ.txt - * @link http://www.4fb.de - * @link http://www.contenido.org */ if (!defined('CON_FRAMEWORK')) { @@ -56,6 +37,6 @@ define('C_SETUP_STEPFILE', 'images/steps/s%d.png'); define('C_SETUP_STEPFILE_ACTIVE', 'images/steps/s%da.png'); define('C_SETUP_STEPWIDTH', 28); define('C_SETUP_STEPHEIGHT', 28); -define('C_SETUP_MIN_PHP_VERSION', '5.6'); -define('C_SETUP_VERSION', '2.1.1'); -?> \ No newline at end of file +define('C_SETUP_MIN_PHP_VERSION', '7.2'); +define('C_SETUP_MAX_PHP_VERSION', '7.4'); +define('C_SETUP_VERSION', '2.2.0'); \ No newline at end of file diff --git a/setup/lib/startup.php b/setup/lib/startup.php index 5bc51c1..5a248d1 100644 --- a/setup/lib/startup.php +++ b/setup/lib/startup.php @@ -1,31 +1,25 @@ - * @copyright four for business AG - * @license http://www.contenido.org/license/LIZENZ.txt - * @link http://www.4fb.de - * @link http://www.contenido.org - * @since file available since contenido release <= 4.8.15 - * - * $Id$ + * ConLite setup bootstrap file + * + * @package ConLite + * @subpackage Setup + * @version 1.0.0 + * @author Ortwin Pinke + * @author Murat Purc + * @copyright (c) 2020, ConLite.org + * @license https://www.gnu.org/licenses/gpl-3.0.de.html GNU General Public License 3 + * @link https://conlite.org ConLite Portal + * @since file available since contenido release <= 4.8.15 + * */ if (!defined('CON_FRAMEWORK')) { die('Illegal call'); } define('CON_BE_PATH', '../conlite/'); +require_once 'defines.php'; // uncomment this lines during development if needed error_reporting(E_ALL ^ E_NOTICE); @@ -36,14 +30,14 @@ ini_set("error_log", "../data/logs/setup_errorlog.txt"); header('Content-Type: text/html; charset=UTF-8'); // Check php version -if (version_compare(PHP_VERSION, '7.0.0', '<')) { - die("You need PHP >= 7.0.0 to install ConLite 2.1. Sorry, even the setup doesn't work otherwise. Your version: " . PHP_VERSION . "\n"); +if (version_compare(PHP_VERSION, C_SETUP_MIN_PHP_VERSION, '<')) { + die("You need PHP >= " . C_SETUP_MIN_PHP_VERSION . " to install ConLite " . C_SETUP_VERSION . ". Sorry, even the setup doesn't work otherwise. Your version: " . PHP_VERSION . "\n"); } -// Check version -//PHP >= 7.0.0 and < 7.4 -if (version_compare(PHP_VERSION, '7.4.0', '>=')) { - die("You need PHP >= 7.0 and < 7.4 to install ConLite 2.1. Sorry, even the setup doesn't work otherwise. Your version: " . PHP_VERSION . "\n"); +$iVersionMax = substr(C_SETUP_MAX_PHP_VERSION, 0, strrpos(C_SETUP_MAX_PHP_VERSION, ".") + 1) . (1 + substr(C_SETUP_MAX_PHP_VERSION, strrpos(C_SETUP_MAX_PHP_VERSION, ".") + 1)); + +if (!(version_compare($iVersionMax, PHP_VERSION, ">") && version_compare(C_SETUP_MAX_PHP_VERSION, PHP_VERSION, "<="))) { + die("You need PHP >= " . C_SETUP_MIN_PHP_VERSION . " and <= " . C_SETUP_MAX_PHP_VERSION . " to install ConLite " . C_SETUP_VERSION . ". Sorry, even the setup doesn't work otherwise. Your version: " . PHP_VERSION . "\n"); } @@ -53,7 +47,7 @@ if (version_compare(PHP_VERSION, '7.4.0', '>=')) { * If you want to set a different enviroment value please define it in your .htaccess file * or in the server configuration. * - * SetEnv CONTENIDO_ENVIRONMENT development + * SetEnv CONLITE_ENVIRONMENT development */ if (!defined('CL_ENVIRONMENT')) { if (getenv('CONLITE_ENVIRONMENT')) { @@ -80,13 +74,13 @@ Contenido_Security::checkRequests(); */ function checkAndInclude($filename) { if (file_exists($filename) && is_readable($filename)) { - require_once($filename); + require_once($filename); } else { - echo "
";
-            echo "Setup was unable to include neccessary files. The file $filename was not found. Solutions:\n\n";
-            echo "- Make sure that all files are correctly uploaded to the server.\n";
-            echo "- Make sure that include_path is set to '.' (of course, it can contain also other directories). Your include path is: ".ini_get("include_path")."\n"; 
-            echo "
"; + echo "
";
+        echo "Setup was unable to include neccessary files. The file $filename was not found. Solutions:\n\n";
+        echo "- Make sure that all files are correctly uploaded to the server.\n";
+        echo "- Make sure that include_path is set to '.' (of course, it can contain also other directories). Your include path is: " . ini_get("include_path") . "\n";
+        echo "
"; } } @@ -97,6 +91,10 @@ $cfg['path']['frontend'] = CON_FRONTEND_PATH; $cfg['path']['conlite'] = $cfg['path']['frontend'] . '/conlite/'; $cfg['path']['conlite_config'] = CON_FRONTEND_PATH . '/data/config/' . CL_ENVIRONMENT . '/'; +if(!is_dir($cfg['path']['conlite_config'])) { + die("Setup cannot find the config folder \"".$cfg['path']['conlite_config']."\"! Make shure folder exists and is readable."); +} + // (bool) Flag to use native i18n. // Note: Enabling this could create unwanted side effects, because of // native gettext() behavior. @@ -106,7 +104,7 @@ session_start(); // includes checkAndInclude('lib/defines.php'); -checkAndInclude($cfg['path']['frontend'].'/pear/HTML/Common2.php'); +checkAndInclude($cfg['path']['frontend'] . '/pear/HTML/Common2.php'); checkAndInclude($cfg['path']['conlite'] . 'classes/cHTML5/class.chtml.php'); checkAndInclude($cfg['path']['conlite'] . 'classes/class.htmlelements.php'); checkAndInclude($cfg['path']['conlite'] . 'classes/con2con/class.filehandler.php');