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

Datei anzeigen

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Project: * Project:
* Contenido Content Management System * Contenido Content Management System
@ -24,8 +25,7 @@
* *
* $Id$: * $Id$:
*/ */
if (!defined('CON_FRAMEWORK')) {
if(!defined('CON_FRAMEWORK')) {
die('Illegal call'); die('Illegal call');
} }
@ -42,8 +42,7 @@ if(!defined('CON_FRAMEWORK')) {
* @author Jan Lengowski <jan.lengowski@4fb.de> * @author Jan Lengowski <jan.lengowski@4fb.de>
* @copyright four for business AG <www.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; global $frontend_debug, $_cecRegistry;
$debug = 0; $debug = 0;
@ -60,10 +59,10 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
$sql = "SELECT $sql = "SELECT
idcatart idcatart
FROM FROM
".$cfg["tab"]["cat_art"]." " . $cfg["tab"]["cat_art"] . "
WHERE WHERE
idcat = '".Contenido_Security::toInteger($idcat)."' AND idcat = '" . Contenido_Security::toInteger($idcat) . "' AND
idart = '".Contenido_Security::toInteger($idart)."'"; idart = '" . Contenido_Security::toInteger($idart) . "'";
$db->query($sql); $db->query($sql);
$db->next_record(); $db->next_record();
@ -77,19 +76,18 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
$sql = "SELECT $sql = "SELECT
a.idtplcfg AS idtplcfg a.idtplcfg AS idtplcfg
FROM FROM
".$cfg["tab"]["art_lang"]." AS a, " . $cfg["tab"]["art_lang"] . " AS a,
".$cfg["tab"]["art"]." AS b " . $cfg["tab"]["art"] . " AS b
WHERE WHERE
a.idart = '".Contenido_Security::toInteger($idart)."' AND a.idart = '" . Contenido_Security::toInteger($idart) . "' AND
a.idlang = '".Contenido_Security::escapeDB($lang, $db)."' AND a.idlang = '" . Contenido_Security::escapeDB($lang, $db) . "' AND
b.idart = a.idart AND b.idart = a.idart AND
b.idclient = '".Contenido_Security::escapeDB($client, $db)."'"; b.idclient = '" . Contenido_Security::escapeDB($client, $db) . "'";
$db->query($sql); $db->query($sql);
$db->next_record(); $db->next_record();
if ($db->f("idtplcfg") != 0) if ($db->f("idtplcfg") != 0) {
{
/* Article is configured */ /* Article is configured */
$idtplcfg = $db->f("idtplcfg"); $idtplcfg = $db->f("idtplcfg");
@ -97,46 +95,41 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
if ($debug) if ($debug)
echo "configuration for article found: $idtplcfg<br><br>"; echo "configuration for article found: $idtplcfg<br><br>";
$a_c = array (); $a_c = array();
$sql2 = "SELECT $sql2 = "SELECT
* *
FROM FROM
".$cfg["tab"]["container_conf"]." " . $cfg["tab"]["container_conf"] . "
WHERE WHERE
idtplcfg = '".Contenido_Security::toInteger($idtplcfg)."' idtplcfg = '" . Contenido_Security::toInteger($idtplcfg) . "'
ORDER BY ORDER BY
number ASC"; number ASC";
$db2->query($sql2); $db2->query($sql2);
while ($db2->next_record()) while ($db2->next_record()) {
{
$a_c[$db2->f("number")] = $db2->f("container"); $a_c[$db2->f("number")] = $db2->f("container");
} }
} else {
} else
{
/* Check whether category is /* Check whether category is
configured. */ configured. */
$sql = "SELECT $sql = "SELECT
a.idtplcfg AS idtplcfg a.idtplcfg AS idtplcfg
FROM FROM
".$cfg["tab"]["cat_lang"]." AS a, " . $cfg["tab"]["cat_lang"] . " AS a,
".$cfg["tab"]["cat"]." AS b " . $cfg["tab"]["cat"] . " AS b
WHERE WHERE
a.idcat = '".Contenido_Security::toInteger($idcat)."' AND a.idcat = '" . Contenido_Security::toInteger($idcat) . "' AND
a.idlang = '".Contenido_Security::escapeDB($lang, $db)."' AND a.idlang = '" . Contenido_Security::escapeDB($lang, $db) . "' AND
b.idcat = a.idcat AND b.idcat = a.idcat AND
b.idclient = '".Contenido_Security::escapeDB($client, $db)."'"; b.idclient = '" . Contenido_Security::escapeDB($client, $db) . "'";
$db->query($sql); $db->query($sql);
$db->next_record(); $db->next_record();
if ($db->f("idtplcfg") != 0) if ($db->f("idtplcfg") != 0) {
{
/* Category is configured, /* Category is configured,
extract varstring */ extract varstring */
@ -145,27 +138,23 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
if ($debug) if ($debug)
echo "configuration for category found: $idtplcfg<br><br>"; echo "configuration for category found: $idtplcfg<br><br>";
$a_c = array (); $a_c = array();
$sql2 = "SELECT $sql2 = "SELECT
* *
FROM FROM
".$cfg["tab"]["container_conf"]." " . $cfg["tab"]["container_conf"] . "
WHERE WHERE
idtplcfg = '".Contenido_Security::toInteger($idtplcfg)."' idtplcfg = '" . Contenido_Security::toInteger($idtplcfg) . "'
ORDER BY ORDER BY
number ASC"; number ASC";
$db2->query($sql2); $db2->query($sql2);
while ($db2->next_record()) while ($db2->next_record()) {
{
$a_c[$db2->f("number")] = $db2->f("container"); $a_c[$db2->f("number")] = $db2->f("container");
} }
} else {
} else
{
/* Article nor Category /* Article nor Category
is configured. Creation of is configured. Creation of
@ -177,26 +166,22 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
$code = '<html><body>No code was created for this art in this category.</body><html>'; $code = '<html><body>No code was created for this art in this category.</body><html>';
$sql = "SELECT * FROM ".$cfg["tab"]["code"]." WHERE idcatart='".Contenido_Security::toInteger($idcatart)."' AND idlang='".Contenido_Security::escapeDB($lang, $db)."'"; $sql = "SELECT * FROM " . $cfg["tab"]["code"] . " WHERE idcatart='" . Contenido_Security::toInteger($idcatart) . "' AND idlang='" . Contenido_Security::escapeDB($lang, $db) . "'";
$db->query($sql); $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) . "'
$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) . "'";
WHERE idcatart='".Contenido_Security::toInteger($idcatart)."' AND idlang='".Contenido_Security::escapeDB($lang, $db)."'";
$db->query($sql); $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) . "',
$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) . "')";
'".Contenido_Security::escapeDB($code, $db)."', '".Contenido_Security::escapeDB($lang, $db)."', '".Contenido_Security::escapeDB($client, $db)."')";
$db->query($sql); $db->query($sql);
} }
return "0601"; return "0601";
} }
} }
/* Get IDLAY and IDMOD array */ /* Get IDLAY and IDMOD array */
@ -204,10 +189,10 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
a.idlay AS idlay, a.idlay AS idlay,
a.idtpl AS idtpl a.idtpl AS idtpl
FROM FROM
".$cfg["tab"]["tpl"]." AS a, " . $cfg["tab"]["tpl"] . " AS a,
".$cfg["tab"]["tpl_conf"]." AS b " . $cfg["tab"]["tpl_conf"] . " AS b
WHERE WHERE
b.idtplcfg = '".Contenido_Security::toInteger($idtplcfg)."' AND b.idtplcfg = '" . Contenido_Security::toInteger($idtplcfg) . "' AND
b.idtpl = a.idtpl"; b.idtpl = a.idtpl";
$db->query($sql); $db->query($sql);
@ -215,8 +200,7 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
$idlay = $db->f("idlay"); $idlay = $db->f("idlay");
if ($layout != false) if ($layout != false) {
{
$idlay = $layout; $idlay = $layout;
} }
@ -230,16 +214,15 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
number, number,
idmod idmod
FROM FROM
".$cfg["tab"]["container"]." " . $cfg["tab"]["container"] . "
WHERE WHERE
idtpl = '".Contenido_Security::toInteger($idtpl)."' idtpl = '" . Contenido_Security::toInteger($idtpl) . "'
ORDER BY ORDER BY
number ASC"; number ASC";
$db->query($sql); $db->query($sql);
while ($db->next_record()) while ($db->next_record()) {
{
$a_d[$db->f("number")] = $db->f("idmod"); $a_d[$db->f("number")] = $db->f("idmod");
} }
@ -248,39 +231,36 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
$code = AddSlashes($raw_code); $code = AddSlashes($raw_code);
/* Create code for all containers */ /* Create code for all containers */
if ($idlay) if ($idlay) {
{
tplPreparseLayout($idlay, $raw_code); tplPreparseLayout($idlay, $raw_code);
$tmp_returnstring = tplBrowseLayoutForContainers($idlay, $raw_code); $tmp_returnstring = tplBrowseLayoutForContainers($idlay, $raw_code);
$a_container = explode("&", $tmp_returnstring); $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]."'"; $sql = "SELECT * FROM " . $cfg["tab"]["mod"] . " WHERE idmod='" . $a_d[$value] . "'";
$db->query($sql); $db->query($sql);
$db->next_record(); $db->next_record();
if (is_numeric($a_d[$value])) if (is_numeric($a_d[$value])) {
{ $thisModule = '<?php $cCurrentModule = ' . ((int) $a_d[$value]) . '; ?>';
$thisModule = '<?php $cCurrentModule = '. ((int) $a_d[$value]).'; ?>'; $thisContainer = '<?php $cCurrentContainer = ' . ((int) $value) . '; ?>';
$thisContainer = '<?php $cCurrentContainer = '. ((int) $value).'; ?>';
} }
/* dceModFileEdit (c)2009 www.dceonline.de */ /* dceModFileEdit (c)2009 www.dceonline.de */
if($cfg['dceModEdit']['use'] if ($cfg['dceModEdit']['use']
&& ($cfg['dceModEdit']['allModsFromFile'] == true && ($cfg['dceModEdit']['allModsFromFile'] == true
|| in_array((int) $a_d[$value], $cfg['dceModEdit']['modsFromFile']))) { || in_array((int) $a_d[$value], $cfg['dceModEdit']['modsFromFile']))) {
cInclude('classes', 'contenido/class.module.php'); cInclude('classes', 'contenido/class.module.php');
$tmpModule = new cApiModule; $tmpModule = new cApiModule;
$tmpModule->loadByPrimaryKey($a_d[$value]); $tmpModule->loadByPrimaryKey($a_d[$value]);
$output = $thisModule.$thisContainer.$tmpModule->get("output"); $output = $thisModule . $thisContainer . $tmpModule->get("output");
unset($tmpModule); unset($tmpModule);
} else { } else {
$output = $thisModule.$thisContainer.$db->f("output"); $output = $thisModule . $thisContainer . $db->f("output");
} }
/* dceModFileEdit (c)2009 www.dceonline.de */ /* dceModFileEdit (c)2009 www.dceonline.de */
$output = AddSlashes($output)."\n"; $output = AddSlashes($output) . "\n";
$template = $db->f("template"); $template = $db->f("template");
@ -288,69 +268,60 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
$tmp1 = preg_split("/&/", $a_c[$value]); $tmp1 = preg_split("/&/", $a_c[$value]);
$varstring = array (); $varstring = array();
foreach ($tmp1 as $key1 => $value1) foreach ($tmp1 as $key1 => $value1) {
{
$tmp2 = explode("=", $value1); $tmp2 = explode("=", $value1);
foreach ($tmp2 as $key2 => $value2) foreach ($tmp2 as $key2 => $value2) {
{
$varstring["$tmp2[0]"] = $tmp2[1]; $varstring["$tmp2[0]"] = $tmp2[1];
} }
} }
$CiCMS_Var = '$C'.$value.'CMS_VALUE'; $CiCMS_Var = '$C' . $value . 'CMS_VALUE';
$CiCMS_VALUE = ''; $CiCMS_VALUE = '';
foreach ($varstring as $key3 => $value3) foreach ($varstring as $key3 => $value3) {
{
$tmp = urldecode($value3); $tmp = urldecode($value3);
$tmp = str_replace("\'", "'", $tmp); $tmp = str_replace("\'", "'", $tmp);
$CiCMS_VALUE .= $CiCMS_Var.'['.$key3.']="'.$tmp.'"; '; $CiCMS_VALUE .= $CiCMS_Var . '[' . $key3 . ']="' . $tmp . '"; ';
$output = str_replace("\$CMS_VALUE[$key3]", $tmp, $output); $output = str_replace("\$CMS_VALUE[$key3]", $tmp, $output);
$output = str_replace("CMS_VALUE[$key3]", $tmp, $output); $output = str_replace("CMS_VALUE[$key3]", $tmp, $output);
} }
$output = str_replace("CMS_VALUE", $CiCMS_Var, $output); $output = str_replace("CMS_VALUE", $CiCMS_Var, $output);
$output = str_replace("\$".$CiCMS_Var, $CiCMS_Var, $output); $output = str_replace("\$" . $CiCMS_Var, $CiCMS_Var, $output);
$output = preg_replace("/(CMS_VALUE\[)([0-9]*)(\])/i", "", $output); $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';
$fedebug .= "Container: CMS_CONTAINER[$value]".'\\\\n';
} }
if ($frontend_debug["module_display"] == true) if ($frontend_debug["module_display"] == true) {
{ $fedebug .= "Modul: " . $db->f("name") . '\\\\n';
$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';
$fedebug .= 'Eval-Time: $modtime'.$value.'\\\\n'; $output = '<?php $modstart' . $value . ' = getmicrotime(); ?' . '>' . $output . '<?php $modend' . $value . ' = getmicrotime()+0.001; $modtime' . $value . ' = $modend' . $value . ' - $modstart' . $value . '; ?' . '>';
$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 = 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>\'; ?' . '>');
$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 $cModuleTimes["'.$value.'"] = $modtime'.$value.'; ?>'); $output .= addslashes(' <?php $cModuleNames["' . $value . '"] = "' . addslashes($db->f("name")) . '"; ?>');
$output .= addslashes(' <?php $cModuleNames["'.$value.'"] = "'.addslashes($db->f("name")).'"; ?>');
} }
/* Replace new containers */ /* Replace new containers */
$code = preg_replace("/<container( +)id=\\\\\"$value\\\\\"(.*)>(.*)<\/container>/Uis", "CMS_CONTAINER[$value]", $code); $code = preg_replace("/<container( +)id=\\\\\"$value\\\\\"(.*)>(.*)<\/container>/Uis", "CMS_CONTAINER[$value]", $code);
$code = preg_replace("/<container( +)id=\\\\\"$value\\\\\"(.*)\/>/i", "CMS_CONTAINER[$value]", $code); $code = preg_replace("/<container( +)id=\\\\\"$value\\\\\"(.*)\/>/i", "CMS_CONTAINER[$value]", $code);
$code = str_ireplace("CMS_CONTAINER[$value]", "<?php $CiCMS_VALUE ?>\r\n".$output, $code); $code = str_ireplace("CMS_CONTAINER[$value]", "<?php $CiCMS_VALUE ?>\r\n" . $output, $code);
$fedebug = ""; $fedebug = "";
} }
} }
@ -358,23 +329,22 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
$sql = "SELECT $sql = "SELECT
* *
FROM FROM
".$cfg["tab"]["content"]." AS A, " . $cfg["tab"]["content"] . " AS A,
".$cfg["tab"]["art_lang"]." AS B, " . $cfg["tab"]["art_lang"] . " AS B,
".$cfg["tab"]["type"]." AS C " . $cfg["tab"]["type"] . " AS C
WHERE WHERE
A.idtype = C.idtype AND A.idtype = C.idtype AND
A.idartlang = B.idartlang AND A.idartlang = B.idartlang AND
B.idart = '".Contenido_Security::toInteger($idart)."' AND B.idart = '" . Contenido_Security::toInteger($idart) . "' AND
B.idlang = '".Contenido_Security::escapeDB($lang, $db)."'"; B.idlang = '" . Contenido_Security::escapeDB($lang, $db) . "'";
$db->query($sql); $db->query($sql);
while ($db->next_record()) while ($db->next_record()) {
{
$a_content[$db->f("type")][$db->f("typeid")] = $db->f("value"); $a_content[$db->f("type")][$db->f("typeid")] = $db->f("value");
} }
$sql = "SELECT idartlang, pagetitle FROM ".$cfg["tab"]["art_lang"]." WHERE idart='".Contenido_Security::toInteger($idart)."' AND idlang='".Contenido_Security::escapeDB($lang, $db)."'"; $sql = "SELECT idartlang, pagetitle FROM " . $cfg["tab"]["art_lang"] . " WHERE idart='" . Contenido_Security::toInteger($idart) . "' AND idlang='" . Contenido_Security::escapeDB($lang, $db) . "'";
$db->query($sql); $db->query($sql);
$db->next_record(); $db->next_record();
@ -389,87 +359,80 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
} }
/* replace all CMS_TAGS[] */ /* replace all CMS_TAGS[] */
$sql = "SELECT type, code FROM ".$cfg["tab"]["type"]; $sql = "SELECT type, code FROM " . $cfg["tab"]["type"];
$db->query($sql); $db->query($sql);
$match = array (); $match = array();
while ($db->next_record()) while ($db->next_record()) {
{
$tmp = preg_match_all("/(".$db->f("type")."\[+\d+\])/i", $code, $match); $tmp = preg_match_all("/(" . $db->f("type") . "\[+\d+\])/i", $code, $match);
$a_[strtolower($db->f("type"))] = $match[0]; $a_[strtolower($db->f("type"))] = $match[0];
$success = array_walk($a_[strtolower($db->f("type"))], 'extractNumber'); $success = array_walk($a_[strtolower($db->f("type"))], 'extractNumber');
$search = array (); $search = array();
$replacements = array (); $replacements = array();
foreach ($a_[strtolower($db->f("type"))] as $val) foreach ($a_[strtolower($db->f("type"))] as $val) {
{ eval($db->f("code"));
eval ($db->f("code"));
$search[$val] = $db->f("type")."[$val]"; $search[$val] = $db->f("type") . "[$val]";
$replacements[$val] = $tmp; $replacements[$val] = $tmp;
$keycode[$db->f("type")][$val] = $tmp; $keycode[$db->f("type")][$val] = $tmp;
} }
$code = str_ireplace($search, $replacements, $code); $code = str_ireplace($search, $replacements, $code);
} }
/* add/replace title */ /* add/replace title */
if ($pagetitle != "") if ($pagetitle != "") {
{
$code = preg_replace("/<title>.*?<\/title>/is", "{TITLE}", $code, 1); $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); $code = str_ireplace("{TITLE}", addslashes("<title>$pagetitle</title>"), $code);
} else } else {
{ $code = str_ireplace_once("</head>", addslashes("<title>" . $pagetitle . "</title>\n</head>"), $code);
$code = str_ireplace_once("</head>", addslashes("<title>".$pagetitle."</title>\n</head>"), $code);
} }
} else } else {
{
$code = str_replace('<title></title>', '', $code); $code = str_replace('<title></title>', '', $code);
} }
// metatags // metatags
$availableTags = conGetAvailableMetaTagTypes(); $availableTags = conGetAvailableMetaTagTypes();
$metatags = array (); $metatags = array();
foreach ($availableTags as $key => $value) { foreach ($availableTags as $key => $value) {
$metavalue = conGetMetaValue($idartlang, $key); $metavalue = conGetMetaValue($idartlang, $key);
if (strlen($metavalue) > 0) { if (strlen($metavalue) > 0) {
//$metatags[$value["name"]] = array(array("attribute" => $value["fieldname"], "value" => $metavalue), ...); //$metatags[$value["name"]] = array(array("attribute" => $value["fieldname"], "value" => $metavalue), ...);
$metatags[] = array ($value["fieldname"] => $value["name"], 'content' => $metavalue); $metatags[] = array($value["fieldname"] => $value["name"], 'content' => $metavalue);
} }
} }
// generator tag // generator tag
$aVersion = explode('.', $cfg['version']); $aVersion = explode('.', $cfg['version']);
$sCLVersion = $aVersion[0] . '.' . $aVersion[1]; $sCLVersion = $aVersion[0] . '.' . $aVersion[1];
$metatags[] = array ('name' => 'generator', 'content' => 'CMS ConLite ' . $sCLVersion); $metatags[] = array('name' => 'generator', 'content' => 'CMS ConLite ' . $sCLVersion);
// charset/encoding tag // charset/encoding tag
if(getEffectiveSetting('generator', 'html5', "false") == "true") { if (getEffectiveSetting('generator', 'html5', "false") == "true") {
$metatags[] = array('charset' => $encoding[$lang]); $metatags[] = array('charset' => $encoding[$lang]);
} else if(getEffectiveSetting('generator', 'xhtml', "false") == "true") { } else if (getEffectiveSetting('generator', 'xhtml', "false") == "true") {
$metatags[] = array ('http-equiv' => 'Content-Type', 'content' => 'application/xhtml+xml; charset='.$encoding[$lang]); $metatags[] = array('http-equiv' => 'Content-Type', 'content' => 'application/xhtml+xml; charset=' . $encoding[$lang]);
} else { } else {
$metatags[] = array ('http-equiv' => 'Content-Type', 'content' => 'text/html; charset='.$encoding[$lang]); $metatags[] = array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=' . $encoding[$lang]);
} }
// check chains // check chains
$_cecIterator = $_cecRegistry->getIterator("Contenido.Content.CreateMetatags"); $_cecIterator = $_cecRegistry->getIterator("Contenido.Content.CreateMetatags");
if($_cecIterator->count() > 0) { if ($_cecIterator->count() > 0) {
$tmpMetatags = $metatags; $tmpMetatags = $metatags;
if(!is_array($tmpMetatags)) { if (!is_array($tmpMetatags)) {
$tmpMetatags = array(); $tmpMetatags = array();
} }
while($chainEntry = $_cecIterator->next()) { while ($chainEntry = $_cecIterator->next()) {
$tmpMetatags = $chainEntry->execute($tmpMetatags); $tmpMetatags = $chainEntry->execute($tmpMetatags);
} }
@ -477,7 +440,7 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
//system metatags were merged to user meta tags //system metatags were merged to user meta tags
//and user meta tags were not longer replaced by system meta tags //and user meta tags were not longer replaced by system meta tags
/** @todo recode whole meta tag handling */ /** @todo recode whole meta tag handling */
if(is_array($tmpMetatags)) { if (is_array($tmpMetatags)) {
//check for all system meta tags if there is already a user meta tag //check for all system meta tags if there is already a user meta tag
foreach ($tmpMetatags as $aAutValue) { foreach ($tmpMetatags as $aAutValue) {
$bExists = false; $bExists = false;
@ -517,10 +480,11 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
$sMetatags = ''; $sMetatags = '';
foreach ($metatags as $value) { foreach ($metatags as $value) {
if(getEffectiveSetting('generator', 'html5', "false") == "true") { if (getEffectiveSetting('generator', 'html5', "false") == "true") {
if($value['name'] == 'date') continue; if ($value['name'] == 'date')
continue;
} }
if(!empty($value['content'])) { if (!empty($value['content'])) {
$value['content'] = clHtmlEntityDecode($value['content'], ENT_QUOTES, strtoupper($encoding[$lang])); $value['content'] = clHtmlEntityDecode($value['content'], ENT_QUOTES, strtoupper($encoding[$lang]));
$value['content'] = htmlspecialchars_decode($value['content'], ENT_QUOTES); $value['content'] = htmlspecialchars_decode($value['content'], ENT_QUOTES);
} }
@ -532,47 +496,44 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false)
/* HTML does not allow ID for meta tags */ /* HTML does not allow ID for meta tags */
$oMetaTagGen->removeAttribute("id"); $oMetaTagGen->removeAttribute("id");
/*Check if metatag already exists*/ /* Check if metatag already exists */
if (preg_match('/(<meta(?:\s+)name(?:\s*)=(?:\s*)(?:\\\\"|\\\\\')(?:\s*)'.$value["name"].'(?:\s*)(?:\\\\"|\\\\\')(?:[^>]+)>\r?\n?)/i', $code, $aTmetatagfound)) { if (preg_match('/(<meta(?:\s+)name(?:\s*)=(?:\s*)(?:\\\\"|\\\\\')(?:\s*)' . $value["name"] . '(?:\s*)(?:\\\\"|\\\\\')(?:[^>]+)>\r?\n?)/i', $code, $aTmetatagfound)) {
$code = str_replace($aTmetatagfound[1], $oMetaTagGen->render()."\n", $code); $code = str_replace($aTmetatagfound[1], $oMetaTagGen->render() . "\n", $code);
} else if(array_key_exists ("charset", $value) } else if (array_key_exists("charset", $value)
&& preg_match('/(<meta(?:\s+)charset(?:\s*)=(?:\s*)(?:\\\\"|\\\\\')(?:\s*)(.*)(?:\s*)(?:\\\\"|\\\\\')(?:\s*)(?:\s*|\/)(?:[\^\>]+)\r?\n?)/i', $code, $aTmetatagfound)) { && preg_match('/(<meta(?:\s+)charset(?:\s*)=(?:\s*)(?:\\\\"|\\\\\')(?:\s*)(.*)(?:\s*)(?:\\\\"|\\\\\')(?:\s*)(?:\s*|\/)(?:[\^\>]+)\r?\n?)/i', $code, $aTmetatagfound)) {
$code = str_replace($aTmetatagfound[1], $oMetaTagGen->render()."\n", $code); $code = str_replace($aTmetatagfound[1], $oMetaTagGen->render() . "\n", $code);
} else { } else {
$sMetatags .= $oMetaTagGen->render()."\n"; $sMetatags .= $oMetaTagGen->render() . "\n";
} }
} }
/* Add meta tags */ /* Add meta tags */
$code = str_ireplace_once("</head>", $sMetatags."</head>", $code); $code = str_ireplace_once("</head>", $sMetatags . "</head>", $code);
$code = str_ireplace_once("</html>", "<!-- This website is powered by ConLite, the lightweight content management system.\nFor more info and download visit www.conlite.org -->\n</html>", $code); $code = str_ireplace_once("</html>", "<!-- This website is powered by ConLite, the lightweight content management system.\nFor more info and download visit www.conlite.org -->\n</html>", $code);
/* write code into the database */ /* write code into the database */
$date = date("Y-m-d H:i:s"); $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) . "'";
$sql = "SELECT * FROM ".$cfg["tab"]["code"]." WHERE idcatart = '".Contenido_Security::toInteger($idcatart)."' AND idlang = '".Contenido_Security::escapeDB($lang, $db)."'";
$db->query($sql); $db->query($sql);
if ($db->next_record()) if ($db->next_record()) {
{
if ($debug) if ($debug)
echo "UPDATED code for lang:$lang, client:$client, idcatart:$idcatart"; 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)."' $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)."'"; WHERE idcatart='" . Contenido_Security::toInteger($idcatart) . "' AND idlang='" . Contenido_Security::escapeDB($lang, $db) . "'";
$db->query($sql); $db->query($sql);
} else } else {
{
if ($debug) if ($debug)
echo "INSERTED code for lang:$lang, client:$client, idcatart:$idcatart"; 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)."', $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, false)."', '".Contenido_Security::escapeDB($lang, $db)."', '".Contenido_Security::escapeDB($client, $db)."')"; '" . Contenido_Security::escapeDB($code, $db, false) . "', '" . Contenido_Security::escapeDB($lang, $db) . "', '" . Contenido_Security::escapeDB($client, $db) . "')";
$db->query($sql); $db->query($sql);
} }
$sql = "UPDATE ".$cfg["tab"]["cat_art"]." SET createcode = '0' WHERE idcatart='".Contenido_Security::toInteger($idcatart)."'"; $sql = "UPDATE " . $cfg["tab"]["cat_art"] . " SET createcode = '0' WHERE idcatart='" . Contenido_Security::toInteger($idcatart) . "'";
$db->query($sql); $db->query($sql);
} }
@ -629,14 +590,15 @@ function conGetAvailableMetaTagTypes() {
*/ */
function conGetMetaValue($idartlang, $idmetatype) { function conGetMetaValue($idartlang, $idmetatype) {
if($idartlang == 0) return; if ($idartlang == 0)
return;
$oMetaTags = new cApiMetaTagCollection(); $oMetaTags = new cApiMetaTagCollection();
$oMetaTags->setWhere('idartlang', Contenido_Security::toInteger($idartlang)); $oMetaTags->setWhere('idartlang', Contenido_Security::toInteger($idartlang));
$oMetaTags->setWhere('idmetatype', Contenido_Security::toInteger($idmetatype)); $oMetaTags->setWhere('idmetatype', Contenido_Security::toInteger($idmetatype));
$oMetaTags->query(); $oMetaTags->query();
if($oMetaTags->count() > 0) { if ($oMetaTags->count() > 0) {
$sRet = $oMetaTags->next()->get('metavalue'); $sRet = $oMetaTags->next()->get('metavalue');
} else { } else {
$sRet = ""; $sRet = "";
@ -655,26 +617,24 @@ function conGetMetaValue($idartlang, $idmetatype) {
* @author Timo A. Hummel <Timo.Hummel@4fb.de> * @author Timo A. Hummel <Timo.Hummel@4fb.de>
* @copyright four for business AG 2003 * @copyright four for business AG 2003
*/ */
function conSetMetaValue($idartlang, $idmetatype, $value) function conSetMetaValue($idartlang, $idmetatype, $value) {
{
global $cfg; global $cfg;
$db = new DB_ConLite; $db = new DB_ConLite;
$sql = "DELETE FROM ".$cfg["tab"]["meta_tag"]." $sql = "DELETE FROM " . $cfg["tab"]["meta_tag"] . "
WHERE idartlang = '".Contenido_Security::toInteger($idartlang)."' WHERE idartlang = '" . Contenido_Security::toInteger($idartlang) . "'
AND idmetatype = '".Contenido_Security::toInteger($idmetatype)."'"; AND idmetatype = '" . Contenido_Security::toInteger($idmetatype) . "'";
$db->query($sql); $db->query($sql);
$nextid = $db->nextid($cfg["tab"]["meta_tag"]); $nextid = $db->nextid($cfg["tab"]["meta_tag"]);
$sql = "INSERT INTO ".$cfg["tab"]["meta_tag"]." SET idartlang = '".Contenido_Security::toInteger($idartlang)."', $sql = "INSERT INTO " . $cfg["tab"]["meta_tag"] . " SET idartlang = '" . Contenido_Security::toInteger($idartlang) . "',
idmetatype = '".Contenido_Security::toInteger($idmetatype)."', idmetatype = '" . Contenido_Security::toInteger($idmetatype) . "',
idmetatag = '".Contenido_Security::toInteger($nextid)."', idmetatag = '" . Contenido_Security::toInteger($nextid) . "',
metavalue = '".Contenido_Security::escapeDB($value, $db)."'"; metavalue = '" . Contenido_Security::escapeDB($value, $db) . "'";
$db->query($sql); $db->query($sql);
} }
/** /**
@ -688,48 +648,41 @@ function conSetMetaValue($idartlang, $idmetatype, $value)
* Modified : 13.05.2004 * Modified : 13.05.2004
* @copyright four for business AG 2003 * @copyright four for business AG 2003
*/ */
function conGenerateKeywords($client, $lang) function conGenerateKeywords($client, $lang) {
{
global $cfg; global $cfg;
$db_art = new DB_ConLite; $db_art = new DB_ConLite;
$options = array ("img", "link", "linktarget", "swf"); // cms types to be excluded from indexing $options = array("img", "link", "linktarget", "swf"); // cms types to be excluded from indexing
$sql = "SELECT $sql = "SELECT
a.idart, b.idartlang a.idart, b.idartlang
FROM FROM
".$cfg["tab"]["art"]." AS a, " . $cfg["tab"]["art"] . " AS a,
".$cfg["tab"]["art_lang"]." AS b " . $cfg["tab"]["art_lang"] . " AS b
WHERE WHERE
a.idart = b.idart AND a.idart = b.idart AND
a.idclient = ".Contenido_Security::escapeDB($client, $db)." AND a.idclient = " . Contenido_Security::escapeDB($client, $db) . " AND
b.idlang = ".Contenido_Security::escapeDB($lang, $db); b.idlang = " . Contenido_Security::escapeDB($lang, $db);
$db_art->query($sql); $db_art->query($sql);
$articles = array (); $articles = array();
while ($db_art->next_record()) while ($db_art->next_record()) {
{
$articles[$db_art->f("idart")] = $db_art->f("idartlang"); $articles[$db_art->f("idart")] = $db_art->f("idartlang");
} }
if (count($articles) > 0) if (count($articles) > 0) {
{ foreach ($articles as $artid => $article_lang) {
foreach ($articles as $artid => $article_lang) $article_content = array();
{
$article_content = array ();
$article_content = conGetContentFromArticle($article_lang); $article_content = conGetContentFromArticle($article_lang);
if (count($article_content) > 0) if (count($article_content) > 0) {
{
$art_index = new Index($db_art); $art_index = new Index($db_art);
$art_index->lang = $lang; $art_index->lang = $lang;
$art_index->start($artid, $article_content, 'auto', $options); $art_index->start($artid, $article_content, 'auto', $options);
} }
} }
} }
} }
/** /**
@ -742,8 +695,7 @@ function conGenerateKeywords($client, $lang)
* Modified : 13.05.2004 * Modified : 13.05.2004
* @copyright four for business AG 2003 * @copyright four for business AG 2003
*/ */
function conGetContentFromArticle($article_lang) function conGetContentFromArticle($article_lang) {
{
global $cfg; global $cfg;
$db_con = new DB_ConLite; $db_con = new DB_ConLite;
@ -751,22 +703,21 @@ function conGetContentFromArticle($article_lang)
$sql = "SELECT $sql = "SELECT
* *
FROM FROM
".$cfg["tab"]["content"]." AS A, " . $cfg["tab"]["content"] . " AS A,
".$cfg["tab"]["art_lang"]." AS B, " . $cfg["tab"]["art_lang"] . " AS B,
".$cfg["tab"]["type"]." AS C " . $cfg["tab"]["type"] . " AS C
WHERE WHERE
A.idtype = C.idtype AND A.idtype = C.idtype AND
A.idartlang = B.idartlang AND A.idartlang = B.idartlang AND
A.idartlang = '".Contenido_Security::escapeDB($article_lang, $db_con)."' "; A.idartlang = '" . Contenido_Security::escapeDB($article_lang, $db_con) . "' ";
$db_con->query($sql); $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")); $a_content[$db_con->f("type")][$db_con->f("typeid")] = urldecode($db_con->f("value"));
} }
return $a_content; return $a_content;
} }
?> ?>

Datei anzeigen

@ -71,7 +71,7 @@ if (!defined('CL_ENVIRONMENT')) {
*/ */
if (!defined('CL_VERSION')) { if (!defined('CL_VERSION')) {
define('CL_VERSION', '2.1.0'); define('CL_VERSION', '2.1.0');
} }

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. # Contains strict rules, each rewrite exclusion must be set manually.
# - Exclude requests to directories usage/, contenido/, setup/, cms/upload/ # - Exclude requests to directories usage/, conlite/, setup/, cms/upload/
# - Exclude requests to cms/front_content.php # - Exclude requests to cms/front_content.php, cms/dbfs.php
# - Pass thru requests to common ressources (pictures, movies, js, css, pdf) # - 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> # @author Murat Purc <murat@purc.de>
# @copyright four for business AG <www.4fb.de> # @copyright 2019 ConLite Team
# @license http://www.contenido.org/license/LIZENZ.txt # @link http://www.conlite.org
# @link http://www.4fb.de #
# @link http://www.contenido.org # Versions before 1.0 copyright 4fb, author Murat Purc
# #
# $Id$ # $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> <IfModule mod_rewrite.c>
# Enable rewrite engine # Enable rewrite engine
RewriteEngine on RewriteEngine on
# Specify a base URL-path for the rules # Specify a base URL-path for the rules
RewriteBase /cms RewriteBase /cms
# Catch some common exploits in query string to get rid of them. # Catch some common exploits in query string to get rid of them.
# NOTE: Conditions to prevent protocols (ftp, http[s]) in query string could # NOTE: Conditions to prevent protocols (ftp, http[s]) in query string could
# be a disadvantage in some cases. # be a disadvantage in some cases.
@ -42,7 +36,6 @@
RewriteCond %{QUERY_STRING} http[s]*://.*$ [NC] RewriteCond %{QUERY_STRING} http[s]*://.*$ [NC]
RewriteRule ^.* - [F,L] # all matching conditions from above will end in nirvana RewriteRule ^.* - [F,L] # all matching conditions from above will end in nirvana
# Exclude some files and directories from rewriting # Exclude some files and directories from rewriting
RewriteRule ^usage/.*$ - [L] RewriteRule ^usage/.*$ - [L]
RewriteRule ^conlite/.*$ - [L] RewriteRule ^conlite/.*$ - [L]
@ -50,15 +43,14 @@
RewriteRule ^cms/upload/.*$ - [L] RewriteRule ^cms/upload/.*$ - [L]
RewriteRule ^cms/test/.*$ - [L] RewriteRule ^cms/test/.*$ - [L]
RewriteRule ^cms/front_content.php.*$ - [L] RewriteRule ^cms/front_content.php.*$ - [L]
RewriteRule ^cms/dbfs.php.*$ - [L]
# Exclude common extensions from rewriting and pass remaining requests to # Exclude common extensions from rewriting and pass remaining requests to
# front_content.php. # 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> </IfModule>
# Some rules to compress files. # Some rules to compress files.
# NOTE: Following settings are not mod rewrite specific, but enabling mod_deflate # NOTE: Following settings are not mod rewrite specific, but enabling mod_deflate
# for some file types can help to reduce bandwith. # 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. # 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> # @author Murat Purc <murat@purc.de>
# @copyright four for business AG <www.4fb.de> # @copyright 2019 ConLite Team
# @license http://www.contenido.org/license/LIZENZ.txt # @link http://www.conlite.org
# @link http://www.4fb.de #
# @link http://www.contenido.org # Versions before 1.0 copyright 4fb, author Murat Purc
# #
# $Id$ # $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> <IfModule mod_rewrite.c>
# Enable rewrite engine # Enable rewrite engine
RewriteEngine on RewriteEngine on
# Specify a base URL-path for the rules # Specify a base URL-path for the rules
RewriteBase /cms RewriteBase /cms
# Catch some common exploits in query string to get rid of them # Catch some common exploits in query string to get rid of them
# NOTE: Conditions to prevent protocols (ftp, http[s]) in query string could # NOTE: Conditions to prevent protocols (ftp, http[s]) in query string could
# be a disadvantage in some cases # be a disadvantage in some cases
@ -39,11 +33,9 @@
RewriteCond %{QUERY_STRING} http[s]*://.*$ [NC] RewriteCond %{QUERY_STRING} http[s]*://.*$ [NC]
RewriteRule ^.* - [F,L] # all matching conditions from above will end in nirvana RewriteRule ^.* - [F,L] # all matching conditions from above will end in nirvana
# Rewrite request to root to front_content.php # Rewrite request to root to front_content.php
RewriteRule ^$ front_content.php [QSA,L] RewriteRule ^$ front_content.php [QSA,L]
# Exclude following request from rewriting # Exclude following request from rewriting
# tests for favicon.ico, valid symlinks (-s), not empty files (-l) and folders (-d) # tests for favicon.ico, valid symlinks (-s), not empty files (-l) and folders (-d)
RewriteCond %{REQUEST_URI} ^/favicon.ico$ [OR] RewriteCond %{REQUEST_URI} ^/favicon.ico$ [OR]
@ -52,13 +44,11 @@
RewriteCond %{REQUEST_FILENAME} -d RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ - [NC,L]
# Pass other requests to front_content.php # Pass other requests to front_content.php
RewriteRule ^.*$ front_content.php [QSA,NC,L] RewriteRule ^.*$ front_content.php [QSA,NC,L]
</IfModule> </IfModule>
# Some rules to compress files. # Some rules to compress files.
# NOTE: Following settings are not mod rewrite specific, but enabling mod_deflate # NOTE: Following settings are not mod rewrite specific, but enabling mod_deflate
# for some file types can help to reduce bandwith. # for some file types can help to reduce bandwith.