fixes for PHP 7
Dieser Commit ist enthalten in:
Ursprung
0f907bbfa8
Commit
1360491e94
|
@ -1953,23 +1953,32 @@ function checkMySQLConnectivity() {
|
|||
global $contenido_host, $contenido_database, $contenido_user, $contenido_password, $cfg;
|
||||
|
||||
if ($cfg["database_extension"] == "mysqli") {
|
||||
if (($iPos = strpos($contenido_host, ":")) !== false) {
|
||||
list($sHost, $sPort) = explode(":", $contenido_host);
|
||||
if (function_exists("mysqli_connect")) {
|
||||
if (($iPos = strpos($contenido_host, ":")) !== false) {
|
||||
list($sHost, $sPort) = explode(":", $contenido_host);
|
||||
|
||||
$res = @mysqli_connect($sHost, $contenido_user, $contenido_password, "", $sPort);
|
||||
$res = mysqli_connect($sHost, $contenido_user, $contenido_password, "", $sPort);
|
||||
} else {
|
||||
|
||||
$res = mysqli_connect($contenido_host, $contenido_user, $contenido_password);
|
||||
}
|
||||
} else {
|
||||
$res = @mysqli_connect($contenido_host, $contenido_user, $contenido_password);
|
||||
$res = NULL;
|
||||
}
|
||||
} else {
|
||||
$res = @mysql_connect($contenido_host, $contenido_user, $contenido_password);
|
||||
if(function_exists("mysql_connect")) {
|
||||
$res = mysql_connect($contenido_host, $contenido_user, $contenido_password);
|
||||
} else {
|
||||
$res = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
$selectDb = false;
|
||||
if ($res) {
|
||||
if ($cfg["database_extension"] == "mysqli") {
|
||||
$selectDb = @mysqli_select_db($res, $contenido_database);
|
||||
$selectDb = mysqli_select_db($res, $contenido_database);
|
||||
} else {
|
||||
$selectDb = @mysql_select_db($contenido_database, $res);
|
||||
$selectDb = mysql_select_db($contenido_database, $res);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
|
@ -18,211 +19,188 @@
|
|||
*
|
||||
* $Id: include.lay_edit_form.php 312 2014-06-18 11:01:08Z oldperl $:
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
cInclude("external", "edit_area/class.edit_area.php");
|
||||
|
||||
if (!isset($idlay)) $idlay = 0;
|
||||
if (!isset($idlay))
|
||||
$idlay = 0;
|
||||
|
||||
$page = new cPage;
|
||||
$layout = new cApiLayout();
|
||||
|
||||
if ($idlay != 0)
|
||||
{
|
||||
$layout->loadByPrimaryKey($idlay);
|
||||
if ($idlay != 0) {
|
||||
$layout->loadByPrimaryKey($idlay);
|
||||
}
|
||||
|
||||
if ($action == "lay_new")
|
||||
{
|
||||
if (!$perm->have_perm_area_action_anyitem($area, $action))
|
||||
{
|
||||
$notification->displayNotification("error", i18n("Permission denied"));
|
||||
} else {
|
||||
$layouts = new cApiLayoutCollection;
|
||||
$layout = $layouts->create(i18n("-- New Layout --"));
|
||||
}
|
||||
} elseif ($action == "lay_delete")
|
||||
{
|
||||
if (!$perm->have_perm_area_action_anyitem($area, $action))
|
||||
{
|
||||
$notification->displayNotification("error", i18n("Permission denied"));
|
||||
} else {
|
||||
$errno = layDeleteLayout($idlay);
|
||||
$layout->virgin = true;
|
||||
$sMsg = $notification->returnNotification("info", i18n("Layout deleted"));
|
||||
}
|
||||
if ($action == "lay_new") {
|
||||
if (!$perm->have_perm_area_action_anyitem($area, $action)) {
|
||||
$notification->displayNotification("error", i18n("Permission denied"));
|
||||
} else {
|
||||
$layouts = new cApiLayoutCollection;
|
||||
$layout = $layouts->create(i18n("-- New Layout --"));
|
||||
}
|
||||
} elseif ($action == "lay_delete") {
|
||||
if (!$perm->have_perm_area_action_anyitem($area, $action)) {
|
||||
$notification->displayNotification("error", i18n("Permission denied"));
|
||||
} else {
|
||||
$errno = layDeleteLayout($idlay);
|
||||
$layout->virgin = true;
|
||||
$sMsg = $notification->returnNotification("info", i18n("Layout deleted"));
|
||||
}
|
||||
}
|
||||
|
||||
if ($refreshtemplates != "")
|
||||
{
|
||||
/* Update all templates for containers with mode fixed and mandatory */
|
||||
$sql = "SELECT idtpl FROM ".$cfg["tab"]["tpl"]." WHERE idlay = '".Contenido_Security::toInteger($idlay)."'";
|
||||
$db->query($sql);
|
||||
|
||||
$fillTemplates = array();
|
||||
|
||||
while ($db->next_record())
|
||||
{
|
||||
$fillTemplates[] = $db->f("idtpl");
|
||||
}
|
||||
|
||||
foreach ($fillTemplates as $fillTemplate)
|
||||
{
|
||||
tplAutoFillModules($fillTemplate);
|
||||
}
|
||||
if ($refreshtemplates != "") {
|
||||
/* Update all templates for containers with mode fixed and mandatory */
|
||||
$sql = "SELECT idtpl FROM " . $cfg["tab"]["tpl"] . " WHERE idlay = '" . Contenido_Security::toInteger($idlay) . "'";
|
||||
$db->query($sql);
|
||||
|
||||
$fillTemplates = array();
|
||||
|
||||
while ($db->next_record()) {
|
||||
$fillTemplates[] = $db->f("idtpl");
|
||||
}
|
||||
|
||||
foreach ($fillTemplates as $fillTemplate) {
|
||||
tplAutoFillModules($fillTemplate);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$layout->virgin)
|
||||
{
|
||||
$msg = "";
|
||||
|
||||
if (!$layout->virgin) {
|
||||
$msg = "";
|
||||
|
||||
$tpl->reset();
|
||||
|
||||
$idlay = $layout->get("idlay");
|
||||
$code = $layout->getLayout();
|
||||
$name = $layout->get("name");
|
||||
$description = $layout->get("description");
|
||||
|
||||
/* Search for duplicate containers */
|
||||
tplPreparseLayout($idlay);
|
||||
$ret = tplBrowseLayoutForContainers($idlay);
|
||||
|
||||
if (strlen($ret) != 0)
|
||||
{
|
||||
$containers = explode("&", $ret);
|
||||
|
||||
$types = array();
|
||||
|
||||
foreach ($containers as $value)
|
||||
{
|
||||
if ($value != "") {
|
||||
$container[$value] = 0;
|
||||
|
||||
/* Search for old-style CMS_CONTAINER[x] */
|
||||
$container[$value] += substr_count($code,"CMS_CONTAINER[$value]");
|
||||
$idlay = $layout->get("idlay");
|
||||
$code = $layout->getLayout();
|
||||
$name = $layout->get("name");
|
||||
$description = $layout->get("description");
|
||||
|
||||
/* Search for the new-style containers */
|
||||
$count = preg_match_all("/<container( +)id=\\\\\"$value\\\\\"(.*)>(.*)<\/container>/i", addslashes($code), $matches);
|
||||
/* Search for duplicate containers */
|
||||
tplPreparseLayout($idlay);
|
||||
$ret = tplBrowseLayoutForContainers($idlay);
|
||||
|
||||
$container[$value] += $count;
|
||||
|
||||
if (is_array(tplGetContainerTypes($idlay, $value))) {
|
||||
$types = array_merge($types, tplGetContainerTypes($idlay, $value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$types = array_unique($types);
|
||||
$layout->setProperty("layout", "used-types", implode($types, ";"));
|
||||
|
||||
$msg = "";
|
||||
|
||||
foreach ($container as $key => $value)
|
||||
{
|
||||
if ($value > 1)
|
||||
{
|
||||
$msg .= sprintf(i18n("Container %s was defined %s times"), $key, $value)."<br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (strlen($ret) != 0) {
|
||||
$containers = explode("&", $ret);
|
||||
|
||||
/* Try to validate html */
|
||||
if (getEffectiveSetting("layout", "htmlvalidator", "true") == "true" && $code !== "")
|
||||
{
|
||||
$v = new cHTMLValidator;
|
||||
$v->validate($code);
|
||||
$types = array();
|
||||
|
||||
foreach ($containers as $value) {
|
||||
if ($value != "") {
|
||||
$container[$value] = 0;
|
||||
|
||||
/* Search for old-style CMS_CONTAINER[x] */
|
||||
$container[$value] += substr_count($code, "CMS_CONTAINER[$value]");
|
||||
|
||||
/* Search for the new-style containers */
|
||||
$count = preg_match_all("/<container( +)id=\\\\\"$value\\\\\"(.*)>(.*)<\/container>/i", addslashes($code), $matches);
|
||||
|
||||
$container[$value] += $count;
|
||||
|
||||
if (is_array(tplGetContainerTypes($idlay, $value))) {
|
||||
$types = array_merge($types, tplGetContainerTypes($idlay, $value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$types = array_unique($types);
|
||||
$layout->setProperty("layout", "used-types", implode($types, ";"));
|
||||
|
||||
$msg = "";
|
||||
|
||||
foreach ($container as $key => $value) {
|
||||
if ($value > 1) {
|
||||
$msg .= sprintf(i18n("Container %s was defined %s times"), $key, $value) . "<br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Try to validate html */
|
||||
if (getEffectiveSetting("layout", "htmlvalidator", "true") == "true" && $code !== "") {
|
||||
$v = new cHTMLValidator;
|
||||
$v->validate($code);
|
||||
|
||||
if (!$v->tagExists("body") && !$v->tagExists("BODY")) {
|
||||
$msg .= sprintf(i18n("The body tag does not exist in the layout. This is a requirement for the in-site editing."));
|
||||
$msg .= "<br>";
|
||||
}
|
||||
|
||||
if (!$v->tagExists("head") && !$v->tagExists("HEAD")) {
|
||||
$msg .= sprintf(i18n("The head tag does not exist in the layout. This is a requirement for the in-site editing."));
|
||||
$msg .= "<br>";
|
||||
}
|
||||
|
||||
foreach ($v->missingNodes as $value) {
|
||||
$idqualifier = "";
|
||||
|
||||
$attr = array();
|
||||
|
||||
if ($value["name"] != "") {
|
||||
$attr["name"] = "name '" . $value["name"] . "'";
|
||||
}
|
||||
|
||||
if ($value["id"] != "") {
|
||||
$attr["id"] = "id '" . $value["id"] . "'";
|
||||
}
|
||||
|
||||
$idqualifier = implode(", ", $attr);
|
||||
|
||||
if ($idqualifier != "") {
|
||||
$idqualifier = "($idqualifier)";
|
||||
}
|
||||
$msg .= sprintf(i18n("Tag '%s' %s has no end tag (start tag is on line %s char %s)"), $value["tag"], $idqualifier, $value["line"], $value["char"]);
|
||||
$msg .= "<br>";
|
||||
}
|
||||
}
|
||||
|
||||
if ($msg != "") {
|
||||
$notification->displayNotification("warning", $msg);
|
||||
}
|
||||
|
||||
$form = new UI_Table_Form("module");
|
||||
$form->addHeader(i18n("Edit Layout"));
|
||||
$form->setWidth("100%");
|
||||
$form->setVar("area", $area);
|
||||
$form->setVar("action", "lay_edit");
|
||||
$form->setVar("frame", $frame);
|
||||
$form->setVar("idlay", $idlay);
|
||||
|
||||
$tb_name = new cHTMLTextbox("layname", $name, 60);
|
||||
$ta_description = new cHTMLTextarea("description", $description, 100, 10);
|
||||
$ta_description->setStyle("font-family: monospace;width: 100%;");
|
||||
$ta_description->updateAttributes(array("wrap" => "off"));
|
||||
|
||||
$ta_code = new cHTMLTextarea("code", clHtmlSpecialChars($code), 100, 20, 'code');
|
||||
$ta_code->setStyle("font-family: monospace;width: 100%;");
|
||||
$ta_code->updateAttributes(array("wrap" => "off"));
|
||||
|
||||
$cb_refresh = new cHTMLCheckbox("refreshtemplates", i18n("On save, apply default modules to new containers"));
|
||||
|
||||
$form->add(i18n("Name"), $tb_name);
|
||||
$form->add(i18n("Description"), $ta_description);
|
||||
$form->add(i18n("Code"), $ta_code);
|
||||
$form->add(i18n("Options"), $cb_refresh);
|
||||
|
||||
if (!$v->tagExists("body") && !$v->tagExists("BODY"))
|
||||
{
|
||||
$msg .= sprintf(i18n("The body tag does not exist in the layout. This is a requirement for the in-site editing."));
|
||||
$msg .= "<br>";
|
||||
}
|
||||
|
||||
if (!$v->tagExists("head") && !$v->tagExists("HEAD"))
|
||||
{
|
||||
$msg .= sprintf(i18n("The head tag does not exist in the layout. This is a requirement for the in-site editing."));
|
||||
$msg .= "<br>";
|
||||
}
|
||||
|
||||
foreach ($v->missingNodes as $value)
|
||||
{
|
||||
$idqualifier = "";
|
||||
|
||||
$attr = array();
|
||||
|
||||
if ($value["name"] != "")
|
||||
{
|
||||
$attr["name"] = "name '".$value["name"]."'";
|
||||
}
|
||||
|
||||
if ($value["id"] != "")
|
||||
{
|
||||
$attr["id"] = "id '".$value["id"]."'";
|
||||
}
|
||||
|
||||
$idqualifier = implode(", ",$attr);
|
||||
|
||||
if ($idqualifier != "")
|
||||
{
|
||||
$idqualifier = "($idqualifier)";
|
||||
}
|
||||
$msg .= sprintf(i18n("Tag '%s' %s has no end tag (start tag is on line %s char %s)"), $value["tag"], $idqualifier, $value["line"],$value["char"]);
|
||||
$msg .= "<br>";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($msg != "")
|
||||
{
|
||||
$notification->displayNotification("warning", $msg);
|
||||
}
|
||||
|
||||
$form = new UI_Table_Form("module");
|
||||
$form->addHeader(i18n("Edit Layout"));
|
||||
$form->setWidth("100%");
|
||||
$form->setVar("area", $area);
|
||||
$form->setVar("action", "lay_edit");
|
||||
$form->setVar("frame", $frame);
|
||||
$form->setVar("idlay", $idlay);
|
||||
|
||||
$tb_name = new cHTMLTextbox("layname", $name, 60);
|
||||
$ta_description = new cHTMLTextarea("description", $description,100, 10);
|
||||
$ta_description->setStyle("font-family: monospace;width: 100%;");
|
||||
$ta_description->updateAttributes(array("wrap" => "off"));
|
||||
|
||||
$ta_code = new cHTMLTextarea("code", clHtmlSpecialChars($code), 100,20, 'code');
|
||||
$ta_code->setStyle("font-family: monospace;width: 100%;");
|
||||
$ta_code->updateAttributes(array("wrap" => "off"));
|
||||
|
||||
$cb_refresh = new cHTMLCheckbox("refreshtemplates", i18n("On save, apply default modules to new containers"));
|
||||
|
||||
$form->add(i18n("Name"),$tb_name);
|
||||
$form->add(i18n("Description"),$ta_description);
|
||||
$form->add(i18n("Code"),$ta_code);
|
||||
$form->add(i18n("Options"), $cb_refresh);
|
||||
|
||||
# Set static pointers
|
||||
$tpl->set('s', 'ACTION', $sess->url("main.php?area=$area&frame=$frame&action=lay_edit"));
|
||||
$tpl->set('s', 'IDLAY', $idlay);
|
||||
$tpl->set('s', 'DESCR', $description);
|
||||
$tpl->set('s', 'ACTION', $sess->url("main.php?area=$area&frame=$frame&action=lay_edit"));
|
||||
$tpl->set('s', 'IDLAY', $idlay);
|
||||
$tpl->set('s', 'DESCR', $description);
|
||||
$tpl->set('s', 'CLASS', 'code_sfullwidth');
|
||||
$tpl->set('s', 'NAME', clHtmlSpecialChars($name));
|
||||
|
||||
$tpl->set('s', 'NAME', clHtmlSpecialChars($name));
|
||||
|
||||
# Set dynamic pointers
|
||||
$tpl->set('d', 'CAPTION', i18n("Code").':');
|
||||
$tpl->set('d', 'VALUE', clHtmlSpecialChars($code));
|
||||
$tpl->set('d', 'CAPTION', i18n("Code") . ':');
|
||||
$tpl->set('d', 'VALUE', clHtmlSpecialChars($code));
|
||||
$tpl->set('d', 'CLASS', 'code_fullwidth');
|
||||
$tpl->set('d', 'NAME', 'code');
|
||||
$tpl->set('d', 'NAME', 'code');
|
||||
$tpl->next();
|
||||
|
||||
|
||||
$oEditArea = new EditArea('code', 'html', substr(strtolower($belang), 0, 2), true, $cfg);
|
||||
$page->addScript('editarea', $oEditArea->renderScript());
|
||||
|
||||
|
||||
$sScript = '<script type="text/javascript">
|
||||
if (document.getElementById(\'scroll\')) {
|
||||
document.getElementById(\'scroll\').onmousedown = resizer.triggerClickOn;
|
||||
|
@ -231,11 +209,9 @@ if (!$layout->virgin)
|
|||
document.getElementById(\'scroll\').style.paddingBottom=\'5px\';
|
||||
}
|
||||
</script>';
|
||||
|
||||
$page->setContent($form->render().$sScript);
|
||||
$page->setSubnav("idlay=$idlay", "lay");
|
||||
|
||||
|
||||
$page->setContent($form->render() . $sScript);
|
||||
$page->setSubnav("idlay=$idlay", "lay");
|
||||
} else {
|
||||
unset($idlay);
|
||||
$page->setContent($sMsg);
|
||||
|
@ -248,7 +224,7 @@ if (stripslashes($_REQUEST['idlay'])) {
|
|||
if (left_bottom) {
|
||||
var href = left_bottom.location.href;
|
||||
href = href.replace(/&idlay[^&]*/, '');
|
||||
left_bottom.location.href = href+'&idlay='+'".$_REQUEST['idlay']."';
|
||||
left_bottom.location.href = href+'&idlay='+'" . $_REQUEST['idlay'] . "';
|
||||
|
||||
}
|
||||
</script>";
|
||||
|
|
|
@ -29,7 +29,7 @@ define('CL_BACKUP_START_IMG_OFF', $cfg['path']['contenido_html'] . $cfg['path'][
|
|||
$aMessage = array();
|
||||
$bNoBackup = false;
|
||||
$bFinalStep = false;
|
||||
|
||||
echo CL_BACKUP_PATH;
|
||||
// check backup path
|
||||
if (!is_dir(CL_BACKUP_PATH) || !is_writable(CL_BACKUP_PATH)) {
|
||||
$notification->displayNotification("error", i18n("Backupfolder missing or not writable!"));
|
||||
|
|
|
@ -194,11 +194,10 @@ function logMessage($msg, $PC_writeDir, $PC_useLog, $PC_debug) {
|
|||
}
|
||||
|
||||
function lTrimZeros($number) {
|
||||
|
||||
while ($number[0] == '0') {
|
||||
$number = substr($number, 1);
|
||||
}
|
||||
return $number;
|
||||
return (is_numeric($number))?$number:0;
|
||||
}
|
||||
|
||||
function parseElement($element, &$targetArray, $numberOfElements) {
|
||||
|
@ -436,6 +435,7 @@ class cCronJob {
|
|||
protected $_sCronDir;
|
||||
protected $_sLogDir;
|
||||
private $_bUseLog;
|
||||
private $_iMaxLogFileSize = 1024;
|
||||
|
||||
public function __construct() {
|
||||
$this->_sJobDir = cRegistry::getConfigValue('path', 'conlite') . cRegistry::getConfigValue('path', 'cronjobs');
|
||||
|
@ -467,8 +467,41 @@ class cCronJob {
|
|||
if ($sMsg[strlen($sMsg) - 1] != "\n") {
|
||||
$sMsg .= "\r\n";
|
||||
}
|
||||
$this->_rotateLogFiles($logfile);
|
||||
file_put_contents($logfile, $sMsg, FILE_APPEND);
|
||||
}
|
||||
|
||||
private function _rotateLogFiles($sLogFile) {
|
||||
if (file_exists($sLogFile) &&
|
||||
filesize($sLogFile) >= $this->_iMaxLogFileSize * 1024) {
|
||||
// rotate
|
||||
$path_info = pathinfo($sLogFile);
|
||||
$base_directory = $path_info['dirname'];
|
||||
$base_name = $path_info['basename'];
|
||||
$num_map = array();
|
||||
foreach (new DirectoryIterator($base_directory) as $fInfo) {
|
||||
if ($fInfo->isDot() || !$fInfo->isFile()) {
|
||||
continue;
|
||||
}
|
||||
if (preg_match('/^' . $base_name . '\.?([0-9]*)$/', $fInfo->getFilename(), $matches)) {
|
||||
$num = $matches[1];
|
||||
$file2move = $fInfo->getFilename();
|
||||
if ($num == '') {
|
||||
$num = 0;
|
||||
}
|
||||
$num_map[$num] = $file2move;
|
||||
}
|
||||
}
|
||||
krsort($num_map);
|
||||
foreach ($num_map as $num => $file2move) {
|
||||
$targetN = $num + 1;
|
||||
if($targetN > 10) {
|
||||
unlink($base_directory . DIRECTORY_SEPARATOR . $file2move);
|
||||
continue;
|
||||
}
|
||||
rename($base_directory . DIRECTORY_SEPARATOR . $file2move, $base_directory . DIRECTORY_SEPARATOR .$base_name . '.' . $targetN);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
Laden…
In neuem Issue referenzieren