fixes PHP 7.3; setup updates for PHP >= 7,0
Dieser Commit ist enthalten in:
Ursprung
b72e0d30f5
Commit
450ad630b5
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Project:
|
* Project:
|
||||||
* Contenido Content Management System
|
* Contenido Content Management System
|
||||||
|
@ -27,8 +28,7 @@
|
||||||
* }}
|
* }}
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
if (!defined('CON_FRAMEWORK')) {
|
||||||
if(!defined('CON_FRAMEWORK')) {
|
|
||||||
die('Illegal call');
|
die('Illegal call');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,10 +153,8 @@ class Version {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static $iDisplayNotification;
|
public static $iDisplayNotification;
|
||||||
|
|
||||||
protected $_bPathError = false;
|
protected $_bPathError = false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Version object constructor, initializes class variables
|
* The Version object constructor, initializes class variables
|
||||||
*
|
*
|
||||||
|
@ -183,7 +181,7 @@ class Version {
|
||||||
self::$iDisplayNotification++;
|
self::$iDisplayNotification++;
|
||||||
|
|
||||||
// Look if versioning is allowed, default is false
|
// Look if versioning is allowed, default is false
|
||||||
if(function_exists('getEffectiveSetting')) {
|
if (function_exists('getEffectiveSetting')) {
|
||||||
$this->bVersionCreatActive = getEffectiveSetting('versioning', 'activated', 'true');
|
$this->bVersionCreatActive = getEffectiveSetting('versioning', 'activated', 'true');
|
||||||
$this->sAlternativePath = getEffectiveSetting('versioning', 'path');
|
$this->sAlternativePath = getEffectiveSetting('versioning', 'path');
|
||||||
} else {
|
} else {
|
||||||
|
@ -191,14 +189,13 @@ class Version {
|
||||||
$this->sAlternativePath = "";
|
$this->sAlternativePath = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->bVersionCreatActive == "true"){
|
if ($this->bVersionCreatActive == "true") {
|
||||||
if(!is_dir($this->sAlternativePath) ){
|
if (!is_dir($this->sAlternativePath)) {
|
||||||
// Alternative Path is not true or is not exist, we use the frontendpath
|
// Alternative Path is not true or is not exist, we use the frontendpath
|
||||||
if($this->sAlternativePath !="" AND self::$iDisplayNotification < 2){
|
if ($this->sAlternativePath != "" AND self::$iDisplayNotification < 2) {
|
||||||
$oNotification = new Contenido_Notification();
|
$oNotification = new Contenido_Notification();
|
||||||
$sNotification = i18n('Alternative path %s does not exist. Version was saved in frondendpath.');
|
$sNotification = i18n('Alternative path %s does not exist. Version was saved in frondendpath.');
|
||||||
$oNotification->displayNotification("warning", sprintf($sNotification, $this->sAlternativePath));
|
$oNotification->displayNotification("warning", sprintf($sNotification, $this->sAlternativePath));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->sAlternativePath = "";
|
$this->sAlternativePath = "";
|
||||||
|
@ -224,7 +221,7 @@ class Version {
|
||||||
|
|
||||||
$bDelete = true;
|
$bDelete = true;
|
||||||
|
|
||||||
while(count($this->aRevisionFiles) >= $sVar AND $bDelete AND (int) $sVar > 0) {
|
while (count($this->aRevisionFiles) >= $sVar AND $bDelete AND (int) $sVar > 0) {
|
||||||
$iIndex = end(array_keys($this->aRevisionFiles));
|
$iIndex = end(array_keys($this->aRevisionFiles));
|
||||||
$bDelete = $this->deleteFile($this->getFirstRevision());
|
$bDelete = $this->deleteFile($this->getFirstRevision());
|
||||||
unset($this->aRevisionFiles[$iIndex]);
|
unset($this->aRevisionFiles[$iIndex]);
|
||||||
|
@ -238,20 +235,20 @@ class Version {
|
||||||
protected function _checkPaths() {
|
protected function _checkPaths() {
|
||||||
$aPath = array('', '/css', '/js', '/layout', '/module', '/templates');
|
$aPath = array('', '/css', '/js', '/layout', '/module', '/templates');
|
||||||
$sFrontEndPath = "";
|
$sFrontEndPath = "";
|
||||||
if($this->sAlternativePath == "") {
|
if ($this->sAlternativePath == "") {
|
||||||
$sFrontEndPath = $this->aCfgClient[$this->iClient]["path"]["frontend"] . "version";
|
$sFrontEndPath = $this->aCfgClient[$this->iClient]["path"]["frontend"] . "version";
|
||||||
} else {
|
} else {
|
||||||
$sFrontEndPath = $this->sAlternativePath . "/" . $this->iClient;
|
$sFrontEndPath = $this->sAlternativePath . "/" . $this->iClient;
|
||||||
}
|
}
|
||||||
if(is_dir($sFrontEndPath) && is_writable($sFrontEndPath)) {
|
if (is_dir($sFrontEndPath) && is_writable($sFrontEndPath)) {
|
||||||
foreach ($aPath as $sSubPath) {
|
foreach ($aPath as $sSubPath) {
|
||||||
if(!is_dir($sFrontEndPath.$sSubPath)){
|
if (!is_dir($sFrontEndPath . $sSubPath)) {
|
||||||
mkdir($sFrontEndPath.$sSubPath, 0777);
|
mkdir($sFrontEndPath . $sSubPath, 0777);
|
||||||
chmod ($sFrontEndPath.$sSubPath, 0777);
|
chmod($sFrontEndPath . $sSubPath, 0777);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
trigger_error("Version path ".$sFrontEndPath." not writable in ".__FILE__." on line ".__LINE__, E_USER_WARNING);
|
trigger_error("Version path " . $sFrontEndPath . " not writable in " . __FILE__ . " on line " . __LINE__, E_USER_WARNING);
|
||||||
$this->_bPathError = true;
|
$this->_bPathError = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -268,7 +265,6 @@ class Version {
|
||||||
*/
|
*/
|
||||||
public function setData($sKey, $sValue) {
|
public function setData($sKey, $sValue) {
|
||||||
$this->aBodyData[$sKey] = $sValue;
|
$this->aBodyData[$sKey] = $sValue;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -277,7 +273,7 @@ class Version {
|
||||||
* @return string returns content of xml file
|
* @return string returns content of xml file
|
||||||
*/
|
*/
|
||||||
public function createNewXml() {
|
public function createNewXml() {
|
||||||
$oXW = new xmlWriter();
|
$oXW = new cXmlWriter();
|
||||||
$oXW->openMemory();
|
$oXW->openMemory();
|
||||||
$oXW->setIndent(true);
|
$oXW->setIndent(true);
|
||||||
$oXW->startDocument('1.0', 'UTF-8');
|
$oXW->startDocument('1.0', 'UTF-8');
|
||||||
|
@ -286,7 +282,7 @@ class Version {
|
||||||
$oXW->writeAttribute('xml:lang', 'de');
|
$oXW->writeAttribute('xml:lang', 'de');
|
||||||
|
|
||||||
$oXW->startElement('head');
|
$oXW->startElement('head');
|
||||||
$oXW->writeElement('version_id', $this->iIdentity.'_'.$this->iVersion);
|
$oXW->writeElement('version_id', $this->iIdentity . '_' . $this->iVersion);
|
||||||
$oXW->writeElement('type', $this->sType);
|
$oXW->writeElement('type', $this->sType);
|
||||||
$oXW->writeElement('date', date("Y-m-d H:i:s"));
|
$oXW->writeElement('date', date("Y-m-d H:i:s"));
|
||||||
$oXW->writeElement('author', $this->sAuthor);
|
$oXW->writeElement('author', $this->sAuthor);
|
||||||
|
@ -314,32 +310,32 @@ class Version {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function createNewVersion() {
|
public function createNewVersion() {
|
||||||
if($this->_bPathError) return false;
|
if ($this->_bPathError)
|
||||||
|
return false;
|
||||||
$bCreate = false;
|
$bCreate = false;
|
||||||
if($this->bVersionCreatActive == "true"){
|
if ($this->bVersionCreatActive == "true") {
|
||||||
try { // Get version Name
|
try { // Get version Name
|
||||||
$sRevisionName = $this->getRevision();
|
$sRevisionName = $this->getRevision();
|
||||||
|
|
||||||
// Create xml version file
|
// Create xml version file
|
||||||
$sXmlFile = $this->createNewXml();
|
$sXmlFile = $this->createNewXml();
|
||||||
|
|
||||||
if(!is_dir($this->getFilePath())){
|
if (!is_dir($this->getFilePath())) {
|
||||||
|
|
||||||
$bCreate = mkdir($this->getFilePath(), 0777);
|
$bCreate = mkdir($this->getFilePath(), 0777);
|
||||||
chmod ($this->getFilePath(), 0777);
|
chmod($this->getFilePath(), 0777);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sHandle = fopen($this->getFilePath().$sRevisionName.'.xml', "w");
|
$sHandle = fopen($this->getFilePath() . $sRevisionName . '.xml', "w");
|
||||||
fputs($sHandle, $sXmlFile);
|
fputs($sHandle, $sXmlFile);
|
||||||
$bCreate = fclose($sHandle);
|
$bCreate = fclose($sHandle);
|
||||||
|
|
||||||
if($bCreate == false){
|
if ($bCreate == false) {
|
||||||
throw new Exception('Couldnt Create New Version');
|
throw new Exception('Couldnt Create New Version');
|
||||||
}
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
} catch(Exception $e) {
|
|
||||||
$bCreate = false;
|
$bCreate = false;
|
||||||
echo '<br>Some error occured: ' . $e->getMessage() . ': ' . $e->getFile() . ' at line '.$e->getLine() . ' ('.$e->getTraceAsString().')';
|
echo '<br>Some error occured: ' . $e->getMessage() . ': ' . $e->getFile() . ' at line ' . $e->getLine() . ' (' . $e->getTraceAsString() . ')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $bCreate;
|
return $bCreate;
|
||||||
|
@ -360,7 +356,7 @@ class Version {
|
||||||
if ($dh = opendir($sDir)) {
|
if ($dh = opendir($sDir)) {
|
||||||
|
|
||||||
while (($file = readdir($dh)) !== false) {
|
while (($file = readdir($dh)) !== false) {
|
||||||
if ($file != '.' && $file != '..'){
|
if ($file != '.' && $file != '..') {
|
||||||
$aData = explode('.', $file);
|
$aData = explode('.', $file);
|
||||||
$aValues = explode('_', $aData[0]);
|
$aValues = explode('_', $aData[0]);
|
||||||
if ($aValues[0] > $this->iRevisionNumber) {
|
if ($aValues[0] > $this->iRevisionNumber) {
|
||||||
|
@ -387,21 +383,21 @@ class Version {
|
||||||
$sDir = $this->getFilePath();
|
$sDir = $this->getFilePath();
|
||||||
|
|
||||||
$bDelet = false;
|
$bDelet = false;
|
||||||
if (is_dir($sDir) AND $sFirstFile =="") {
|
if (is_dir($sDir) AND $sFirstFile == "") {
|
||||||
if ($dh = opendir($sDir)) {
|
if ($dh = opendir($sDir)) {
|
||||||
while (($sFile = readdir($dh)) !== false) {
|
while (($sFile = readdir($dh)) !== false) {
|
||||||
if($sFile != "." && $sFile !=".."){
|
if ($sFile != "." && $sFile != "..") {
|
||||||
// Delete the files
|
// Delete the files
|
||||||
$bDelete = unlink($sDir.$sFile);
|
$bDelete = unlink($sDir . $sFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if the files be cleared, the delete the folder
|
// if the files be cleared, the delete the folder
|
||||||
$bDelete = rmdir($sDir);
|
$bDelete = rmdir($sDir);
|
||||||
}
|
}
|
||||||
} else if($sFirstFile !="") {
|
} else if ($sFirstFile != "") {
|
||||||
$bDelete = unlink($sDir . $sFirstFile);
|
$bDelete = unlink($sDir . $sFirstFile);
|
||||||
}
|
}
|
||||||
if($bDelete){
|
if ($bDelete) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -414,12 +410,12 @@ class Version {
|
||||||
* @return string returns path to revision file
|
* @return string returns path to revision file
|
||||||
*/
|
*/
|
||||||
public function getFilePath() {
|
public function getFilePath() {
|
||||||
if($this->sAlternativePath =="") {
|
if ($this->sAlternativePath == "") {
|
||||||
$sFrontEndPath = $this->aCfgClient[$this->iClient]["path"]["frontend"] . "version/";
|
$sFrontEndPath = $this->aCfgClient[$this->iClient]["path"]["frontend"] . "version/";
|
||||||
} else {
|
} else {
|
||||||
$sFrontEndPath = $this->sAlternativePath . "/" . $this->iClient . "/";
|
$sFrontEndPath = $this->sAlternativePath . "/" . $this->iClient . "/";
|
||||||
}
|
}
|
||||||
return $sFrontEndPath . $this->sType.'/'. $this->iIdentity. '/';
|
return $sFrontEndPath . $this->sType . '/' . $this->iIdentity . '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -437,7 +433,7 @@ class Version {
|
||||||
* @return integer returns number of Revison File
|
* @return integer returns number of Revison File
|
||||||
*/
|
*/
|
||||||
private function getRevision() {
|
private function getRevision() {
|
||||||
$this->iVersion = ($this->iRevisionNumber +1 ).'_'.$this->dActualTimestamp;
|
$this->iVersion = ($this->iRevisionNumber + 1 ) . '_' . $this->dActualTimestamp;
|
||||||
return $this->iVersion;
|
return $this->iVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,7 +450,7 @@ class Version {
|
||||||
|
|
||||||
// to take first element, we use right sort
|
// to take first element, we use right sort
|
||||||
ksort($aKey);
|
ksort($aKey);
|
||||||
foreach($aKey as $value){
|
foreach ($aKey as $value) {
|
||||||
return $sFirstRevision = $value;
|
return $sFirstRevision = $value;
|
||||||
}
|
}
|
||||||
return $sFirstRevision;
|
return $sFirstRevision;
|
||||||
|
@ -476,10 +472,10 @@ class Version {
|
||||||
*/
|
*/
|
||||||
public function getFormatTimestamp() {
|
public function getFormatTimestamp() {
|
||||||
$aTimes = array();
|
$aTimes = array();
|
||||||
if(count($this->dTimestamp) > 0){
|
if (count($this->dTimestamp) > 0) {
|
||||||
krsort($this->dTimestamp);
|
krsort($this->dTimestamp);
|
||||||
foreach($this->dTimestamp as $iKey=>$sTimeValue){
|
foreach ($this->dTimestamp as $iKey => $sTimeValue) {
|
||||||
$aTimes[$this->aRevisionFiles[$iKey]] = date('d.m.Y H:i:s', $sTimeValue). " - Revision: " .$iKey;
|
$aTimes[$this->aRevisionFiles[$iKey]] = date('d.m.Y H:i:s', $sTimeValue) . " - Revision: " . $iKey;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -509,19 +505,19 @@ class Version {
|
||||||
$oForm = new UI_Table_Form("lay_history");
|
$oForm = new UI_Table_Form("lay_history");
|
||||||
$aMessage = array();
|
$aMessage = array();
|
||||||
// if exists xml files
|
// if exists xml files
|
||||||
if(count($this->dTimestamp) > 0) {
|
if (count($this->dTimestamp) > 0) {
|
||||||
|
|
||||||
foreach($this->aVarForm as $sKey=>$sValue) {
|
foreach ($this->aVarForm as $sKey => $sValue) {
|
||||||
$oForm ->setVar($sKey, $sValue);
|
$oForm->setVar($sKey, $sValue);
|
||||||
}
|
}
|
||||||
$aMessage = $this->getMessages();
|
$aMessage = $this->getMessages();
|
||||||
$oForm ->addHeader(i18n($sAddHeader));
|
$oForm->addHeader(i18n($sAddHeader));
|
||||||
$oForm ->add(i18n($sLabelOfSelectBox), $this->getSelectBox($this->getFormatTimestamp(), $sIdOfSelectBox));
|
$oForm->add(i18n($sLabelOfSelectBox), $this->getSelectBox($this->getFormatTimestamp(), $sIdOfSelectBox));
|
||||||
$oForm ->setActionButton("clearhistory", "images/but_delete.gif", $aMessage["alt"], "c", "history_truncate");
|
$oForm->setActionButton("clearhistory", "images/but_delete.gif", $aMessage["alt"], "c", "history_truncate");
|
||||||
$oForm ->setConfirm("clearhistory", $aMessage["alt"], $aMessage["popup"]);
|
$oForm->setConfirm("clearhistory", $aMessage["alt"], $aMessage["popup"]);
|
||||||
$oForm ->setActionButton("submit", "images/but_refresh.gif", i18n("Refresh"), "s");
|
$oForm->setActionButton("submit", "images/but_refresh.gif", i18n("Refresh"), "s");
|
||||||
|
|
||||||
return $oForm ->render().'<div style="margin-top:20px;"></div>';
|
return $oForm->render() . '<div style="margin-top:20px;"></div>';
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
@ -531,34 +527,33 @@ class Version {
|
||||||
* Messagebox for build selectBox. Dynamic allocation for type.
|
* Messagebox for build selectBox. Dynamic allocation for type.
|
||||||
* return array the attributes alt and poput returns
|
* return array the attributes alt and poput returns
|
||||||
*/
|
*/
|
||||||
private function getMessages(){
|
private function getMessages() {
|
||||||
$aMessage = array();
|
$aMessage = array();
|
||||||
switch($this->sType){
|
switch ($this->sType) {
|
||||||
case 'layout':
|
case 'layout':
|
||||||
$aMessage["alt"] = i18n("Clear layout history");
|
$aMessage["alt"] = i18n("Clear layout history");
|
||||||
$aMessage["popup"] = i18n("Do you really want to clear layout history?")."<br><br>".i18n("Note: This only affects the current layout.");
|
$aMessage["popup"] = i18n("Do you really want to clear layout history?") . "<br><br>" . i18n("Note: This only affects the current layout.");
|
||||||
break;
|
break;
|
||||||
case 'module':
|
case 'module':
|
||||||
$aMessage["alt"] = i18n("Clear module history");
|
$aMessage["alt"] = i18n("Clear module history");
|
||||||
$aMessage["popup"] = i18n("Do you really want to clear module history?")."<br><br>".i18n("Note: This only affects the current module.");
|
$aMessage["popup"] = i18n("Do you really want to clear module history?") . "<br><br>" . i18n("Note: This only affects the current module.");
|
||||||
break;
|
break;
|
||||||
case 'css':
|
case 'css':
|
||||||
$aMessage["alt"] = i18n("Clear style history");
|
$aMessage["alt"] = i18n("Clear style history");
|
||||||
$aMessage["popup"] = i18n("Do you really want to clear style history?")."<br><br>".i18n("Note: This only affects the current style.");
|
$aMessage["popup"] = i18n("Do you really want to clear style history?") . "<br><br>" . i18n("Note: This only affects the current style.");
|
||||||
break;
|
break;
|
||||||
case 'js':
|
case 'js':
|
||||||
$aMessage["alt"] = i18n("Clear Java-Script history");
|
$aMessage["alt"] = i18n("Clear Java-Script history");
|
||||||
$aMessage["popup"] = i18n("Do you really want to clear Java-Script history?")."<br><br>".i18n("Note: This only affects the current Java-Script.");
|
$aMessage["popup"] = i18n("Do you really want to clear Java-Script history?") . "<br><br>" . i18n("Note: This only affects the current Java-Script.");
|
||||||
break;
|
break;
|
||||||
case 'templates':
|
case 'templates':
|
||||||
$aMessage["alt"] = i18n("Clear HTML-Template history");
|
$aMessage["alt"] = i18n("Clear HTML-Template history");
|
||||||
$aMessage["popup"] = i18n("Do you really want to clear HTML-Template history?")."<br><br>".i18n("Note: This only the affects current HTML-Template.");
|
$aMessage["popup"] = i18n("Do you really want to clear HTML-Template history?") . "<br><br>" . i18n("Note: This only the affects current HTML-Template.");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$aMessage["alt"] = i18n("Clear history");
|
$aMessage["alt"] = i18n("Clear history");
|
||||||
$aMessage["popup"] = i18n("Do you really want to clear history?")."<br><br>".i18n("Note: This only affects the current history.");
|
$aMessage["popup"] = i18n("Do you really want to clear history?") . "<br><br>" . i18n("Note: This only affects the current history.");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
return $aMessage;
|
return $aMessage;
|
||||||
}
|
}
|
||||||
|
@ -576,7 +571,7 @@ class Version {
|
||||||
$oSelectMenue = new cHTMLSelectElement($sIdOfSelectBox);
|
$oSelectMenue = new cHTMLSelectElement($sIdOfSelectBox);
|
||||||
$oSelectMenue->autoFill($aTempVesions);
|
$oSelectMenue->autoFill($aTempVesions);
|
||||||
|
|
||||||
if($sSelected !=""){
|
if ($sSelected != "") {
|
||||||
$oSelectMenue->setDefault($sSelected);
|
$oSelectMenue->setDefault($sSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -594,7 +589,7 @@ class Version {
|
||||||
* @return string HTML Code of Textarea
|
* @return string HTML Code of Textarea
|
||||||
*/
|
*/
|
||||||
public function getTextarea($sName, $sInitValue, $iWidth, $iHeight, $sId = "") {
|
public function getTextarea($sName, $sInitValue, $iWidth, $iHeight, $sId = "") {
|
||||||
if($sId !="") {
|
if ($sId != "") {
|
||||||
$oHTMLTextarea = new cHTMLTextarea($sName, $sInitValue, $iWidth, $iHeight, $sId);
|
$oHTMLTextarea = new cHTMLTextarea($sName, $sInitValue, $iWidth, $iHeight, $sId);
|
||||||
} else {
|
} else {
|
||||||
$oHTMLTextarea = new cHTMLTextarea($sName, $sInitValue, $iWidth, $iHeight);
|
$oHTMLTextarea = new cHTMLTextarea($sName, $sInitValue, $iWidth, $iHeight);
|
||||||
|
@ -604,7 +599,6 @@ class Version {
|
||||||
$oHTMLTextarea->updateAttributes(array("wrap" => "off"));
|
$oHTMLTextarea->updateAttributes(array("wrap" => "off"));
|
||||||
|
|
||||||
return $oHTMLTextarea->render();
|
return $oHTMLTextarea->render();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -632,7 +626,7 @@ class Version {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function displayNotification($sOutPut) {
|
public function displayNotification($sOutPut) {
|
||||||
if($sOutPut !="") {
|
if ($sOutPut != "") {
|
||||||
print $sOutPut;
|
print $sOutPut;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -644,12 +638,13 @@ class Version {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function setBodyNodeDescription($sDesc) {
|
public function setBodyNodeDescription($sDesc) {
|
||||||
if($sDesc != ""){
|
if ($sDesc != "") {
|
||||||
$this->sDescripion = clHtmlEntities($sDesc);
|
$this->sDescripion = clHtmlEntities($sDesc);
|
||||||
$this->setData("description", $this->sDescripion);
|
$this->setData("description", $this->sDescripion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end of class
|
}
|
||||||
|
|
||||||
|
// end of class
|
||||||
?>
|
?>
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Project:
|
* Project:
|
||||||
* Contenido Content Management System
|
* Contenido Content Management System
|
||||||
|
@ -25,12 +26,11 @@
|
||||||
* }}
|
* }}
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
if (!defined('CON_FRAMEWORK')) {
|
||||||
if(!defined('CON_FRAMEWORK')) {
|
|
||||||
die('Illegal call');
|
die('Illegal call');
|
||||||
}
|
}
|
||||||
|
|
||||||
class VersionImport extends Version {
|
class VersionImport extends Version {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of modul
|
* The name of modul
|
||||||
|
@ -134,25 +134,26 @@ if(!defined('CON_FRAMEWORK')) {
|
||||||
$this->aCfgClient = $aCfgClient;
|
$this->aCfgClient = $aCfgClient;
|
||||||
$this->oDB = $oDB;
|
$this->oDB = $oDB;
|
||||||
|
|
||||||
if(!is_object($this->oDB))
|
if (!is_object($this->oDB))
|
||||||
$this->oDB = new DB_ConLite;
|
$this->oDB = new DB_ConLite;
|
||||||
|
|
||||||
// folder layout
|
// folder layout
|
||||||
$this->sType = "module";
|
$this->sType = "module";
|
||||||
|
|
||||||
|
|
||||||
if(isset($_SESSION["dbprefix"])){
|
if (isset($_SESSION["dbprefix"])) {
|
||||||
$this->sTableName = $_SESSION["dbprefix"]."_mod_history";
|
$this->sTableName = $_SESSION["dbprefix"] . "_mod_history";
|
||||||
} else {
|
} else {
|
||||||
$this->sTableName = $this->aCfg['sql']['sqlprefix']."_mod_history";
|
$this->sTableName = $this->aCfg['sql']['sqlprefix'] . "_mod_history";
|
||||||
}
|
}
|
||||||
// init class member
|
// init class member
|
||||||
$this->aCreateVesion = array();
|
$this->aCreateVesion = array();
|
||||||
|
|
||||||
// Init class members with table con_history
|
// Init class members with table con_history
|
||||||
$this->getModuleHistoryTable();
|
$this->getModuleHistoryTable();
|
||||||
|
}
|
||||||
|
|
||||||
} // end of constructor
|
// end of constructor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creats xml files from table mod_history if exists any rows. After create a version it will be delete the current row.
|
* Creats xml files from table mod_history if exists any rows. After create a version it will be delete the current row.
|
||||||
|
@ -161,17 +162,17 @@ if(!defined('CON_FRAMEWORK')) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function CreateHistoryVersion() {
|
public function CreateHistoryVersion() {
|
||||||
if($this->getRows() > 0) {
|
if ($this->getRows() > 0) {
|
||||||
// Sort the version files true
|
// Sort the version files true
|
||||||
ksort($this->aCreateVersion);
|
ksort($this->aCreateVersion);
|
||||||
|
|
||||||
// All array read
|
// All array read
|
||||||
foreach( $this->aCreateVersion as $sKey=>$sLevelOne) {
|
foreach ($this->aCreateVersion as $sKey => $sLevelOne) {
|
||||||
foreach($sLevelOne as $sKey2=>$sLevelTwo) {
|
foreach ($sLevelOne as $sKey2 => $sLevelTwo) {
|
||||||
if (is_array($this->aCfgClient[$sKey])) {
|
if (is_array($this->aCfgClient[$sKey])) {
|
||||||
parent::__construct($aCfg, $this->aCfgClient, $this->oDB, $sKey, $sArea, $iFrame);
|
parent::__construct($aCfg, $this->aCfgClient, $this->oDB, $sKey, $sArea, $iFrame);
|
||||||
|
|
||||||
foreach($sLevelTwo as $sKey3=>$sLevelThree) {
|
foreach ($sLevelTwo as $sKey3 => $sLevelThree) {
|
||||||
$this->iIdentity = $sKey2;
|
$this->iIdentity = $sKey2;
|
||||||
$this->sName = Contenido_Security::unFilter($sLevelThree["name"]);
|
$this->sName = Contenido_Security::unFilter($sLevelThree["name"]);
|
||||||
$this->sModType = Contenido_Security::unFilter($sLevelThree["type"]);
|
$this->sModType = Contenido_Security::unFilter($sLevelThree["type"]);
|
||||||
|
@ -193,7 +194,7 @@ if(!defined('CON_FRAMEWORK')) {
|
||||||
|
|
||||||
$this->createBodyXML();
|
$this->createBodyXML();
|
||||||
|
|
||||||
if($this->createNewVersion()) {
|
if ($this->createNewVersion()) {
|
||||||
$this->deleteRows($sLevelThree["idmodhistory"]);
|
$this->deleteRows($sLevelThree["idmodhistory"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,12 +204,11 @@ if(!defined('CON_FRAMEWORK')) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if($this->getRows() == 0) {
|
if ($this->getRows() == 0) {
|
||||||
$this->dropTable();
|
$this->dropTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function reads rows variables from table con_mod and init with the class members.
|
* Function reads rows variables from table con_mod and init with the class members.
|
||||||
*
|
*
|
||||||
|
@ -217,20 +217,21 @@ if(!defined('CON_FRAMEWORK')) {
|
||||||
private function getModuleHistoryTable() {
|
private function getModuleHistoryTable() {
|
||||||
$sSql = "";
|
$sSql = "";
|
||||||
$sSql = "SELECT *
|
$sSql = "SELECT *
|
||||||
FROM ". $this->sTableName;
|
FROM " . $this->sTableName;
|
||||||
$this->oDB->query($sSql);
|
$this->oDB->query($sSql);
|
||||||
|
|
||||||
// save mod_history in three dimension array
|
// save mod_history in three dimension array
|
||||||
while($this->oDB->next_record()) {
|
while ($this->oDB->next_record()) {
|
||||||
$this->aCreateVersion[$this->oDB->f("idclient")][$this->oDB->f("idmod")][$this->oDB->f("idmodhistory")] =
|
$this->aCreateVersion[$this->oDB->f("idclient")][$this->oDB->f("idmod")][$this->oDB->f("idmodhistory")] = array("idmodhistory" => $this->oDB->f("idmodhistory"), "idmod" => $this->oDB->f("idmod"),
|
||||||
array("idmodhistory"=>$this->oDB->f("idmodhistory"), "idmod"=>$this->oDB->f("idmod"),
|
"idclient" => $this->oDB->f("idclient"), "name" => $this->oDB->f("name"),
|
||||||
"idclient"=>$this->oDB->f("idclient"), "name"=>$this->oDB->f("name"),
|
"type" => $this->oDB->f("type"), "description" => $this->oDB->f("description"),
|
||||||
"type"=>$this->oDB->f("type"), "description"=>$this->oDB->f("description"),
|
"input" => $this->oDB->f("input"), "output" => $this->oDB->f("output"),
|
||||||
"input"=>$this->oDB->f("input"), "output"=>$this->oDB->f("output"),
|
"template" => $this->oDB->f("template"), "changedby" => $this->oDB->f("changedby"),
|
||||||
"template"=>$this->oDB->f("template"), "changedby"=>$this->oDB->f("changedby"),
|
"changed" => $this->oDB->f("changed"));
|
||||||
"changed"=>$this->oDB->f("changed"));
|
|
||||||
}
|
}
|
||||||
} // end of function
|
}
|
||||||
|
|
||||||
|
// end of function
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set with the body nodes of xml file
|
* Set with the body nodes of xml file
|
||||||
|
@ -250,7 +251,6 @@ if(!defined('CON_FRAMEWORK')) {
|
||||||
$this->setData("Static", $this->sStatic);
|
$this->setData("Static", $this->sStatic);
|
||||||
$this->setData("PackageGuid", $this->sPackageGuid);
|
$this->setData("PackageGuid", $this->sPackageGuid);
|
||||||
$this->setData("PackageData", $this->sPackageData);
|
$this->setData("PackageData", $this->sPackageData);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -261,7 +261,7 @@ if(!defined('CON_FRAMEWORK')) {
|
||||||
private function getRows() {
|
private function getRows() {
|
||||||
$sSqlCount = "";
|
$sSqlCount = "";
|
||||||
$iAnz = 0;
|
$iAnz = 0;
|
||||||
$sSqlCount = "SELECT * FROM ". $this->sTableName;
|
$sSqlCount = "SELECT * FROM " . $this->sTableName;
|
||||||
$this->oDB->query($sSqlCount);
|
$this->oDB->query($sSqlCount);
|
||||||
$iAnz = $this->oDB->num_rows();
|
$iAnz = $this->oDB->num_rows();
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ if(!defined('CON_FRAMEWORK')) {
|
||||||
*/
|
*/
|
||||||
public function dropTable() {
|
public function dropTable() {
|
||||||
$sSqlDropTable = "";
|
$sSqlDropTable = "";
|
||||||
$sSqlDropTable = "DROP TABLE IF EXISTS ". $this->sTableName;
|
$sSqlDropTable = "DROP TABLE IF EXISTS " . $this->sTableName;
|
||||||
$this->oDB->query($sSqlDropTable);
|
$this->oDB->query($sSqlDropTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,11 +286,11 @@ if(!defined('CON_FRAMEWORK')) {
|
||||||
*/
|
*/
|
||||||
public function deleteRows($iModHistory) {
|
public function deleteRows($iModHistory) {
|
||||||
$iModHistory = Contenido_Security::unFilter($iModHistory);
|
$iModHistory = Contenido_Security::unFilter($iModHistory);
|
||||||
$sSql2 = "DELETE FROM ". $this->sTableName .
|
$sSql2 = "DELETE FROM " . $this->sTableName .
|
||||||
" WHERE idmodhistory = ". $iModHistory;
|
" WHERE idmodhistory = " . $iModHistory;
|
||||||
$this->oDB->query($sSql2);
|
$this->oDB->query($sSql2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Laden…
In neuem Issue referenzieren