Openlightspeed adminpanel on php8

#1
There are many artifacts left in the admin folder from previous versions of php.
I suggest starting to fix the expired code little by little.
For example: fixes for php8:

--- /usr/local/lsws/admin/html.open.orig/lib/CData.php
+++ /usr/local/lsws/admin/html.open/lib/CData.php
@@ -46,7 +46,7 @@

error_log("Migrate plain conf to xml from $SERVER_ROOT\n");

- if ($SERVER_ROOT{-1} != '/')
+ if ($SERVER_ROOT[-1] != '/')
$SERVER_ROOT .= '/';

define('SERVER_ROOT', $SERVER_ROOT);
@@ -77,7 +77,7 @@
die("Require removexml as input param with value 1 or 0.");

error_log("Migrate xml to plain conf under server root $SERVER_ROOT\n");
- if ($SERVER_ROOT{-1} != '/')
+ if ($SERVER_ROOT[-1] != '/')
$SERVER_ROOT .= '/';

define('SERVER_ROOT', $SERVER_ROOT);
--- /usr/local/lsws/admin/html.open.orig/lib/CValidation.php
+++ /usr/local/lsws/admin/html.open/lib/CValidation.php
@@ -645,7 +645,7 @@
return -1;
}

- $s = $path{0};
+ $s = $path[0];

if (strpos($path, '$VH_NAME') !== false) {
$path = str_replace('$VH_NAME', $this->_disp->Get(DInfo::FLD_ViewName), $path);
@@ -710,7 +710,7 @@
protected function chkAttr_expuri($attr, $node)
{
$val = $node->Get(CNode::FLD_VAL);
- if ($val{0} == '/' || strncmp($val, 'exp:', 4) == 0) {
+ if ($val[0] == '/' || strncmp($val, 'exp:', 4) == 0) {
return 1;
} else {
$node->SetErr('URI must start with "/" or "exp:"');
@@ -721,7 +721,7 @@
protected function chkAttr_url($attr, $node)
{
$val = $node->Get(CNode::FLD_VAL);
- if (( $val{0} != '/' ) && ( strncmp($val, 'http://', 7) != 0 ) && ( strncmp($val, 'https://', 8) != 0 )) {
+ if (( $val[0] != '/' ) && ( strncmp($val, 'http://', 7) != 0 ) && ( strncmp($val, 'https://', 8) != 0 )) {
$node->SetErr('URL must start with "/" or "http(s)://"');
return -1;
}
--- /usr/local/lsws/admin/html.open.orig/lib/DAttrBase.php
+++ /usr/local/lsws/admin/html.open/lib/DAttrBase.php
@@ -250,9 +250,9 @@
$value = $this->extractCheckBoxOr();
else {
$value = UIBase::GrabInput("post", $this->_key);
- if (get_magic_quotes_gpc()) {
- $value = stripslashes($value);
- }
+
+
+
}
$value = str_replace("\r\n", "\n", $value);

--- /usr/local/lsws/admin/html.open.orig/lib/DTblDefBase.php
+++ /usr/local/lsws/admin/html.open/lib/DTblDefBase.php
@@ -104,7 +104,7 @@
return new DAttr($key, 'parse', $label, 'text', $allowNull, $parseformat, $parsehelp, null, $multiInd, $helpKey);
}

- protected static function NewParseTextAreaAttr($key, $label, $parseformat, $parsehelp, $allowNull = true, $row, $helpKey = null, $viewtextarea = 1, $wrapoff = 0, $multiInd = 0)
+ protected static function NewParseTextAreaAttr($key, $label, $parseformat, $parsehelp, $row, $allowNull = true, $helpKey = null, $viewtextarea = 1, $wrapoff = 0, $multiInd = 0)
{
$inputAttr = 'rows="' . $row . '"';
if ($wrapoff == 1)
@@ -114,7 +114,7 @@
return new DAttr($key, 'parse', $label, $type, $allowNull, $parseformat, $parsehelp, $inputAttr, $multiInd, $helpKey);
}

- protected static function NewTextAreaAttr($key, $label, $type, $allowNull = true, $row, $helpKey = null, $viewtextarea = 1, $wrapoff = 0, $multiInd = 0)
+ protected static function NewTextAreaAttr($key, $label, $type, $row, $allowNull = true, $helpKey = null, $viewtextarea = 1, $wrapoff = 0, $multiInd = 0)
{
$inputAttr = 'rows="' . $row . '"';
if ($wrapoff == 1)
--- /usr/local/lsws/admin/html.open.orig/lib/PathTool.php
+++ /usr/local/lsws/admin/html.open/lib/PathTool.php
@@ -5,7 +5,7 @@

public static function getAbsolutePath($root, $path)
{
- if ($path{-1} != '/')
+ if ($path[-1] != '/')
$path .= '/';

$newPath = $this->getAbsoluteFile($root, $path);
@@ -14,7 +14,7 @@

public static function getAbsoluteFile($root, $path)
{
- if ($path{0} != '/')
+ if ($path[0] != '/')
$path = $root . '/' . $path;

$newPath = $this->clean($path);
--- /usr/local/lsws/admin/html.open.orig/lib/PlainConfParser.php
+++ /usr/local/lsws/admin/html.open/lib/PlainConfParser.php
@@ -20,7 +20,7 @@
$parentid = $index - 1;
$level = ($index > 0) ? $this->_list[$parentid][1] + 1 : 0;
$fullpath = $filename;
- if ($filename{0} != '/') {
+ if ($filename[0] != '/') {
if ($parentid) {
$fullpath = $this->_list[$parentid][3] . '/' . $filename;
} else {
 
Top