bugfix #178 - no more use of pear parser, just use php simplexml

Dieser Commit ist enthalten in:
Oldperl 2018-10-06 14:34:07 +00:00
Ursprung 3a467c0c64
Commit 1de9a295ee
1 geänderte Dateien mit 14 neuen und 21 gelöschten Zeilen

Datei anzeigen

@ -418,7 +418,7 @@ class Contenido_UpdateNotifier {
if ($this->sXMLContent != "") {
$this->oXML = simplexml_load_string($this->sXMLContent);
if (!is_object($this->oXML)) {
if ($this->oXML === false || !is_object($this->oXML)) {
$sErrorMessage = i18n('Unable to check for new updates!') . " " . i18n('Could not handle server response!');
$this->sErrorOutput = $this->renderOutput($sErrorMessage);
} else {
@ -522,6 +522,11 @@ class Contenido_UpdateNotifier {
$response = curl_exec($ch);
curl_close($ch);
}
} else {
$source = file_get_contents("http://" .$sHost . $sFile);
if ($source !== false AND ! empty($source)) {
$response = $source;
}
}
return $response;
}
@ -685,34 +690,22 @@ class Contenido_UpdateNotifier {
}
if ($this->sRSSContent != '') {
$sFeedContent = substr($this->sRSSContent, 0, 1024);
$sFeedContent = trim($sFeedContent);
$temp = mb_convert_encoding( file_get_contents($this->sCacheDirectory . $this->sRSSFile), 'UTF-8', "ISO-8859-1" );
$oRss = simplexml_load_file($this->sCacheDirectory . $this->sRSSFile);
$aMatches = array();
$sRegExp = "/<\?xml.*encoding=[\"\'](.*)[\"\']\?>/i";
preg_match($sRegExp, $sFeedContent, $aMatches);
if ($aMatches[1]) {
$oRss = new XML_RSS($this->sCacheDirectory . $this->sRSSFile, $aMatches[1]);
} else {
$oRss = new XML_RSS($this->sCacheDirectory . $this->sRSSFile);
}
$oRss->parse();
//$oRss->parse();
$iCnt = 0;
foreach ($oRss->getItems() as $aItem) {
$sText = clHtmlEntities($aItem['description'], ENT_QUOTES);
foreach ($oRss->channel->item as $aItem) {
$sText = clHtmlEntities(utf8_decode($aItem->description), ENT_QUOTES);
if (strlen($sText) > 150) {
$sText = capiStrTrimAfterWord($sText, 150) . '...';
}
$oTpl->set("d", "NEWS_DATE", $aItem['pubdate']);
$oTpl->set("d", "NEWS_TITLE", $aItem['title']);
$oTpl->set("d", "NEWS_DATE", $aItem->pubdate);
$oTpl->set("d", "NEWS_TITLE", utf8_decode($aItem->title));
$oTpl->set("d", "NEWS_TEXT", $sText);
$oTpl->set("d", "NEWS_URL", $aItem['link']);
$oTpl->set("d", "NEWS_URL", $aItem->link);
$oTpl->set("d", "LABEL_MORE", i18n('read more'));
$oTpl->next();
$iCnt++;