fixes for PHP 7
Dieser Commit ist enthalten in:
Ursprung
60783a9957
Commit
ef7df8a507
|
@ -1953,23 +1953,32 @@ function checkMySQLConnectivity() {
|
|||
global $contenido_host, $contenido_database, $contenido_user, $contenido_password, $cfg;
|
||||
|
||||
if ($cfg["database_extension"] == "mysqli") {
|
||||
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);
|
||||
|
||||
$res = mysqli_connect($contenido_host, $contenido_user, $contenido_password);
|
||||
}
|
||||
} else {
|
||||
$res = @mysql_connect($contenido_host, $contenido_user, $contenido_password);
|
||||
$res = NULL;
|
||||
}
|
||||
} else {
|
||||
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,7 +19,6 @@
|
|||
*
|
||||
* $Id: include.lay_edit_form.php 312 2014-06-18 11:01:08Z oldperl $:
|
||||
*/
|
||||
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
@ -26,29 +26,25 @@ if(!defined('CON_FRAMEWORK')) {
|
|||
|
||||
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)
|
||||
{
|
||||
if ($idlay != 0) {
|
||||
$layout->loadByPrimaryKey($idlay);
|
||||
}
|
||||
|
||||
if ($action == "lay_new")
|
||||
{
|
||||
if (!$perm->have_perm_area_action_anyitem($area, $action))
|
||||
{
|
||||
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))
|
||||
{
|
||||
} elseif ($action == "lay_delete") {
|
||||
if (!$perm->have_perm_area_action_anyitem($area, $action)) {
|
||||
$notification->displayNotification("error", i18n("Permission denied"));
|
||||
} else {
|
||||
$errno = layDeleteLayout($idlay);
|
||||
|
@ -57,27 +53,23 @@ if ($action == "lay_new")
|
|||
}
|
||||
}
|
||||
|
||||
if ($refreshtemplates != "")
|
||||
{
|
||||
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())
|
||||
{
|
||||
while ($db->next_record()) {
|
||||
$fillTemplates[] = $db->f("idtpl");
|
||||
}
|
||||
|
||||
foreach ($fillTemplates as $fillTemplate)
|
||||
{
|
||||
foreach ($fillTemplates as $fillTemplate) {
|
||||
tplAutoFillModules($fillTemplate);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$layout->virgin)
|
||||
{
|
||||
if (!$layout->virgin) {
|
||||
$msg = "";
|
||||
|
||||
$tpl->reset();
|
||||
|
@ -91,14 +83,12 @@ if (!$layout->virgin)
|
|||
tplPreparseLayout($idlay);
|
||||
$ret = tplBrowseLayoutForContainers($idlay);
|
||||
|
||||
if (strlen($ret) != 0)
|
||||
{
|
||||
if (strlen($ret) != 0) {
|
||||
$containers = explode("&", $ret);
|
||||
|
||||
$types = array();
|
||||
|
||||
foreach ($containers as $value)
|
||||
{
|
||||
foreach ($containers as $value) {
|
||||
if ($value != "") {
|
||||
$container[$value] = 0;
|
||||
|
||||
|
@ -121,64 +111,52 @@ if (!$layout->virgin)
|
|||
|
||||
$msg = "";
|
||||
|
||||
foreach ($container as $key => $value)
|
||||
{
|
||||
if ($value > 1)
|
||||
{
|
||||
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 !== "")
|
||||
{
|
||||
if (getEffectiveSetting("layout", "htmlvalidator", "true") == "true" && $code !== "") {
|
||||
$v = new cHTMLValidator;
|
||||
$v->validate($code);
|
||||
|
||||
if (!$v->tagExists("body") && !$v->tagExists("BODY"))
|
||||
{
|
||||
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"))
|
||||
{
|
||||
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)
|
||||
{
|
||||
foreach ($v->missingNodes as $value) {
|
||||
$idqualifier = "";
|
||||
|
||||
$attr = array();
|
||||
|
||||
if ($value["name"] != "")
|
||||
{
|
||||
if ($value["name"] != "") {
|
||||
$attr["name"] = "name '" . $value["name"] . "'";
|
||||
}
|
||||
|
||||
if ($value["id"] != "")
|
||||
{
|
||||
if ($value["id"] != "") {
|
||||
$attr["id"] = "id '" . $value["id"] . "'";
|
||||
}
|
||||
|
||||
$idqualifier = implode(", ", $attr);
|
||||
|
||||
if ($idqualifier != "")
|
||||
{
|
||||
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 != "")
|
||||
{
|
||||
if ($msg != "") {
|
||||
$notification->displayNotification("warning", $msg);
|
||||
}
|
||||
|
||||
|
@ -234,8 +212,6 @@ if (!$layout->virgin)
|
|||
|
||||
$page->setContent($form->render() . $sScript);
|
||||
$page->setSubnav("idlay=$idlay", "lay");
|
||||
|
||||
|
||||
} else {
|
||||
unset($idlay);
|
||||
$page->setContent($sMsg);
|
||||
|
|
|
@ -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