summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2021-03-25 14:33:38 +0100
committerSimon Rettberg2021-03-25 14:33:38 +0100
commit5918ff8d0ddbaf5b7086bd051f2786ceb1ed6065 (patch)
treec265dd52f2ac078e5ab288fdf3220d469c702fee
parent[remoteaccess] Show plugin version (diff)
downloadslx-admin-5918ff8d0ddbaf5b7086bd051f2786ceb1ed6065.tar.gz
slx-admin-5918ff8d0ddbaf5b7086bd051f2786ceb1ed6065.tar.xz
slx-admin-5918ff8d0ddbaf5b7086bd051f2786ceb1ed6065.zip
Fix deprecated curly braces string indexing (PHP 7.4)
-rw-r--r--apis/clientlog.inc.php2
-rw-r--r--inc/database.inc.php2
-rw-r--r--inc/user.inc.php6
-rw-r--r--inc/util.inc.php2
-rw-r--r--modules-available/minilinux/inc/linuxbootentryhook.inc.php2
-rw-r--r--modules-available/serversetup-bwlp-ipxe/inc/bootentry.inc.php2
-rw-r--r--modules-available/serversetup-bwlp-ipxe/inc/ipxe.inc.php4
-rw-r--r--modules-available/serversetup-bwlp-ipxe/inc/pxelinux.inc.php2
-rw-r--r--modules-available/serversetup-bwlp-ipxe/page.inc.php8
-rw-r--r--modules-available/statistics/api.inc.php8
-rw-r--r--modules-available/statistics/inc/parser.inc.php2
-rw-r--r--modules-available/statistics/inc/statisticsfilter.inc.php2
-rw-r--r--modules-available/sysconfig/addmodule_adauth.inc.php2
-rw-r--r--modules-available/sysconfig/addmodule_branding.inc.php4
-rw-r--r--modules-available/sysconfig/addmodule_ldapauth.inc.php2
-rw-r--r--modules-available/sysconfig/inc/ppd.inc.php20
-rw-r--r--modules-available/syslog/api.inc.php2
-rw-r--r--modules-available/translation/page.inc.php2
18 files changed, 37 insertions, 37 deletions
diff --git a/apis/clientlog.inc.php b/apis/clientlog.inc.php
index b68e4632..29838dfc 100644
--- a/apis/clientlog.inc.php
+++ b/apis/clientlog.inc.php
@@ -9,7 +9,7 @@
if (empty($_POST['type'])) die('Missing options.');
$type = mb_strtolower($_POST['type']);
-if ($type{0} === '~' || $type{0} === '.') {
+if ($type[0] === '~' || $type[0] === '.') {
if (Module::isAvailable('statistics')) {
require 'modules/statistics/api.inc.php';
}
diff --git a/inc/database.inc.php b/inc/database.inc.php
index 3e8ee0f8..a4f7c1b9 100644
--- a/inc/database.inc.php
+++ b/inc/database.inc.php
@@ -292,7 +292,7 @@ class Database
continue;
}
$newkey = $key;
- if ($newkey{0} !== ':') {
+ if ($newkey[0] !== ':') {
$newkey = ":$newkey";
}
$new = array();
diff --git a/inc/user.inc.php b/inc/user.inc.php
index 20e8cd3d..2ad256af 100644
--- a/inc/user.inc.php
+++ b/inc/user.inc.php
@@ -31,7 +31,7 @@ class User
if (!self::isLoggedIn())
return false;
if (Module::isAvailable("permissionmanager")) {
- if ($permission{0} === '.') {
+ if ($permission[0] === '.') {
$permission = substr($permission, 1);
} else {
if (class_exists('Page')) {
@@ -70,7 +70,7 @@ class User
Message::addError('main.no-permission');
Util::redirect($redirect);
} elseif (Module::isAvailable('permissionmanager')) {
- if ($permission{0} !== '.') {
+ if ($permission[0] !== '.') {
$module = Page::getModule();
if ($module !== false) {
$permission = '.' . $module->getIdentifier() . '.' . $permission;
@@ -88,7 +88,7 @@ class User
if (!self::isLoggedIn())
return [];
if (Module::isAvailable("permissionmanager")) {
- if ($permission{0} === '.') {
+ if ($permission[0] === '.') {
$permission = substr($permission, 1);
} else {
$module = Page::getModule();
diff --git a/inc/util.inc.php b/inc/util.inc.php
index 365dc045..fbc894df 100644
--- a/inc/util.inc.php
+++ b/inc/util.inc.php
@@ -268,7 +268,7 @@ SADFACE;
if (empty($path))
return false;
$path = trim($path);
- if ($path{0} == '/' || preg_match('/[\x00-\x19\?\*]/', $path))
+ if ($path[0] == '/' || preg_match('/[\x00-\x19\?\*]/', $path))
return false;
if (strpos($path, '..') !== false)
return false;
diff --git a/modules-available/minilinux/inc/linuxbootentryhook.inc.php b/modules-available/minilinux/inc/linuxbootentryhook.inc.php
index e3090054..e57336f0 100644
--- a/modules-available/minilinux/inc/linuxbootentryhook.inc.php
+++ b/modules-available/minilinux/inc/linuxbootentryhook.inc.php
@@ -162,7 +162,7 @@ class LinuxBootEntryHook extends BootEntryHook
$exec->commandLine = str_replace('%ID%', $effectiveId, $exec->commandLine);
$exec->executable = $root . $exec->executable;
foreach ($exec->initRd as &$rd) {
- if ($rd{0} !== '/') {
+ if ($rd[0] !== '/') {
$rd = $root . $rd;
}
}
diff --git a/modules-available/serversetup-bwlp-ipxe/inc/bootentry.inc.php b/modules-available/serversetup-bwlp-ipxe/inc/bootentry.inc.php
index 614f5ee4..8aef52e7 100644
--- a/modules-available/serversetup-bwlp-ipxe/inc/bootentry.inc.php
+++ b/modules-available/serversetup-bwlp-ipxe/inc/bootentry.inc.php
@@ -37,7 +37,7 @@ abstract class BootEntry
*/
public static function fromJson($module, $data)
{
- if ($module{0} !== '.') {
+ if ($module[0] !== '.') {
// Hook from other module
$hook = Hook::loadSingle($module, 'ipxe-bootentry');
if ($hook === false) {
diff --git a/modules-available/serversetup-bwlp-ipxe/inc/ipxe.inc.php b/modules-available/serversetup-bwlp-ipxe/inc/ipxe.inc.php
index 29885588..e2e90c2a 100644
--- a/modules-available/serversetup-bwlp-ipxe/inc/ipxe.inc.php
+++ b/modules-available/serversetup-bwlp-ipxe/inc/ipxe.inc.php
@@ -466,7 +466,7 @@ class IPxe
$script .= "set netX/{$opt}:{$type} {$args[$i]} || goto %fail%\n";
}
}
- } elseif ($arg{0} === '-') {
+ } elseif ($arg[0] === '-') {
continue;
} elseif ($file === false) {
$file = self::parseFile($arg);
@@ -536,7 +536,7 @@ class IPxe
{
$items = preg_split('/\s+/', $modifier, -1, PREG_SPLIT_NO_EMPTY);
foreach ($items as $item) {
- if ($item{0} === '-') {
+ if ($item[0] === '-') {
$item = preg_quote(substr($item, 1), '/');
$cmdLine = preg_replace('/(^|\s)' . $item . '(=\S*)?($|\s)/', ' ', $cmdLine);
} else {
diff --git a/modules-available/serversetup-bwlp-ipxe/inc/pxelinux.inc.php b/modules-available/serversetup-bwlp-ipxe/inc/pxelinux.inc.php
index 3f406767..13c9a86c 100644
--- a/modules-available/serversetup-bwlp-ipxe/inc/pxelinux.inc.php
+++ b/modules-available/serversetup-bwlp-ipxe/inc/pxelinux.inc.php
@@ -253,7 +253,7 @@ class PxeSection
public function mangle()
{
if (($i = strpos($this->title, '^')) !== false) {
- $this->hotkey = strtoupper($this->title{$i+1});
+ $this->hotkey = strtoupper($this->title[$i+1]);
$this->title = substr($this->title, 0, $i) . substr($this->title, $i + 1);
}
if (strpos($this->append, 'initrd=') !== false) {
diff --git a/modules-available/serversetup-bwlp-ipxe/page.inc.php b/modules-available/serversetup-bwlp-ipxe/page.inc.php
index e31814d1..bc13ab6a 100644
--- a/modules-available/serversetup-bwlp-ipxe/page.inc.php
+++ b/modules-available/serversetup-bwlp-ipxe/page.inc.php
@@ -223,7 +223,7 @@ class Page_ServerSetup extends Page
'snp' => [Dictionary::translate('dl-snp', true) => 63],
];
foreach ($list as $file) {
- if ($file{0} === '.')
+ if ($file[0] === '.')
continue;
if (is_file($file)) {
$base = basename($file);
@@ -430,7 +430,7 @@ class Page_ServerSetup extends Page
foreach ($menu['entrylist'] as &$bootentry) {
if (!isset($bootentry['data']) || !isset($bootentry['module']))
continue;
- if ($bootentry['module']{0} !== '.') {
+ if ($bootentry['module'][0] !== '.') {
// Hook from other module
$bootentry['moduleName'] = Dictionary::translateFileModule($bootentry['module'], 'module', 'module_name');
if (!$bootentry['moduleName']) {
@@ -510,7 +510,7 @@ class Page_ServerSetup extends Page
Message::addError('invalid-boot-entry', $id);
Util::redirect('?do=serversetup');
}
- if ($row['module']{0} === '.') {
+ if ($row['module'][0] === '.') {
// either script or exec entry
$json = json_decode($row['data'], true);
if (!is_array($json)) {
@@ -834,7 +834,7 @@ class Page_ServerSetup extends Page
}
$module = false;
$type = Request::post('type', false, 'string');
- if ($type{0} === '.') {
+ if ($type[0] === '.') {
// Exec or script
if ($type === '.exec') {
$entry = BootEntry::newStandardBootEntry($data);
diff --git a/modules-available/statistics/api.inc.php b/modules-available/statistics/api.inc.php
index 30d1fda9..974432c6 100644
--- a/modules-available/statistics/api.inc.php
+++ b/modules-available/statistics/api.inc.php
@@ -11,17 +11,17 @@ if (substr($ip, 0, 7) === '::ffff:') $ip = substr($ip, 7);
* Power/hw/usage stats
*/
-if ($type{0} === '~') {
+if ($type[0] === '~') {
// UUID is mandatory
$uuid = Request::post('uuid', '', 'string');
$macaddr = Request::post('macaddr', false, 'string');
if ($macaddr !== false) {
$macaddr = strtolower(str_replace(':', '-', $macaddr));
- if (strlen($macaddr) !== 17 || $macaddr{2} !== '-') {
+ if (strlen($macaddr) !== 17 || $macaddr[2] !== '-') {
$macaddr = false;
}
}
- if ($macaddr !== false && $uuid{8} !== '-' && substr($uuid, 0, 16) === '000000000000001-') {
+ if ($macaddr !== false && $uuid[8] !== '-' && substr($uuid, 0, 16) === '000000000000001-') {
$uuid = 'baad1d00-9491-4716-b98b-' . str_replace('-', '', $macaddr);
}
if (strlen($uuid) !== 36 || !preg_match('/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i', $uuid)) {
@@ -427,7 +427,7 @@ function writeClientLog($type, $description)
// For backwards compat, we require the . prefix
-if ($type{0} === '.') {
+if ($type[0] === '.') {
if ($type === '.vmchooser-session') {
$user = Util::cleanUtf8(Request::post('user', 'unknown', 'string'));
$loguser = Request::post('loguser', 0, 'int') !== 0;
diff --git a/modules-available/statistics/inc/parser.inc.php b/modules-available/statistics/inc/parser.inc.php
index bdf021a6..84f98c40 100644
--- a/modules-available/statistics/inc/parser.inc.php
+++ b/modules-available/statistics/inc/parser.inc.php
@@ -23,7 +23,7 @@ class Parser {
if (empty($line)) {
continue;
}
- if ($line{0} !== "\t" && $line{0} !== ' ') {
+ if ($line[0] !== "\t" && $line[0] !== ' ') {
if (isset($ramslot['size'])) {
$row['ramslot'][] = $ramslot;
$ramslot = [];
diff --git a/modules-available/statistics/inc/statisticsfilter.inc.php b/modules-available/statistics/inc/statisticsfilter.inc.php
index ed433e7c..8cbdd780 100644
--- a/modules-available/statistics/inc/statisticsfilter.inc.php
+++ b/modules-available/statistics/inc/statisticsfilter.inc.php
@@ -253,7 +253,7 @@ class SimpleStatisticsFilter extends StatisticsFilter
$args[$key] = $argument;
if (is_array($argument)) {
- if ($operator{0} === '!') {
+ if ($operator[0] === '!') {
$op = 'NOT IN';
} else {
$op = 'IN';
diff --git a/modules-available/sysconfig/addmodule_adauth.inc.php b/modules-available/sysconfig/addmodule_adauth.inc.php
index f2ac206e..9f2a86f6 100644
--- a/modules-available/sysconfig/addmodule_adauth.inc.php
+++ b/modules-available/sysconfig/addmodule_adauth.inc.php
@@ -448,7 +448,7 @@ class AdAuth_HomeDir extends AddModule_Base
foreach (range('D', 'Z') as $l) {
$data['drives'][] = array(
'drive' => $l . ':',
- 'selected' => (strtoupper($letter{0}) === $l) ? 'selected="selected"' : ''
+ 'selected' => (strtoupper($letter[0]) === $l) ? 'selected="selected"' : ''
);
}
Render::addDialog(Dictionary::translateFile('config-module', 'adAuth_title'), false, 'ad_ldap-homedir', $data);
diff --git a/modules-available/sysconfig/addmodule_branding.inc.php b/modules-available/sysconfig/addmodule_branding.inc.php
index d941a7a7..22c42f54 100644
--- a/modules-available/sysconfig/addmodule_branding.inc.php
+++ b/modules-available/sysconfig/addmodule_branding.inc.php
@@ -154,8 +154,8 @@ class Branding_ProcessFile extends AddModule_Base
$parsed = parse_url($absolute);
$path = dirname($parsed['path']);
- if ($relative{0} === '/') {
- if ($relative{1} === '/')
+ if ($relative[0] === '/') {
+ if ($relative[1] === '/')
return "{$parsed['scheme']}:$relative";
$cparts = array_filter(explode("/", $relative));
} else {
diff --git a/modules-available/sysconfig/addmodule_ldapauth.inc.php b/modules-available/sysconfig/addmodule_ldapauth.inc.php
index 606ce381..88007f0c 100644
--- a/modules-available/sysconfig/addmodule_ldapauth.inc.php
+++ b/modules-available/sysconfig/addmodule_ldapauth.inc.php
@@ -219,7 +219,7 @@ class LdapAuth_HomeDir extends AddModule_Base
foreach (range('D', 'Z') as $l) {
$data['drives'][] = array(
'drive' => $l . ':',
- 'selected' => (strtoupper($letter{0}) === $l) ? 'selected="selected"' : ''
+ 'selected' => (strtoupper($letter[0]) === $l) ? 'selected="selected"' : ''
);
}
Render::addDialog(Dictionary::translateFile('config-module', 'ldapAuth_title'), false, 'ad_ldap-homedir', $data);
diff --git a/modules-available/sysconfig/inc/ppd.inc.php b/modules-available/sysconfig/inc/ppd.inc.php
index 9bd5d171..e48f1652 100644
--- a/modules-available/sysconfig/inc/ppd.inc.php
+++ b/modules-available/sysconfig/inc/ppd.inc.php
@@ -320,7 +320,7 @@ class Ppd
$no = 0;
while ($lStart < $this->dataLen && $lEnd !== false) {
unset($mainKeyword, $optionKeyword, $optionTranslation, $option, $value, $valueTranslation);
- if ($no !== 0 && $this->data{$lEnd} === "\r" && $this->data{$lEnd + 1} === "\n") {
+ if ($no !== 0 && $this->data[$lEnd] === "\r" && $this->data[$lEnd + 1] === "\n") {
$lEnd++;
}
if ($no === 1) {
@@ -373,8 +373,8 @@ class Ppd
}
}
// 3) Handle "key [option]: value"
- if ($line{0} === '*') {
- if ($line{1} === '%') {
+ if ($line[0] === '*') {
+ if ($line[1] === '%') {
// Skip comment
continue;
}
@@ -394,7 +394,7 @@ class Ppd
$optionTranslation = isset($out[4]) ? $this->unhexTranslation($no, substr($out[4], 1)) : $optionKeyword; // If no translation given, fallback to option
// 3b) Handle value
$value = $parts[1];
- if ($value{0} === '"') {
+ if ($value[0] === '"') {
// Start of InvocationValue or QuotedValue
if (preg_match(',^"([^"]*)"(/.*)?$,', $value, $vMatch)) {
// Single line
@@ -459,7 +459,7 @@ class Ppd
$this->error = 'Line ' . $no . ': ' . $mainKeyword . ' with no option keyword';
return;
}
- if ($optionKeyword{0} !== '*') {
+ if ($optionKeyword[0] !== '*') {
$this->error = 'Line ' . $no . ': ' . $mainKeyword . " with option keyword that doesn't start with asterisk (*).";
return;
}
@@ -569,7 +569,7 @@ class Ppd
$option = $this->getOption($optionKeyword, $currentBlock);
$option->customParam = new PpdOption($lStart, $len, $value, $valueTranslation);
}
- } elseif ($mainKeyword{0} === '?') {
+ } elseif ($mainKeyword[0] === '?') {
// Ignoring option query for now
} elseif ($optionKeyword === false && !isset($this->KNOWN_KEYWORDS[$mainKeyword])) {
// Must be a definition for an option
@@ -674,7 +674,7 @@ class Ppd
if ($start >= $this->dataLen)
return false;
while ($start < $this->dataLen) {
- $char = $this->data{$start};
+ $char = $this->data[$start];
if ($char === "\r" || $char === "\n")
return $start;
++$start;
@@ -853,10 +853,10 @@ class Ppd
foreach ($ranges as $range) {
$new .= substr($this->data, $last, $range[0] - $last);
$last = $range[1];
- if ($this->data{$last} === "\r") {
+ if ($this->data[$last] === "\r") {
$last++;
}
- if ($this->data{$last} === "\n") {
+ if ($this->data[$last] === "\n") {
$last++;
}
}
@@ -882,7 +882,7 @@ class Ppd
$pos = $setting->default->lineOffset;
} elseif ($setting->block !== false && $setting->block->isUi()) {
$pos = $this->nextLineEnd($setting->block->start);
- while ($pos !== false && $pos < $this->dataLen && ($this->data{$pos} === "\r" || $this->data{$pos} === "\n")) {
+ while ($pos !== false && $pos < $this->dataLen && ($this->data[$pos] === "\r" || $this->data[$pos] === "\n")) {
$pos++;
}
}
diff --git a/modules-available/syslog/api.inc.php b/modules-available/syslog/api.inc.php
index a8a8b0da..da3e1519 100644
--- a/modules-available/syslog/api.inc.php
+++ b/modules-available/syslog/api.inc.php
@@ -64,7 +64,7 @@ $longdesc = '';
if (isset($_POST['longdesc'])) $longdesc = $_POST['longdesc'];
$longdesc = Request::post('longdesc', '', 'string');
-if ($type{0} !== '.' && $type{0} !== '~') {
+if ($type[0] !== '.' && $type[0] !== '~') {
// Spam from IP
$row = Database::queryFirst('SELECT Count(*) AS cnt FROM clientlog WHERE clientip = :client AND dateline + 1800 > UNIX_TIMESTAMP()', array(':client' => $ip));
diff --git a/modules-available/translation/page.inc.php b/modules-available/translation/page.inc.php
index 34389b75..ee1d2cde 100644
--- a/modules-available/translation/page.inc.php
+++ b/modules-available/translation/page.inc.php
@@ -781,7 +781,7 @@ class Page_Translation extends Page
$len = strlen($str);
$depth = 0;
for ($i = 0; $i < $len; ++$i) {
- $char = $str{$i};
+ $char = $str[$i];
// Last char was backslash? Ignore this char
if ($escape) {
$escape = false;