Updates for release 2.1.x

Dieser Commit ist enthalten in:
Oldperl 2019-10-25 16:00:47 +00:00
Ursprung 710dcc8d18
Commit 6bb130a4e9
5 geänderte Dateien mit 392 neuen und 458 gelöschten Zeilen

Datei anzeigen

@ -272,6 +272,7 @@ class cDirHandler {
* array containing file names as string, false on error
*/
public static function read($dirname, $recursive = false, $dirOnly = false, $fileOnly = false) {
$dirname = rtrim($dirname, '/') . '/';
if (!self::exists($dirname)) {
return false;
}
@ -279,7 +280,6 @@ class cDirHandler {
$dirContent = array();
if ($recursive == false) {
$dirHandle = opendir($dirname);
$dirContent = array();
while (false !== ($file = readdir($dirHandle))) {
if (!cFileHandler::fileNameIsDot($file)) {
@ -289,7 +289,9 @@ class cDirHandler {
$dirContent[] = $file;
}
// bugfix: is_dir only checked file name without path, thus returning everything most of the time
} else if ($fileOnly === true) { // get only files
}
if ($fileOnly == true && !$dirOnly) { // get only files
if (is_file($dirname . $file)) {
$dirContent[] = $file;
@ -323,7 +325,6 @@ class cDirHandler {
}
}
}
return $dirContent;
}

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -24,7 +25,6 @@
*
* $Id$:
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
@ -42,8 +42,7 @@ if(!defined('CON_FRAMEWORK')) {
* @author Jan Lengowski <jan.lengowski@4fb.de>
* @copyright four for business AG <www.4fb.de>
*/
function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
{
function conGenerateCode($idcat, $idart, $lang, $client, $layout = false) {
global $frontend_debug, $_cecRegistry;
$debug = 0;
@ -88,8 +87,7 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
$db->query($sql);
$db->next_record();
if ($db->f("idtplcfg") != 0)
{
if ($db->f("idtplcfg") != 0) {
/* Article is configured */
$idtplcfg = $db->f("idtplcfg");
@ -110,14 +108,10 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
$db2->query($sql2);
while ($db2->next_record())
{
while ($db2->next_record()) {
$a_c[$db2->f("number")] = $db2->f("container");
}
} else
{
} else {
/* Check whether category is
configured. */
@ -135,8 +129,7 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
$db->query($sql);
$db->next_record();
if ($db->f("idtplcfg") != 0)
{
if ($db->f("idtplcfg") != 0) {
/* Category is configured,
extract varstring */
@ -158,14 +151,10 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
$db2->query($sql2);
while ($db2->next_record())
{
while ($db2->next_record()) {
$a_c[$db2->f("number")] = $db2->f("container");
}
} else
{
} else {
/* Article nor Category
is configured. Creation of
@ -181,22 +170,18 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
$db->query($sql);
if ($db->next_record())
{
if ($db->next_record()) {
$sql = "UPDATE " . $cfg["tab"]["code"] . " SET code='" . Contenido_Security::escapeDB($code, $db) . "', idlang='" . Contenido_Security::escapeDB($lang, $db) . "', idclient='" . Contenido_Security::escapeDB($client, $db) . "'
WHERE idcatart='" . Contenido_Security::toInteger($idcatart) . "' AND idlang='" . Contenido_Security::escapeDB($lang, $db) . "'";
$db->query($sql);
} else
{
} else {
$sql = "INSERT INTO " . $cfg["tab"]["code"] . " (idcode, idcatart, code, idlang, idclient) VALUES ('" . Contenido_Security::toInteger($db->nextid($cfg["tab"]["code"])) . "', '" . Contenido_Security::toInteger($idcatart) . "',
'" . Contenido_Security::escapeDB($code, $db) . "', '" . Contenido_Security::escapeDB($lang, $db) . "', '" . Contenido_Security::escapeDB($client, $db) . "')";
$db->query($sql);
}
return "0601";
}
}
/* Get IDLAY and IDMOD array */
@ -215,8 +200,7 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
$idlay = $db->f("idlay");
if ($layout != false)
{
if ($layout != false) {
$idlay = $layout;
}
@ -238,8 +222,7 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
$db->query($sql);
while ($db->next_record())
{
while ($db->next_record()) {
$a_d[$db->f("number")] = $db->f("idmod");
}
@ -248,22 +231,19 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
$code = AddSlashes($raw_code);
/* Create code for all containers */
if ($idlay)
{
if ($idlay) {
tplPreparseLayout($idlay, $raw_code);
$tmp_returnstring = tplBrowseLayoutForContainers($idlay, $raw_code);
$a_container = explode("&", $tmp_returnstring);
foreach ($a_container as $key => $value)
{
foreach ($a_container as $key => $value) {
$sql = "SELECT * FROM " . $cfg["tab"]["mod"] . " WHERE idmod='" . $a_d[$value] . "'";
$db->query($sql);
$db->next_record();
if (is_numeric($a_d[$value]))
{
if (is_numeric($a_d[$value])) {
$thisModule = '<?php $cCurrentModule = ' . ((int) $a_d[$value]) . '; ?>';
$thisContainer = '<?php $cCurrentContainer = ' . ((int) $value) . '; ?>';
}
@ -290,12 +270,10 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
$varstring = array();
foreach ($tmp1 as $key1 => $value1)
{
foreach ($tmp1 as $key1 => $value1) {
$tmp2 = explode("=", $value1);
foreach ($tmp2 as $key2 => $value2)
{
foreach ($tmp2 as $key2 => $value2) {
$varstring["$tmp2[0]"] = $tmp2[1];
}
}
@ -303,8 +281,7 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
$CiCMS_Var = '$C' . $value . 'CMS_VALUE';
$CiCMS_VALUE = '';
foreach ($varstring as $key3 => $value3)
{
foreach ($varstring as $key3 => $value3) {
$tmp = urldecode($value3);
$tmp = str_replace("\'", "'", $tmp);
$CiCMS_VALUE .= $CiCMS_Var . '[' . $key3 . ']="' . $tmp . '"; ';
@ -317,28 +294,23 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
$output = preg_replace("/(CMS_VALUE\[)([0-9]*)(\])/i", "", $output);
if ($frontend_debug["container_display"] == true)
{
if ($frontend_debug["container_display"] == true) {
$fedebug .= "Container: CMS_CONTAINER[$value]" . '\\\\n';
}
if ($frontend_debug["module_display"] == true)
{
if ($frontend_debug["module_display"] == true) {
$fedebug .= "Modul: " . $db->f("name") . '\\\\n';
}
if ($frontend_debug["module_timing_summary"] == true || $frontend_debug["module_timing"] == true)
{
if ($frontend_debug["module_timing_summary"] == true || $frontend_debug["module_timing"] == true) {
$fedebug .= 'Eval-Time: $modtime' . $value . '\\\\n';
$output = '<?php $modstart' . $value . ' = getmicrotime(); ?' . '>' . $output . '<?php $modend' . $value . ' = getmicrotime()+0.001; $modtime' . $value . ' = $modend' . $value . ' - $modstart' . $value . '; ?' . '>';
}
if ($fedebug != "")
{
if ($fedebug != "") {
$output = addslashes('<?php echo \'<img onclick="javascript:showmod' . $value . '();" src="' . $cfg['path']['contenido_fullhtml'] . 'images/but_preview.gif">\'; ?' . '>' . "<br>") . $output;
$output = $output . addslashes('<?php echo \'<script language="javascript">function showmod' . $value . ' () { window.alert(\\\'\'. "' . addslashes($fedebug) . '".\'\\\');} </script>\'; ?' . '>');
}
if ($frontend_debug["module_timing_summary"] == true)
{
if ($frontend_debug["module_timing_summary"] == true) {
$output .= addslashes(' <?php $cModuleTimes["' . $value . '"] = $modtime' . $value . '; ?>');
$output .= addslashes(' <?php $cModuleNames["' . $value . '"] = "' . addslashes($db->f("name")) . '"; ?>');
}
@ -350,7 +322,6 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
$code = str_ireplace("CMS_CONTAINER[$value]", "<?php $CiCMS_VALUE ?>\r\n" . $output, $code);
$fedebug = "";
}
}
@ -369,8 +340,7 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
$db->query($sql);
while ($db->next_record())
{
while ($db->next_record()) {
$a_content[$db->f("type")][$db->f("typeid")] = $db->f("value");
}
@ -394,8 +364,7 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
$db->query($sql);
$match = array();
while ($db->next_record())
{
while ($db->next_record()) {
$tmp = preg_match_all("/(" . $db->f("type") . "\[+\d+\])/i", $code, $match);
$a_[strtolower($db->f("type"))] = $match[0];
@ -405,8 +374,7 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
$search = array();
$replacements = array();
foreach ($a_[strtolower($db->f("type"))] as $val)
{
foreach ($a_[strtolower($db->f("type"))] as $val) {
eval($db->f("code"));
$search[$val] = $db->f("type") . "[$val]";
@ -415,23 +383,18 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
}
$code = str_ireplace($search, $replacements, $code);
}
/* add/replace title */
if ($pagetitle != "")
{
if ($pagetitle != "") {
$code = preg_replace("/<title>.*?<\/title>/is", "{TITLE}", $code, 1);
if (strstr($code, "{TITLE}"))
{
if (strstr($code, "{TITLE}")) {
$code = str_ireplace("{TITLE}", addslashes("<title>$pagetitle</title>"), $code);
} else
{
} else {
$code = str_ireplace_once("</head>", addslashes("<title>" . $pagetitle . "</title>\n</head>"), $code);
}
} else
{
} else {
$code = str_replace('<title></title>', '', $code);
}
@ -518,7 +481,8 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
foreach ($metatags as $value) {
if (getEffectiveSetting('generator', 'html5', "false") == "true") {
if($value['name'] == 'date') continue;
if ($value['name'] == 'date')
continue;
}
if (!empty($value['content'])) {
$value['content'] = clHtmlEntityDecode($value['content'], ENT_QUOTES, strtoupper($encoding[$lang]));
@ -550,21 +514,18 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
/* write code into the database */
$date = date("Y-m-d H:i:s");
if ($layout == false)
{
if ($layout == false) {
$sql = "SELECT * FROM " . $cfg["tab"]["code"] . " WHERE idcatart = '" . Contenido_Security::toInteger($idcatart) . "' AND idlang = '" . Contenido_Security::escapeDB($lang, $db) . "'";
$db->query($sql);
if ($db->next_record())
{
if ($db->next_record()) {
if ($debug)
echo "UPDATED code for lang:$lang, client:$client, idcatart:$idcatart";
$sql = "UPDATE " . $cfg["tab"]["code"] . " SET code='" . Contenido_Security::escapeDB($code, $db, false) . "', idlang='" . Contenido_Security::escapeDB($lang, $db) . "', idclient='" . Contenido_Security::escapeDB($client, $db) . "'
WHERE idcatart='" . Contenido_Security::toInteger($idcatart) . "' AND idlang='" . Contenido_Security::escapeDB($lang, $db) . "'";
$db->query($sql);
} else
{
} else {
if ($debug)
echo "INSERTED code for lang:$lang, client:$client, idcatart:$idcatart";
$sql = "INSERT INTO " . $cfg["tab"]["code"] . " (idcode, idcatart, code, idlang, idclient) VALUES ('" . Contenido_Security::toInteger($db->nextid($cfg["tab"]["code"])) . "', '" . Contenido_Security::toInteger($idcatart) . "',
@ -629,7 +590,8 @@ function conGetAvailableMetaTagTypes() {
*/
function conGetMetaValue($idartlang, $idmetatype) {
if($idartlang == 0) return;
if ($idartlang == 0)
return;
$oMetaTags = new cApiMetaTagCollection();
$oMetaTags->setWhere('idartlang', Contenido_Security::toInteger($idartlang));
@ -655,8 +617,7 @@ function conGetMetaValue($idartlang, $idmetatype) {
* @author Timo A. Hummel <Timo.Hummel@4fb.de>
* @copyright four for business AG 2003
*/
function conSetMetaValue($idartlang, $idmetatype, $value)
{
function conSetMetaValue($idartlang, $idmetatype, $value) {
global $cfg;
$db = new DB_ConLite;
@ -674,7 +635,6 @@ function conSetMetaValue($idartlang, $idmetatype, $value)
metavalue = '" . Contenido_Security::escapeDB($value, $db) . "'";
$db->query($sql);
}
/**
@ -688,8 +648,7 @@ function conSetMetaValue($idartlang, $idmetatype, $value)
* Modified : 13.05.2004
* @copyright four for business AG 2003
*/
function conGenerateKeywords($client, $lang)
{
function conGenerateKeywords($client, $lang) {
global $cfg;
$db_art = new DB_ConLite;
@ -708,28 +667,22 @@ function conGenerateKeywords($client, $lang)
$db_art->query($sql);
$articles = array();
while ($db_art->next_record())
{
while ($db_art->next_record()) {
$articles[$db_art->f("idart")] = $db_art->f("idartlang");
}
if (count($articles) > 0)
{
foreach ($articles as $artid => $article_lang)
{
if (count($articles) > 0) {
foreach ($articles as $artid => $article_lang) {
$article_content = array();
$article_content = conGetContentFromArticle($article_lang);
if (count($article_content) > 0)
{
if (count($article_content) > 0) {
$art_index = new Index($db_art);
$art_index->lang = $lang;
$art_index->start($artid, $article_content, 'auto', $options);
}
}
}
}
/**
@ -742,8 +695,7 @@ function conGenerateKeywords($client, $lang)
* Modified : 13.05.2004
* @copyright four for business AG 2003
*/
function conGetContentFromArticle($article_lang)
{
function conGetContentFromArticle($article_lang) {
global $cfg;
$db_con = new DB_ConLite;
@ -761,12 +713,11 @@ function conGetContentFromArticle($article_lang)
$db_con->query($sql);
while ($db_con->next_record())
{
while ($db_con->next_record()) {
$a_content[$db_con->f("type")][$db_con->f("typeid")] = urldecode($db_con->f("value"));
}
return $a_content;
}
?>

Datei anzeigen

@ -1,36 +1,30 @@
################################################################################
# CONTENIDO AMR plugin restrictive rewrite rules set.
# ConLite AMR plugin restrictive rewrite rules set.
#
# Contains strict rules, each rewrite exclusion must be set manually.
# - Exclude requests to directories usage/, contenido/, setup/, cms/upload/
# - Exclude requests to cms/front_content.php
# - Exclude requests to directories usage/, conlite/, setup/, cms/upload/
# - Exclude requests to cms/front_content.php, cms/dbfs.php
# - Pass thru requests to common ressources (pictures, movies, js, css, pdf)
#
# @version 0.0.1
# @version 1.0.0
# @author Ortwin Pinke <ortwin.pinke@php-backoffice.de>
# @author Murat Purc <murat@purc.de>
# @copyright four for business AG <www.4fb.de>
# @license http://www.contenido.org/license/LIZENZ.txt
# @link http://www.4fb.de
# @link http://www.contenido.org
# @copyright 2019 ConLite Team
# @link http://www.conlite.org
#
# Versions before 1.0 copyright 4fb, author Murat Purc
#
# $Id$
################################################################################
# Enable following lines to run PHP5 on 1und1.de (1and1.com)
#AddType x-mapp-php5 .php
#AddHandler x-mapp-php5 .php
<IfModule mod_rewrite.c>
# 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.
@ -42,7 +36,6 @@
RewriteCond %{QUERY_STRING} http[s]*://.*$ [NC]
RewriteRule ^.* - [F,L] # all matching conditions from above will end in nirvana
# Exclude some files and directories from rewriting
RewriteRule ^usage/.*$ - [L]
RewriteRule ^conlite/.*$ - [L]
@ -50,15 +43,14 @@
RewriteRule ^cms/upload/.*$ - [L]
RewriteRule ^cms/test/.*$ - [L]
RewriteRule ^cms/front_content.php.*$ - [L]
RewriteRule ^cms/dbfs.php.*$ - [L]
# Exclude common extensions from rewriting and pass remaining requests to
# front_content.php.
RewriteRule !\.(avi|css|doc|flv|gif|gzip|ico|jpeg|jpg|js|mov|mp3|pdf|png|ppt|rar|swf|txt|wav|wmv|xml|zip)$ front_content.php [NC,QSA,L]
RewriteRule !\.(avi|css|doc|flv|gif|gzip|ico|jpeg|jpg|js|mov|mp3|pdf|png|ppt|rar|svg|swf|txt|wav|wmv|xml|zip)$ front_content.php [NC,QSA,L]
</IfModule>
# 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.

Datei anzeigen

@ -1,33 +1,27 @@
################################################################################
# CONTENIDO AMR plugin simple rewrite rules set.
# ConLite AMR plugin simple rewrite rules set.
#
# Contains few easy to handle rewrite rules.
#
# @version 0.0.1
# @version 1.0.0
# @author Ortwin Pinke <ortwin.pinke@php-backoffice.de>
# @author Murat Purc <murat@purc.de>
# @copyright four for business AG <www.4fb.de>
# @license http://www.contenido.org/license/LIZENZ.txt
# @link http://www.4fb.de
# @link http://www.contenido.org
# @copyright 2019 ConLite Team
# @link http://www.conlite.org
#
# Versions before 1.0 copyright 4fb, author Murat Purc
#
# $Id$
################################################################################
# Enable following lines to run PHP5 on 1und1.de (1and1.com)
#AddType x-mapp-php5 .php
#AddHandler x-mapp-php5 .php
<IfModule mod_rewrite.c>
# 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
@ -39,11 +33,9 @@
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]
@ -52,13 +44,11 @@
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# Pass other requests to front_content.php
RewriteRule ^.*$ front_content.php [QSA,NC,L]
</IfModule>
# 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.