Dieser Commit ist enthalten in:
Oldperl 2019-07-03 19:14:30 +00:00
Ursprung 4ca038a0df
Commit 06b4a295fb
6 geänderte Dateien mit 508 neuen und 549 gelöschten Zeilen

Datei anzeigen

@ -1,34 +1,7 @@
<?php <?php
/**
* Project:
* Contenido Content Management System
*
* Description:
* HTML parser for contenido
*
* Requirements:
* @con_php_req 5.0
*
*
* @package Contenido Backend classes
* @version 1.0.2
* @author Starnetsys, LLC.
* @copyright Starnetsys, LLC.
* @link http://starnetsys.com
* @since file available since contenido release <= 4.6
*
* {@internal
* created unknown
* modified 2008-07-02, Frederic Schneider, add security fix
* modified 2009-10-23, Murat Purc, removed deprecated function (PHP 5.3 ready)
*
* $Id$:
* }}
*
*/
if(!defined('CON_FRAMEWORK')) { if (!defined('CON_FRAMEWORK')) {
die('Illegal call'); die('Illegal call');
} }
/* /*
@ -39,12 +12,12 @@ if(!defined('CON_FRAMEWORK')) {
* website design and software consulting. * website design and software consulting.
*/ */
define ("NODE_TYPE_START",0); define("NODE_TYPE_START", 0);
define ("NODE_TYPE_ELEMENT",1); define("NODE_TYPE_ELEMENT", 1);
define ("NODE_TYPE_ENDELEMENT",2); define("NODE_TYPE_ENDELEMENT", 2);
define ("NODE_TYPE_TEXT",3); define("NODE_TYPE_TEXT", 3);
define ("NODE_TYPE_COMMENT",4); define("NODE_TYPE_COMMENT", 4);
define ("NODE_TYPE_DONE",5); define("NODE_TYPE_DONE", 5);
/** /**
* Class HtmlParser. * Class HtmlParser.
@ -79,7 +52,6 @@ class HtmlParser {
* of the current node. Indexes are always lowercase. * of the current node. Indexes are always lowercase.
*/ */
var $iNodeAttributes; var $iNodeAttributes;
// The following fields should be // The following fields should be
// considered private: // considered private:
@ -87,13 +59,12 @@ class HtmlParser {
var $iHtmlTextLength; var $iHtmlTextLength;
var $iHtmlTextIndex = 0; var $iHtmlTextIndex = 0;
/** /**
* Constructor. * Constructor.
* Constructs an HtmlParser instance with * Constructs an HtmlParser instance with
* the HTML text given. * the HTML text given.
*/ */
function __construct ($aHtmlText) { function __construct($aHtmlText) {
$this->iHtmlText = $aHtmlText; $this->iHtmlText = $aHtmlText;
$this->iHtmlTextLength = strlen($aHtmlText); $this->iHtmlTextLength = strlen($aHtmlText);
} }
@ -124,20 +95,19 @@ class HtmlParser {
$this->iNodeType = NODE_TYPE_DONE; $this->iNodeType = NODE_TYPE_DONE;
return false; return false;
} }
$this->skipInTag ("<"); $this->skipInTag("<");
$this->clearAttributes(); $this->clearAttributes();
$name = $this->skipToBlanksInTag(); $name = $this->skipToBlanksInTag();
$pos = strpos($name, "/"); $pos = strpos($name, "/");
if ($pos === 0) { if ($pos === 0) {
$this->iNodeType = NODE_TYPE_ENDELEMENT; $this->iNodeType = NODE_TYPE_ENDELEMENT;
$this->iNodeName = substr ($name, 1); $this->iNodeName = substr($name, 1);
$this->iNodeValue = ""; $this->iNodeValue = "";
} } else {
else { if (!$this->isValidTagIdentifier($name)) {
if (!$this->isValidTagIdentifier ($name)) {
$comment = false; $comment = false;
if ($name == "!--") { if ($name == "!--") {
$rest = $this->skipToStringInTag ("-->"); $rest = $this->skipToStringInTag("-->");
if ($rest != "") { if ($rest != "") {
$this->iNodeType = NODE_TYPE_COMMENT; $this->iNodeType = NODE_TYPE_COMMENT;
$this->iNodeName = "Comment"; $this->iNodeName = "Comment";
@ -151,18 +121,16 @@ class HtmlParser {
$this->iNodeValue = "<" . $name; $this->iNodeValue = "<" . $name;
} }
return true; return true;
} } else {
else {
$this->iNodeType = NODE_TYPE_ELEMENT; $this->iNodeType = NODE_TYPE_ELEMENT;
$this->iNodeValue = ""; $this->iNodeValue = "";
$nameLength = strlen($name); $nameLength = strlen($name);
if ($nameLength > 0 && substr($name, $nameLength - 1, 1) == "/") { if ($nameLength > 0 && substr($name, $nameLength - 1, 1) == "/") {
$this->iNodeName = substr($name, 0, $nameLength - 1); $this->iNodeName = substr($name, 0, $nameLength - 1);
} } else {
else {
$this->iNodeName = $name; $this->iNodeName = $name;
} }
} }
} }
while ($this->skipBlanksInTag()) { while ($this->skipBlanksInTag()) {
$attrName = $this->skipToBlanksOrEqualsInTag(); $attrName = $this->skipToBlanksOrEqualsInTag();
@ -173,50 +141,47 @@ class HtmlParser {
$this->skipBlanksInTag(); $this->skipBlanksInTag();
$value = $this->readValueInTag(); $value = $this->readValueInTag();
$this->iNodeAttributes[strtolower($attrName)] = $value; $this->iNodeAttributes[strtolower($attrName)] = $value;
} } else {
else {
$this->iNodeAttributes[strtolower($attrName)] = ""; $this->iNodeAttributes[strtolower($attrName)] = "";
} }
} }
} }
$this->skipEndOfTag(); $this->skipEndOfTag();
return true; return true;
} }
function isValidTagIdentifier ($name) { function isValidTagIdentifier($name) {
return preg_match('/[A-Za-z0-9]+/', $name); return preg_match('/[A-Za-z0-9]+/', $name);
} }
function skipBlanksInTag() { function skipBlanksInTag() {
return "" != ($this->skipInTag (array (" ", "\t", "\r", "\n" ))); return "" != ($this->skipInTag(array(" ", "\t", "\r", "\n")));
} }
function skipToBlanksOrEqualsInTag() { function skipToBlanksOrEqualsInTag() {
return $this->skipToInTag (array (" ", "\t", "\r", "\n", "=" )); return $this->skipToInTag(array(" ", "\t", "\r", "\n", "="));
} }
function skipToBlanksInTag() { function skipToBlanksInTag() {
return $this->skipToInTag (array (" ", "\t", "\r", "\n" )); return $this->skipToInTag(array(" ", "\t", "\r", "\n"));
} }
function skipEqualsInTag() { function skipEqualsInTag() {
return $this->skipInTag (array ( "=" )); return $this->skipInTag(array("="));
} }
function readValueInTag() { function readValueInTag() {
$ch = $this->currentChar(); $ch = $this->currentChar();
$value = ""; $value = "";
if ($ch == "\"") { if ($ch == "\"") {
$this->skipInTag (array ( "\"" )); $this->skipInTag(array("\""));
$value = $this->skipToInTag (array ( "\"" )); $value = $this->skipToInTag(array("\""));
$this->skipInTag (array ( "\"" )); $this->skipInTag(array("\""));
} } else if ($ch == "\'") {
else if ($ch == "\'") { $this->skipInTag(array("\'"));
$this->skipInTag (array ( "\'" )); $value = $this->skipToInTag(array("\'"));
$value = $this->skipToInTag (array ( "\'" )); $this->skipInTag(array("\'"));
$this->skipInTag (array ( "\'" )); } else {
}
else {
$value = $this->skipToBlanksInTag(); $value = $this->skipToBlanksInTag();
} }
return $value; return $value;
@ -233,8 +198,7 @@ class HtmlParser {
if ($this->iHtmlTextIndex < $this->iHtmlTextLength) { if ($this->iHtmlTextIndex < $this->iHtmlTextLength) {
$this->iHtmlTextIndex++; $this->iHtmlTextIndex++;
return true; return true;
} } else {
else {
return false; return false;
} }
} }
@ -252,14 +216,19 @@ class HtmlParser {
return $sb; return $sb;
} }
function skipInTag ($chars) { function skipInTag($chars) {
$sb = ""; $sb = "";
while (($ch = $this->currentChar()) !== -1) { while (($ch = $this->currentChar()) !== -1) {
if ($ch == ">") { if ($ch == ">") {
return $sb; return $sb;
} else { } else {
$match = false; $match = false;
for ($idx = 0; $idx < count($chars); $idx++) { if(is_countable($chars)) {
$int_cnt_chars = count($chars);
} else {
$int_cnt_chars = strlen($chars);
}
for ($idx = 0; $idx < $int_cnt_chars; $idx++) {
if ($ch == $chars[$idx]) { if ($ch == $chars[$idx]) {
$match = true; $match = true;
break; break;
@ -275,12 +244,17 @@ class HtmlParser {
return $sb; return $sb;
} }
function skipToInTag ($chars) { function skipToInTag($chars) {
$sb = ""; $sb = "";
while (($ch = $this->currentChar()) !== -1) { while (($ch = $this->currentChar()) !== -1) {
$match = $ch == ">"; $match = $ch == ">";
if (!$match) { if (!$match) {
for ($idx = 0; $idx < count($chars); $idx++) { if(is_countable($chars)) {
$int_cnt_chars = count($chars);
} else {
$int_cnt_chars = strlen($chars);
}
for ($idx = 0; $idx < $int_cnt_chars; $idx++) {
if ($ch == $chars[$idx]) { if ($ch == $chars[$idx]) {
$match = true; $match = true;
break; break;
@ -305,7 +279,7 @@ class HtmlParser {
$sb .= $ch; $sb .= $ch;
$this->moveNext(); $this->moveNext();
} }
return $sb; return $sb;
} }
/** /**
@ -314,16 +288,15 @@ class HtmlParser {
* after the location of $needle, or not moved at all * after the location of $needle, or not moved at all
* if nothing is found. * if nothing is found.
*/ */
function skipToStringInTag ($needle) { function skipToStringInTag($needle) {
$pos = strpos ($this->iHtmlText, $needle, $this->iHtmlTextIndex); $pos = strpos($this->iHtmlText, $needle, $this->iHtmlTextIndex);
if ($pos === false) { if ($pos === false) {
return ""; return "";
} }
$top = $pos + strlen($needle); $top = $pos + strlen($needle);
$retvalue = substr ($this->iHtmlText, $this->iHtmlTextIndex, $top - $this->iHtmlTextIndex); $retvalue = substr($this->iHtmlText, $this->iHtmlTextIndex, $top - $this->iHtmlTextIndex);
$this->iHtmlTextIndex = $top; $this->iHtmlTextIndex = $top;
return $retvalue; return $retvalue;
} }
}
?> }

Datei anzeigen

@ -328,7 +328,9 @@ class PropertyCollection extends ItemCollection
public function getAllValues($field, $fieldValue, $auth=NULL) public function getAllValues($field, $fieldValue, $auth=NULL)
{ {
$authString = ''; $authString = '';
if (!is_null($auth) && sizeof($auth) > 0) { if (!is_null($auth)
&& is_countable($auth)
&& sizeof($auth) > 0) {
$authString .= " AND author = '" . $auth->auth["uid"] . "'"; $authString .= " AND author = '" . $auth->auth["uid"] . "'";
} }

Datei anzeigen

@ -56,7 +56,7 @@ class cTinyMCEEditor extends cWYSIWYGEditor {
*/ */
var $_bUseGZIP = false; var $_bUseGZIP = false;
function cTinyMCEEditor($sEditorName, $sEditorContent) { public function __construct($sEditorName, $sEditorContent) {
global $belang, $cfg, $cfgClient, $client, $lang, $idart; global $belang, $cfg, $cfgClient, $client, $lang, $idart;
parent::__construct($sEditorName, $sEditorContent); parent::__construct($sEditorName, $sEditorContent);

Datei anzeigen

@ -1,6 +1,38 @@
<?php <?php
/**
* PHP 7.3 functions for older PHP versions
*
* @package Core
* @subpackage functions
* @version $Rev$
* @since 2.0.3
* @author Ortwin Pinke <o.pinke@conlite.org>
* @copyright (c) 2019, conlite.org
* @license http://www.gnu.de/documents/gpl.en.html GPL v3 (english version)
* @license http://www.gnu.de/documents/gpl.de.html GPL v3 (deutsche Version)
* @link http://www.conlite.org ConLite.org
*
* $Id$
*/
// security check
defined('CON_FRAMEWORK') or die('Illegal call');
if (!function_exists('is_countable')) { if (!function_exists('is_countable')) {
/**
* Verify that the contents of a variable is a countable value
* <p>Verify that the contents of a variable is an <code>array</code> or an object implementing Countable</p>
* @param mixed $var <p>The value to check</p>
* @return bool <p>Returns <b><code>TRUE</code></b> if <code>var</code> is countable, <b><code>FALSE</code></b> otherwise.</p>
* @link http://php.net/manual/en/function.is-countable.php
*
* @param Countable $var
* @return boolean
*/
function is_countable($var) { function is_countable($var) {
return (is_array($var) || $var instanceof Countable); return (is_array($var) || $var instanceof Countable);
} }
} }

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei anzeigen

@ -347,7 +347,7 @@ class MetaTagCreatorHtml5 {
*/ */
protected function _checkCacheFile() { protected function _checkCacheFile() {
if(file_exists($this->_sCacheFile)) { if(file_exists($this->_sCacheFile)) {
$iDiff = mktime() - filemtime($this->_sCacheFile); $iDiff = time() - filemtime($this->_sCacheFile);
if($iDiff < $this->_aConfig['cachetime']) { if($iDiff < $this->_aConfig['cachetime']) {
return true; return true;
} }