Vars PHP 8.1 updates

This commit is contained in:
markjcrane
2023-05-27 13:06:32 -06:00
parent c92ebd8f0a
commit 2fd25f3621
4 changed files with 104 additions and 80 deletions
+16 -16
View File
@@ -76,17 +76,17 @@ if (!class_exists('vars')) {
}
//delete multiple records
if (is_array($records) && @sizeof($records) != 0) {
if (!empty($records) && @sizeof($records) != 0) {
//build the delete array
foreach ($records as $x => $record) {
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid'];
}
}
//delete the checked rows
if (is_array($array) && @sizeof($array) != 0) {
if (!empty($array) && @sizeof($array) != 0) {
//execute delete
$database = new database;
@@ -128,20 +128,20 @@ if (!class_exists('vars')) {
}
//toggle the checked records
if (is_array($records) && @sizeof($records) != 0) {
if (!empty($records) && @sizeof($records) != 0) {
//get current toggle state
foreach ($records as $x => $record) {
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
$uuids[] = "'".$record['uuid']."'";
}
}
if (is_array($uuids) && @sizeof($uuids) != 0) {
if (!empty($uuids) && @sizeof($uuids) != 0) {
$sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle from v_".$this->table." ";
$sql .= "where ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
$database = new database;
$rows = $database->select($sql, $parameters, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
$rows = $database->select($sql, null, 'all');
if (!empty($rows) && @sizeof($rows) != 0) {
foreach ($rows as $row) {
$states[$row['uuid']] = $row['toggle'];
}
@@ -158,7 +158,7 @@ if (!class_exists('vars')) {
}
//save the changes
if (is_array($array) && @sizeof($array) != 0) {
if (!empty($array) && @sizeof($array) != 0) {
//save the array
$database = new database;
@@ -201,22 +201,22 @@ if (!class_exists('vars')) {
}
//copy the checked records
if (is_array($records) && @sizeof($records) != 0) {
if (!empty($records) && @sizeof($records) != 0) {
//get checked records
foreach ($records as $x => $record) {
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
$uuids[] = "'".$record['uuid']."'";
}
}
//create insert array from existing data
if (is_array($uuids) && @sizeof($uuids) != 0) {
if (!empty($uuids) && @sizeof($uuids) != 0) {
$sql = "select * from v_".$this->table." ";
$sql .= "where ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
$database = new database;
$rows = $database->select($sql, $parameters, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
$rows = $database->select($sql, null, 'all');
if (!empty($rows) && @sizeof($rows) != 0) {
foreach ($rows as $x => $row) {
//copy data
@@ -224,7 +224,7 @@ if (!class_exists('vars')) {
//overwrite
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = uuid();
$array[$this->table][$x]['var_description'] = base64_encode(trim(base64_decode($row['var_description'])).' ('.$text['label-copy'].')');
$array[$this->table][$x]['var_description'] = trim($row['var_description']).' ('.$text['label-copy'].')';
}
}
@@ -232,7 +232,7 @@ if (!class_exists('vars')) {
}
//save the changes and set the message
if (is_array($array) && @sizeof($array) != 0) {
if (!empty($array) && @sizeof($array) != 0) {
//save the array
$database = new database;