diff --git a/plugins/cacti/plugin.php b/plugins/cacti/plugin.php index 942d16342..6da342a1c 100644 --- a/plugins/cacti/plugin.php +++ b/plugins/cacti/plugin.php @@ -253,7 +253,7 @@ function printNewItemTR () echo ''; echo ''; echo ''; - echo "${server['num_graphs']}"; + echo "{$server['num_graphs']}"; echo '' . getImageHREF ('save', 'update this server', TRUE) . ''; echo ''; } @@ -268,7 +268,7 @@ function printNewItemTR ($servers) { $options = array(); foreach ($servers as $server) - $options[$server['id']] = "${server['id']}: ${server['base_url']}"; + $options[$server['id']] = "{$server['id']}: {$server['base_url']}"; echo ""; echo "\n"; printOpFormIntro ('add'); @@ -292,13 +292,13 @@ function printNewItemTR ($servers) foreach (getCactiGraphsForObject ($object_id) as $graph_id => $graph) { $cacti_url = $servers[$graph['server_id']]['base_url']; - $text = "(graph ${graph_id} on server ${graph['server_id']})"; + $text = "(graph {$graph_id} on server {$graph['server_id']})"; echo "\n"; } echo "
 ServerGraph IDCaption 
"; - echo ""; - echo "${text}"; + echo ""; + echo "{$text}"; if(permitted ('object', 'cacti', 'del')) echo getOpLink (array ('op' => 'del', 'server_id' => $graph['server_id'], 'graph_id' => $graph_id), '', 'Cut', 'Unlink graph', 'need-confirmation'); - echo "   ${graph['caption']}"; + echo "   {$graph['caption']}"; echo "
\n"; @@ -314,7 +314,7 @@ function proxyCactiRequest ($server_id, $graph_id) if (! array_key_exists ($server_id, $servers)) throw new InvalidRequestArgException ('server_id', $server_id); $cacti_url = $servers[$server_id]['base_url']; - $url = "${cacti_url}/graph_image.php?action=view&local_graph_id=${graph_id}&rra_id=" . getConfigVar ('CACTI_RRA_ID'); + $url = "{$cacti_url}/graph_image.php?action=view&local_graph_id={$graph_id}&rra_id=" . getConfigVar ('CACTI_RRA_ID'); $postvars = 'action=login&login_username=' . $servers[$server_id]['username']; $postvars .= '&login_password=' . $servers[$server_id]['password']; diff --git a/plugins/munin/plugin.php b/plugins/munin/plugin.php index cf53e24bd..14954182f 100644 --- a/plugins/munin/plugin.php +++ b/plugins/munin/plugin.php @@ -248,7 +248,7 @@ function printNewItemTR () echo getOpLink (array ('op' => 'del', 'id' => $server['id']), '', 'destroy', 'delete this server'); echo ''; echo ''; - echo "${server['num_graphs']}"; + echo "{$server['num_graphs']}"; echo '' . getImageHREF ('save', 'update this server', TRUE) . ''; echo ''; } @@ -263,7 +263,7 @@ function printNewItem ($servers) { $options = array(); foreach ($servers as $server) - $options[$server['id']] = "${server['id']}: ${server['base_url']}"; + $options[$server['id']] = "{$server['id']}: {$server['base_url']}"; echo ""; echo "\n"; printOpFormIntro ('add'); @@ -300,13 +300,13 @@ function printNewItem ($servers) foreach (getMuninGraphsForObject ($object_id) as $graph_name => $graph) { $munin_url = $servers[$graph['server_id']]['base_url']; - $text = "(graph ${graph_name} on server ${graph['server_id']})"; + $text = "(graph {$graph_name} on server {$graph['server_id']})"; echo ""; + echo ""; + echo "{$text}"; echo "\n"; } echo "
 ServerGraphCaption 
"; - echo ""; - echo "${text}"; echo getOpLink (array ('op' => 'del', 'server_id' => $graph['server_id'], 'graph' => $graph_name), '', 'Cut', 'Unlink graph', 'need-confirmation'); - echo "   ${graph['caption']}"; + echo "   {$graph['caption']}"; echo "
\n"; @@ -331,7 +331,7 @@ function proxyMuninRequest ($server_id, $graph) if (! array_key_exists ($server_id, $servers)) throw new InvalidRequestArgException ('server_id', $server_id); $munin_url = $servers[$server_id]['base_url']; - $url = "${munin_url}/${domain}/${host}.${domain}/${graph}-day.png"; + $url = "{$munin_url}/{$domain}/{$host}.{$domain}/{$graph}-day.png"; $session = curl_init (); diff --git a/scripts/syncdomain.php b/scripts/syncdomain.php index 55691df21..6c3f5bdbe 100755 --- a/scripts/syncdomain.php +++ b/scripts/syncdomain.php @@ -32,7 +32,7 @@ function print_message_line($text, $flags = 0) global $options; if (! array_key_exists ('verbose', $options) and $flags & PML_VERBOSE) return; - $buff = date (DATE_RFC1123) . ": ${text}\n"; + $buff = date (DATE_RFC1123) . ": {$text}\n"; echo $buff; if (array_key_exists ('stderr', $options) and ! ($flags & PML_NOTICE)) fwrite (STDERR, $buff); @@ -75,7 +75,7 @@ function print_message_line($text, $flags = 0) $filename = '/var/tmp/RackTables-syncdomain-' . $domain_key . '.pid'; if (FALSE === $fp = @fopen ($filename, 'c+')) { - print_message_line ("Failed to open ${filename}"); + print_message_line ("Failed to open {$filename}"); exit (1); } $wouldblock = 0; @@ -85,19 +85,19 @@ function print_message_line($text, $flags = 0) $stat = fstat ($fp); if (! isset ($stat['mtime'])) { - print_message_line ("Failed to obtain mtime of ${filename}"); + print_message_line ("Failed to obtain mtime of {$filename}"); exit (1); } $pidfile_mtime = $stat['mtime']; if ($current_time < $pidfile_mtime) { - print_message_line ("Warning: pidfile ${filename} mtime is in future!"); + print_message_line ("Warning: pidfile {$filename} mtime is in future!"); exit (1); } // don't indicate failure unless the pidfile is 15 minutes or more old if ($current_time < $pidfile_mtime + 15 * 60) exit (0); - print_message_line ("Failed to lock ${filename}, already locked by PID " . trim (fgets ($fp, 10))); + print_message_line ("Failed to lock {$filename}, already locked by PID " . trim (fgets ($fp, 10))); exit (1); } @@ -166,11 +166,11 @@ function print_message_line($text, $flags = 0) $flags = PML_NOTICE; if (! $portsdone) $flags |= PML_VERBOSE; - print_message_line ("Done '${object['dname']}': ${portsdone}", $flags); + print_message_line ("Done '{$object['dname']}': {$portsdone}", $flags); } catch (RackTablesError $e) { - print_message_line ("FAILED '${object['dname']}': " . $e->getMessage()); + print_message_line ("FAILED '{$object['dname']}': " . $e->getMessage()); } if ($i_am_child) exit (0); @@ -180,7 +180,7 @@ function print_message_line($text, $flags = 0) if (++$switchesdone == $max) { - print_message_line ("Maximum of ${max} items reached, terminating", PML_NOTICE|PML_VERBOSE); + print_message_line ("Maximum of {$max} items reached, terminating", PML_NOTICE|PML_VERBOSE); break; } } @@ -197,7 +197,7 @@ function print_message_line($text, $flags = 0) flock ($fp, LOCK_UN); // explicitly unlock file as PHP 5.3.2 made it mandatory if (FALSE === unlink ($filename)) { - print_message_line ("Failed removing pidfile ${filename}"); + print_message_line ("Failed removing pidfile {$filename}"); exit (1); } } diff --git a/tests/GetChildrenListTest.php b/tests/GetChildrenListTest.php index 75e728d87..e86cd0da3 100644 --- a/tests/GetChildrenListTest.php +++ b/tests/GetChildrenListTest.php @@ -16,7 +16,7 @@ public static function setUpBeforeClass () : void self::$locations[] = $parent_location_id = commitAddObject (self::myStringStatic ('location 0', __CLASS__), NULL, 1562, NULL); for ($i=1; $i<=self::$num_children; $i++) { - $child_location_id = commitAddObject (self::myStringStatic ("location ${i}", __CLASS__), NULL, 1562, NULL); + $child_location_id = commitAddObject (self::myStringStatic ("location {$i}", __CLASS__), NULL, 1562, NULL); self::$locations[] = $child_location_id; commitLinkEntities ('location', $parent_location_id, 'location', $child_location_id); self::$links[] = lastInsertID(); @@ -30,7 +30,7 @@ public static function setUpBeforeClass () : void self::$objects[] = $parent_object_id = commitAddObject (self::myStringStatic ('object 0', __CLASS__), NULL, self::$objtype_id, NULL); for ($i=1; $i<=self::$num_children; $i++) { - $child_object_id = commitAddObject (self::myStringStatic ("object ${i}", __CLASS__), NULL, self::$objtype_id, NULL); + $child_object_id = commitAddObject (self::myStringStatic ("object {$i}", __CLASS__), NULL, self::$objtype_id, NULL); self::$objects[] = $child_object_id; commitLinkEntities ('object', $parent_object_id, 'object', $child_object_id); self::$links[] = lastInsertID(); @@ -42,7 +42,7 @@ public static function setUpBeforeClass () : void self::$tags[] = $parent_tag_id = lastInsertID (); for ($i=1; $i<=self::$num_children; $i++) { - usePreparedInsertBlade ('TagTree', array ('parent_id' => $parent_tag_id, 'tag' => self::myStringStatic ("tag ${i}", __CLASS__))); + usePreparedInsertBlade ('TagTree', array ('parent_id' => $parent_tag_id, 'tag' => self::myStringStatic ("tag {$i}", __CLASS__))); $parent_tag_id = lastInsertID (); self::$tags[] = $parent_tag_id; } diff --git a/tests/RackspaceFunctionsTest.php b/tests/RackspaceFunctionsTest.php index c7289d277..23b0c9e85 100644 --- a/tests/RackspaceFunctionsTest.php +++ b/tests/RackspaceFunctionsTest.php @@ -53,7 +53,7 @@ private function createSampleRacksAndObjects ($racklist) foreach ($objectlist as $each) { list ($prefix, $objtype_id, $unit_nos) = $each; - $object_id = $this->createObjectInRack ("${prefix}-${rack_id}", $objtype_id, $rack_id, $unit_nos); + $object_id = $this->createObjectInRack ("{$prefix}-{$rack_id}", $objtype_id, $rack_id, $unit_nos); $ret[$rack_id][$object_id] = count ($unit_nos); } $i++; diff --git a/tests/TagFunctionsTest.php b/tests/TagFunctionsTest.php index 385056a0e..fe8372a22 100644 --- a/tests/TagFunctionsTest.php +++ b/tests/TagFunctionsTest.php @@ -25,9 +25,9 @@ public function setUp() : void $this->b_tag_ids = array(); for ($i = 0; $i < self::NUM_TAGS; $i++) { - usePreparedInsertBlade ('TagTree', array ('tag' => $this->myString ("tag a${i}"), 'color' => self::COLOR_A + $i)); + usePreparedInsertBlade ('TagTree', array ('tag' => $this->myString ("tag a{$i}"), 'color' => self::COLOR_A + $i)); $this->a_tag_ids[] = lastInsertID(); - usePreparedInsertBlade ('TagTree', array ('tag' => $this->myString ("tag b${i}"), 'color' => self::COLOR_B)); + usePreparedInsertBlade ('TagTree', array ('tag' => $this->myString ("tag b{$i}"), 'color' => self::COLOR_B)); $this->b_tag_ids[] = lastInsertID(); } $taglist = addTraceToNodes (getTagList()); diff --git a/tests/UpgradeTest.php b/tests/UpgradeTest.php index f302433b1..ee67eed76 100644 --- a/tests/UpgradeTest.php +++ b/tests/UpgradeTest.php @@ -34,31 +34,31 @@ public function testUpgrades () $dbver = $version; $db_name = getDBName(); $mysql_bin = '/usr/bin/mysql'; - $dbxlink->exec ("DROP DATABASE ${db_name}"); - $dbxlink->exec ("CREATE DATABASE ${db_name} CHARACTER SET utf8 COLLATE utf8_general_ci"); + $dbxlink->exec ("DROP DATABASE {$db_name}"); + $dbxlink->exec ("CREATE DATABASE {$db_name} CHARACTER SET utf8 COLLATE utf8_general_ci"); // FIXME: Importing the dump for 0.20.0 (and likely for the subsequent releases) fails when the configured // MySQL username is different from "racktables", which is the recorded trigger definer in the file. // A quick workaround, which may be not appropriate for a production server, is to grant the SUPER privilege: // mysql> GRANT SUPER ON *.* TO racktables_user@localhost; - exec ("${mysql_bin} --user=${db_username} --password=${db_password} ${db_name} < ./data/${version}.sql", $output, $exitcode); - $this->assertEquals (0, $exitcode, "Populating the ${version} database failed"); + exec ("{$mysql_bin} --user={$db_username} --password={$db_password} {$db_name} < ./data/{$version}.sql", $output, $exitcode); + $this->assertEquals (0, $exitcode, "Populating the {$version} database failed"); // the DB was deleted & re-created, so the current connection is invalid; re-connect connectDB (); $path = getDBUpgradePath ($version, CODE_VERSION); - $this->assertNotNull ($path, "Empty upgrade path when upgrading from ${version}"); + $this->assertNotNull ($path, "Empty upgrade path when upgrading from {$version}"); foreach ($path as $batchid) { ob_start (); executeUpgradeBatch ($batchid); $output = ob_get_clean (); - $this->assertNotContains ('queries failed', $output, "Upgrading from ${version} failed at ${batchid}"); + $this->assertNotContains ('queries failed', $output, "Upgrading from {$version} failed at {$batchid}"); } ob_start (); executeUpgradeBatch ('dictionary'); $output = ob_get_clean (); - $this->assertNotContains ('queries failed', $output, "Upgrading from ${version} failed when reloading dictionary"); + $this->assertNotContains ('queries failed', $output, "Upgrading from {$version} failed when reloading dictionary"); } } } diff --git a/wwwroot/inc/ajax-interface.php b/wwwroot/inc/ajax-interface.php index c658a0e4f..0bd384cc6 100644 --- a/wwwroot/inc/ajax-interface.php +++ b/wwwroot/inc/ajax-interface.php @@ -136,10 +136,10 @@ function getLocationSelectAJAX() { if ($location['id'] == $current_location_id) continue; - echo ""; + echo "style='font-weight: bold'>{$location['name']}"; if ($location['kidc'] > 0) printLocationChildrenSelectOptions ($location, $selected_id, $current_location_id); } diff --git a/wwwroot/inc/auth.php b/wwwroot/inc/auth.php index cb559e2d8..19f0933a7 100644 --- a/wwwroot/inc/auth.php +++ b/wwwroot/inc/auth.php @@ -220,7 +220,7 @@ function gotClearanceForTagChain ($const_base) } break; default: - throw new RackTablesError ("Can't process sentence of unknown type '${sentence['type']}'", RackTablesError::INTERNAL); + throw new RackTablesError ("Can't process sentence of unknown type '{$sentence['type']}'", RackTablesError::INTERNAL); } } return FALSE; @@ -573,7 +573,7 @@ function queryLDAPServer ($username, $password) RackTablesError::MISCONFIGURED ); } - $results = @ldap_search ($connect, $LDAP_options['search_dn'], '(' . $LDAP_options['search_attr'] . "=${username})", array("dn")); + $results = @ldap_search ($connect, $LDAP_options['search_dn'], '(' . $LDAP_options['search_attr'] . "={$username})", array("dn")); if ($results === FALSE) return array ('result' => 'CAN'); if (@ldap_count_entries ($connect, $results) != 1) @@ -614,7 +614,7 @@ function queryLDAPServer ($username, $password) ( $connect, $LDAP_options['search_dn'], - '(' . $LDAP_options['search_attr'] . "=${username})", + '(' . $LDAP_options['search_attr'] . "={$username})", array_merge (array ($LDAP_options['group_attr']), explode (' ', $LDAP_options['displayname_attrs'])) ); if (@ldap_count_entries ($connect, $results) != 1) diff --git a/wwwroot/inc/breed-hpprocurveN1178.php b/wwwroot/inc/breed-hpprocurveN1178.php index 5225851f2..dbfc6a1b9 100644 --- a/wwwroot/inc/breed-hpprocurveN1178.php +++ b/wwwroot/inc/breed-hpprocurveN1178.php @@ -266,14 +266,14 @@ function hpprocurveN1178TranslatePushQueue ($dummy_object_id, $queue, $dummy_vla switch ($cmd['opcode']) { case 'create VLAN': - $ret .= "vlan ${cmd['arg1']}\nexit\n"; + $ret .= "vlan {$cmd['arg1']}\nexit\n"; break; case 'destroy VLAN': - $ret .= "no vlan ${cmd['arg1']}\n"; + $ret .= "no vlan {$cmd['arg1']}\n"; break; case 'add allowed': foreach ($cmd['vlans'] as $vlan_id) - $ret .= "vlan ${vlan_id} tagged ${cmd['port']}\n"; + $ret .= "vlan {$vlan_id} tagged {$cmd['port']}\n"; /////////////////////////////////////////////////////////////////////////////////////// // Here is a workaround: remove untagged port for case access->trunk(non-native) if @@ -283,7 +283,7 @@ function hpprocurveN1178TranslatePushQueue ($dummy_object_id, $queue, $dummy_vla $unset_access_data['port_id'] === $cmd['port'] ) { - $ret .= "no vlan ${unset_access_data['vlan_id']} untagged ${unset_access_data['port_id']}\n"; + $ret .= "no vlan {$unset_access_data['vlan_id']} untagged {$unset_access_data['port_id']}\n"; unset ($unset_access_data); } /////////////////////////////////////////////////////////////////////////////////////// @@ -293,13 +293,13 @@ function hpprocurveN1178TranslatePushQueue ($dummy_object_id, $queue, $dummy_vla if (! empty ($port_id) && $port_id === $cmd['port']) foreach ($vlan_list as $key => $vlan_id) if (isset ($vlan_id)) - $ret .= "no vlan ${vlan_id} tagged ${port_id}\n"; + $ret .= "no vlan {$vlan_id} tagged {$port_id}\n"; $rem_tagged_data = array(); break; case 'rem allowed': foreach ($cmd['vlans'] as $vlan_id) { - $ret .= "no vlan ${vlan_id} tagged ${cmd['port']}\n"; + $ret .= "no vlan {$vlan_id} tagged {$cmd['port']}\n"; /////////////////////////////////////////////////////////////////////////////////////// // Here is a workaround: we should remove untagged port before // add it as tagged for case access->trunk(non-native) @@ -309,7 +309,7 @@ function hpprocurveN1178TranslatePushQueue ($dummy_object_id, $queue, $dummy_vla } break; case 'set access': - $ret .= "vlan ${cmd['arg2']} untagged ${cmd['arg1']}\n"; + $ret .= "vlan {$cmd['arg2']} untagged {$cmd['arg1']}\n"; /////////////////////////////////////////////////////////////////////////////////////// // Now remove tagged port for case trunk(non-native)->access //file_put_contents ('/var/log/racktables.log', var_export($rem_allowed_data, true), FILE_APPEND | LOCK_EX); @@ -317,7 +317,7 @@ function hpprocurveN1178TranslatePushQueue ($dummy_object_id, $queue, $dummy_vla if (! empty ($port_id) && $port_id === $cmd['arg1'] ) foreach ($vlan_list as $key => $vlan_id) if (isset ($vlan_id)) - $ret .= "no vlan ${vlan_id} tagged ${cmd['arg1']}\n"; + $ret .= "no vlan {$vlan_id} tagged {$cmd['arg1']}\n"; $rem_allowed_data = array(); break; case 'unset access': @@ -327,18 +327,18 @@ function hpprocurveN1178TranslatePushQueue ($dummy_object_id, $queue, $dummy_vla // HP L2 switches doesn't allow "orphaned" ports (without tags) $unset_access_data['port_id'] = $cmd['arg1']; $unset_access_data['vlan_id'] = $cmd['arg2']; - $ret .= "no vlan ${cmd['arg2']} untagged ${cmd['arg1']}\n"; + $ret .= "no vlan {$cmd['arg2']} untagged {$cmd['arg1']}\n"; break; case 'set native': - $ret .= "vlan ${cmd['arg2']} untagged ${cmd['arg1']}\n"; + $ret .= "vlan {$cmd['arg2']} untagged {$cmd['arg1']}\n"; /////////////////////////////////////////////////////////////////////////////////////// // Here is a workaround: we should add tagged port again for case // when we remove native but keep it as tagged - $ret .= "no vlan ${cmd['arg2']} tagged ${cmd['arg1']}\n"; + $ret .= "no vlan {$cmd['arg2']} tagged {$cmd['arg1']}\n"; break; case 'unset native': // NOP - $ret .= "no vlan ${cmd['arg2']} untagged ${cmd['arg1']}\n"; - $ret .= "vlan ${cmd['arg2']} tagged ${cmd['arg1']}\n"; + $ret .= "no vlan {$cmd['arg2']} untagged {$cmd['arg1']}\n"; + $ret .= "vlan {$cmd['arg2']} tagged {$cmd['arg1']}\n"; break; case 'set mode': // NOP break; diff --git a/wwwroot/inc/caching.php b/wwwroot/inc/caching.php index 4bd4fd7d2..aab075c04 100644 --- a/wwwroot/inc/caching.php +++ b/wwwroot/inc/caching.php @@ -23,7 +23,7 @@ function checkCachedResponse ($creation_ts, $expire) $result = ( $client_time !== FALSE && $client_time !== -1 && // IMS header is readable - ! in_array ('no-cache', preg_split ('/\s*,\s*/', @$_SERVER['HTTP_CACHE_CONTROL'])) && // no-cache parameter unset + ! in_array ('no-cache', preg_split ('/\s*,\s*/', @$_SERVER['HTTP_CACHE_CONTROL'] ?? '')) && // no-cache parameter unset $client_time <= $server_time && // not in future $client_time >= $creation_ts && // not modified since (! $expire || $client_time + $expire >= $server_time) // expiration timeout is not set, or not expired diff --git a/wwwroot/inc/code.php b/wwwroot/inc/code.php index 71b6be9e4..ccff7bb1e 100644 --- a/wwwroot/inc/code.php +++ b/wwwroot/inc/code.php @@ -31,6 +31,7 @@ function __construct ($message, $lineno = 0) * $statements = $parser->parse ($text1); * $expression = $parser->parse ($text2, 'expr'); */ +#[AllowDynamicProperties] class RackCodeParser { function parse ($text, $root_nt = 'prog') @@ -189,7 +190,7 @@ function get_token() $this->lex_value = $buffer; return $buffer; default: - throw new RackTablesError ("Lex FSM error, state == ${state}, char == ${char}"); + throw new RackTablesError ("Lex FSM error, state == {$state}, char == {$char}"); } break; case self::LEX_S_TAG: @@ -209,7 +210,7 @@ function get_token() case 'END': throw new RCParserError ("Expecting '$breaking_char' character"); default: - throw new RackTablesError ("Lex FSM error, state == ${state}, char == ${char}"); + throw new RackTablesError ("Lex FSM error, state == {$state}, char == {$char}"); } break; case self::LEX_S_COMMENT: @@ -224,11 +225,11 @@ function get_token() $buffer = ''; break; default: - throw new RackTablesError ("Lex FSM error, state == ${state}, char == ${char}"); + throw new RackTablesError ("Lex FSM error, state == {$state}, char == {$char}"); } break; default: - throw new RackTablesError ("Lex FSM error, state == ${state}"); + throw new RackTablesError ("Lex FSM error, state == {$state}"); endswitch; endwhile; return NULL; @@ -451,7 +452,7 @@ function un_expr() function refRCLineno ($ln) { - return "line ${ln}"; + return "line {$ln}"; } // returns warning message or NULL @@ -513,20 +514,20 @@ function checkAutotagName ($atag_name) } catch (EntityNotFoundException $e) { - return "$description with ID '${recid}' does not exist."; + return "$description with ID '{$recid}' does not exist."; } break; case (preg_match ('/^\$username_/', $atag_name)): $recid = preg_replace ('/^\$username_/', '', $atag_name); global $require_local_account; if ($require_local_account && NULL === getUserIDByUsername ($recid)) - return "Local user account '${recid}' does not exist."; + return "Local user account '{$recid}' does not exist."; break; case (preg_match ('/^\$page_([\p{L}0-9]+)$/u', $atag_name, $m)): $recid = $m[1]; global $page; if (! isset ($page[$recid])) - return "Page number '${recid}' does not exist."; + return "Page number '{$recid}' does not exist."; break; case (preg_match ('/^\$(tab|op)_[\p{L}0-9_]+$/u', $atag_name)): case (preg_match ('/^\$typeid_\d+$/', $atag_name)): // FIXME: check value validity @@ -604,9 +605,9 @@ function findTagWarnings ($expr) default: return array (array ( - 'header' => "internal error in ${self}", + 'header' => "internal error in {$self}", 'class' => 'error', - 'text' => "Skipped expression of unknown type '${expr['type']}'" + 'text' => "Skipped expression of unknown type '{$expr['type']}'" )); } } @@ -721,7 +722,7 @@ function getRackCodeWarnings () ( 'header' => 'internal error', 'class' => 'error', - 'text' => "Skipped sentence of unknown type '${sentence['type']}'" + 'text' => "Skipped sentence of unknown type '{$sentence['type']}'" ); } @@ -754,7 +755,7 @@ function getRackCodeWarnings () ( 'header' => 'summary', 'class' => $nwarnings ? 'error' : 'success', - 'text' => "Analysis complete, ${nwarnings} issues discovered." + 'text' => "Analysis complete, {$nwarnings} issues discovered." ); return $ret; } diff --git a/wwwroot/inc/database.php b/wwwroot/inc/database.php index 76c596b6b..af851d5e8 100644 --- a/wwwroot/inc/database.php +++ b/wwwroot/inc/database.php @@ -447,19 +447,19 @@ function listCells ($realm, $parent_id = 0) $query = 'SELECT '; foreach ($SQLinfo['columns'] as $alias => $expression) // Automatically prepend table name to each single column, but leave all others intact. - $query .= ($alias == $expression ? "${SQLinfo['table']}.${alias}" : "${expression} as ${alias}") . ', '; + $query .= ($alias == $expression ? "{$SQLinfo['table']}.{$alias}" : "{$expression} as {$alias}") . ', '; $query = trim($query, ', '); - $query .= " FROM ${SQLinfo['table']}"; + $query .= " FROM {$SQLinfo['table']}"; if (isset ($SQLinfo['pidcolumn']) && $parent_id) { - $query .= " WHERE ${SQLinfo['table']}.${SQLinfo['pidcolumn']} = ?"; + $query .= " WHERE {$SQLinfo['table']}.{$SQLinfo['pidcolumn']} = ?"; $qparams[] = $parent_id; } if (isset ($SQLinfo['ordcolumns'])) { $query .= " ORDER BY "; foreach ($SQLinfo['ordcolumns'] as $oc) - $query .= "${oc}, "; + $query .= "{$oc}, "; $query = trim($query, ', '); } $result = usePreparedSelectBlade ($query, $qparams); @@ -583,9 +583,9 @@ function spotEntity ($realm, $id, $ignore_cache = FALSE) $query = 'SELECT tag_id, TagStorage.user as tag_user, UNIX_TIMESTAMP(TagStorage.date) AS tag_time'; foreach ($SQLinfo['columns'] as $alias => $expression) // Automatically prepend table name to each single column, but leave all others intact. - $query .= ', ' . ($alias == $expression ? "${SQLinfo['table']}.${alias}" : "${expression} as ${alias}"); - $query .= " FROM ${SQLinfo['table']} LEFT JOIN TagStorage on entity_realm = ? and entity_id = ${SQLinfo['table']}.${SQLinfo['keycolumn']}"; - $query .= " WHERE ${SQLinfo['table']}.${SQLinfo['keycolumn']} = ?"; + $query .= ', ' . ($alias == $expression ? "{$SQLinfo['table']}.{$alias}" : "{$expression} as {$alias}"); + $query .= " FROM {$SQLinfo['table']} LEFT JOIN TagStorage on entity_realm = ? and entity_id = {$SQLinfo['table']}.{$SQLinfo['keycolumn']}"; + $query .= " WHERE {$SQLinfo['table']}.{$SQLinfo['keycolumn']} = ?"; $result = usePreparedSelectBlade ($query, array ($realm, $id)); $ret = array(); global $taglist; @@ -1104,7 +1104,7 @@ function getObjectContentsList ($object_id, $children = array ()) foreach ($rows as $row) { if (in_array ($row['child_entity_id'], $children)) - throw new RackTablesError ("Circular reference for object ${object_id}", RackTablesError::INTERNAL); + throw new RackTablesError ("Circular reference for object {$object_id}", RackTablesError::INTERNAL); $children[] = $row['child_entity_id']; $children = array_unique (array_merge ($children, $self ($row['child_entity_id'], $children))); } @@ -1121,7 +1121,7 @@ function getLocationChildrenList ($location_id, $children = array ()) foreach ($rows as $row) { if (in_array ($row['id'], $children)) - throw new RackTablesError ("Circular reference for location ${location_id}", RackTablesError::INTERNAL); + throw new RackTablesError ("Circular reference for location {$location_id}", RackTablesError::INTERNAL); $children[] = $row['id']; $children = array_unique (array_merge ($children, $self ($row['id'], $children))); } @@ -1139,7 +1139,7 @@ function getTagChildrenList ($tag_id, $children = array ()) foreach ($rows as $row) { if (in_array ($row['id'], $children)) - throw new RackTablesError ("Circular reference for tag ${tag_id}", RackTablesError::INTERNAL); + throw new RackTablesError ("Circular reference for tag {$tag_id}", RackTablesError::INTERNAL); $children[] = $row['id']; $children = array_unique (array_merge ($children, $self ($row['id'], $children))); } @@ -1155,7 +1155,7 @@ function commitLinkEntities ($parent_entity_type, $parent_entity_id, $child_enti $child_entity_type == 'location' && in_array ($parent_entity_id, getLocationChildrenList ($child_entity_id)) ) - throw new RackTablesError ("Circular reference for location ${parent_entity_id}", RackTablesError::INTERNAL); + throw new RackTablesError ("Circular reference for location {$parent_entity_id}", RackTablesError::INTERNAL); // an object's container may not be one of its contained objects if @@ -1164,7 +1164,7 @@ function commitLinkEntities ($parent_entity_type, $parent_entity_id, $child_enti $child_entity_type == 'object' && in_array ($parent_entity_id, getObjectContentsList ($child_entity_id)) ) - throw new RackTablesError ("Circular reference for object ${parent_entity_id}", RackTablesError::INTERNAL); + throw new RackTablesError ("Circular reference for object {$parent_entity_id}", RackTablesError::INTERNAL); usePreparedInsertBlade ( @@ -1192,7 +1192,7 @@ function commitUpdateEntityLink $new_child_entity_type == 'location' && in_array ($new_parent_entity_id, getLocationChildrenList ($new_child_entity_id)) ) - throw new RackTablesError ("Circular reference for location ${new_parent_entity_id}", RackTablesError::INTERNAL); + throw new RackTablesError ("Circular reference for location {$new_parent_entity_id}", RackTablesError::INTERNAL); // an object's container may not be one of its contained objects if @@ -1201,7 +1201,7 @@ function commitUpdateEntityLink $new_child_entity_type == 'object' && in_array ($new_parent_entity_id, getObjectContentsList ($new_child_entity_id)) ) - throw new RackTablesError ("Circular reference for object ${new_parent_entity_id}", RackTablesError::INTERNAL); + throw new RackTablesError ("Circular reference for object {$new_parent_entity_id}", RackTablesError::INTERNAL); usePreparedUpdateBlade ( @@ -1829,7 +1829,7 @@ function linkPorts ($porta, $portb, $cable = NULL) array ($porta, $portb, $porta, $portb) ); if ($result->fetchColumn () != 0) - throw new RTDatabaseError ("Port ${porta} or ${portb} is already linked"); + throw new RTDatabaseError ("Port {$porta} or {$portb} is already linked"); unset ($result); $ret = usePreparedInsertBlade @@ -2129,7 +2129,7 @@ function scanIPv4Space ($pairlist, $filter_flags = IPSCAN_ANY) if ($filter_flags & IPSCAN_DO_ADDR) { $query = "select ip, name, comment, reserved from IPv4Address ". - "where ${whereexpr1} and (reserved = 'yes' or name != '' or comment != '')"; + "where {$whereexpr1} and (reserved = 'yes' or name != '' or comment != '')"; $result = usePreparedSelectBlade ($query, $qparams); while ($row = $result->fetch (PDO::FETCH_ASSOC)) { @@ -2150,7 +2150,7 @@ function scanIPv4Space ($pairlist, $filter_flags = IPSCAN_ANY) $whereexpr2 .= " AND ( ia.type = 'router' OR ia.type = 'sharedrouter')"; $query = "select ia.ip, ia.object_id, ia.name, ia.type, Object.name as object_name " . - "from IPv4Allocation AS ia INNER JOIN Object ON ia.object_id = Object.id where ${whereexpr2} order by ia.type"; + "from IPv4Allocation AS ia INNER JOIN Object ON ia.object_id = Object.id where {$whereexpr2} order by ia.type"; $result = usePreparedSelectBlade ($query, $qparams); while ($row = $result->fetch (PDO::FETCH_ASSOC)) { @@ -2171,7 +2171,7 @@ function scanIPv4Space ($pairlist, $filter_flags = IPSCAN_ANY) // 3a. look for virtual services if ($filter_flags & IPSCAN_DO_VS) { - $query = "select id, vip from IPv4VS where ${whereexpr3a}"; + $query = "select id, vip from IPv4VS where {$whereexpr3a}"; $result = usePreparedSelectBlade ($query, $qparams_bin); $allRows = $result->fetchAll (PDO::FETCH_ASSOC); unset ($result); @@ -2184,7 +2184,7 @@ function scanIPv4Space ($pairlist, $filter_flags = IPSCAN_ANY) } // 3b. look for virtual service groups - $query = "select vs_id, vip from VSIPs where ${whereexpr3b}"; + $query = "select vs_id, vip from VSIPs where {$whereexpr3b}"; $result = usePreparedSelectBlade ($query, $qparams_bin); $allRows = $result->fetchAll (PDO::FETCH_ASSOC); unset ($result); @@ -2200,7 +2200,7 @@ function scanIPv4Space ($pairlist, $filter_flags = IPSCAN_ANY) // 4. don't forget about real servers along with pools if ($filter_flags & IPSCAN_DO_RS) { - $query = "select rsip, rspool_id from IPv4RS where ${whereexpr4}"; + $query = "select rsip, rspool_id from IPv4RS where {$whereexpr4}"; $result = usePreparedSelectBlade ($query, $qparams_bin); while ($row = $result->fetch (PDO::FETCH_ASSOC)) { @@ -2224,7 +2224,7 @@ function scanIPv4Space ($pairlist, $filter_flags = IPSCAN_ANY) "remoteport, " . "description " . "from IPv4NAT " . - "where ${whereexpr5a} " . + "where {$whereexpr5a} " . "order by localip, localport, remoteip, remoteport, proto"; $result = usePreparedSelectBlade ($query, $qparams); while ($row = $result->fetch (PDO::FETCH_ASSOC)) @@ -2250,7 +2250,7 @@ function scanIPv4Space ($pairlist, $filter_flags = IPSCAN_ANY) "remoteport, " . "description " . "from IPv4NAT " . - "where ${whereexpr5b} " . + "where {$whereexpr5b} " . "order by localip, localport, remoteip, remoteport, proto"; $result = usePreparedSelectBlade ($query, $qparams); while ($row = $result->fetch (PDO::FETCH_ASSOC)) @@ -2272,7 +2272,7 @@ function scanIPv4Space ($pairlist, $filter_flags = IPSCAN_ANY) if ($filter_flags & IPSCAN_DO_LOG) { $query = "select l.ip, l.user, UNIX_TIMESTAMP(l.date) AS time from IPv4Log l INNER JOIN " . - " (SELECT MAX(id) as id FROM IPv4Log WHERE ${whereexpr6a} GROUP BY ip) v USING (id) WHERE ${whereexpr6b}"; + " (SELECT MAX(id) as id FROM IPv4Log WHERE {$whereexpr6a} GROUP BY ip) v USING (id) WHERE {$whereexpr6b}"; $result = usePreparedSelectBlade ($query, array_merge ($qparams, $qparams)); while ($row = $result->fetch (PDO::FETCH_ASSOC)) { @@ -2339,7 +2339,7 @@ function scanIPv6Space ($pairlist, $filter_flags = IPSCAN_ANY) if ($filter_flags & IPSCAN_DO_ADDR) { $query = "select ip, name, comment, reserved from IPv6Address ". - "where ${whereexpr1} and (reserved = 'yes' or name != '' or comment != '')"; + "where {$whereexpr1} and (reserved = 'yes' or name != '' or comment != '')"; $result = usePreparedSelectBlade ($query, $qparams); while ($row = $result->fetch (PDO::FETCH_ASSOC)) { @@ -2360,7 +2360,7 @@ function scanIPv6Space ($pairlist, $filter_flags = IPSCAN_ANY) $whereexpr2 .= " AND (ia.type = 'router' OR ia.type = 'sharedrouter')"; $query = "select ia.ip, ia.object_id, ia.name, ia.type, Object.name as object_name " . - "from IPv6Allocation AS ia INNER JOIN Object ON ia.object_id = Object.id where ${whereexpr2} order by ia.type"; + "from IPv6Allocation AS ia INNER JOIN Object ON ia.object_id = Object.id where {$whereexpr2} order by ia.type"; $result = usePreparedSelectBlade ($query, $qparams); while ($row = $result->fetch (PDO::FETCH_ASSOC)) { @@ -2381,7 +2381,7 @@ function scanIPv6Space ($pairlist, $filter_flags = IPSCAN_ANY) // 3a. look for virtual services if ($filter_flags & IPSCAN_DO_VS) { - $query = "select id, vip from IPv4VS where ${whereexpr3a}"; + $query = "select id, vip from IPv4VS where {$whereexpr3a}"; $result = usePreparedSelectBlade ($query, $qparams); $allRows = $result->fetchAll (PDO::FETCH_ASSOC); unset ($result); @@ -2394,7 +2394,7 @@ function scanIPv6Space ($pairlist, $filter_flags = IPSCAN_ANY) } // 3b. look for virtual service groups - $query = "select vs_id, vip from VSIPs where ${whereexpr3b}"; + $query = "select vs_id, vip from VSIPs where {$whereexpr3b}"; $result = usePreparedSelectBlade ($query, $qparams); $allRows = $result->fetchAll (PDO::FETCH_ASSOC); unset ($result); @@ -2410,7 +2410,7 @@ function scanIPv6Space ($pairlist, $filter_flags = IPSCAN_ANY) // 4. don't forget about real servers along with pools if ($filter_flags & IPSCAN_DO_RS) { - $query = "select rsip, rspool_id from IPv4RS where ${whereexpr4}"; + $query = "select rsip, rspool_id from IPv4RS where {$whereexpr4}"; $result = usePreparedSelectBlade ($query, $qparams); while ($row = $result->fetch (PDO::FETCH_ASSOC)) { @@ -2426,7 +2426,7 @@ function scanIPv6Space ($pairlist, $filter_flags = IPSCAN_ANY) if ($filter_flags & IPSCAN_DO_LOG) { $query = "select l.ip, l.user, UNIX_TIMESTAMP(l.date) AS time from IPv6Log l INNER JOIN " . - " (SELECT MAX(id) as id FROM IPv6Log WHERE ${whereexpr6a} GROUP BY ip) v USING (id) WHERE ${whereexpr6b}"; + " (SELECT MAX(id) as id FROM IPv6Log WHERE {$whereexpr6a} GROUP BY ip) v USING (id) WHERE {$whereexpr6b}"; $result = usePreparedSelectBlade ($query, array_merge ($qparams, $qparams)); while ($row = $result->fetch (PDO::FETCH_ASSOC)) { @@ -2480,7 +2480,7 @@ function bindIPToObject ($ip_bin, $object_id = 0, $name = '', $type = '') // store history line $cell = spotEntity ('object', $object_id); setDisplayedName ($cell); - addIPLogEntry ($ip_bin, "Binded with ${cell['dname']}, ifname=$name"); + addIPLogEntry ($ip_bin, "Binded with {$cell['dname']}, ifname=$name"); } function bindIPv4ToObject ($ip_bin, $object_id = 0, $name = '', $type = '') @@ -2739,7 +2739,7 @@ function unbindIPFromObject ($ip_bin, $object_id) // store history line $cell = spotEntity ('object', $object_id); setDisplayedName ($cell); - addIPLogEntry ($ip_bin, "Removed from ${cell['dname']}"); + addIPLogEntry ($ip_bin, "Removed from {$cell['dname']}"); } } @@ -2804,8 +2804,8 @@ function getIPv4AddressSearchResult ($terms) { $query .= $or . "name like ? or comment like ?"; $or = ' or '; - $qparams[] = "%${term}%"; - $qparams[] = "%${term}%"; + $qparams[] = "%{$term}%"; + $qparams[] = "%{$term}%"; } $result = usePreparedSelectBlade ($query, $qparams); $ret = array(); @@ -2827,8 +2827,8 @@ function getIPv6AddressSearchResult ($terms) { $query .= $or . "name like ? or comment like ?"; $or = ' or '; - $qparams[] = "%${term}%"; - $qparams[] = "%${term}%"; + $qparams[] = "%{$term}%"; + $qparams[] = "%{$term}%"; } $result = usePreparedSelectBlade ($query, $qparams); return reindexById ($result->fetchAll (PDO::FETCH_ASSOC), 'ip'); @@ -3059,7 +3059,7 @@ function getVLANSearchResult ($terms) function getSearchResultByField ($tablename, $retcolumns, $scancolumn, $terms, $ordercolumn = '', $exactness = 0) { - $query = 'SELECT ' . implode (', ', $retcolumns) . " FROM ${tablename} WHERE "; + $query = 'SELECT ' . implode (', ', $retcolumns) . " FROM {$tablename} WHERE "; $qparams = array(); $pfx = ''; $pterms = $exactness == 3 ? explode (' ', $terms) : parseSearchTerms ($terms); @@ -3068,26 +3068,26 @@ function getSearchResultByField ($tablename, $retcolumns, $scancolumn, $terms, $ switch ($exactness) { case 3: - $query .= $pfx . "${scancolumn} REGEXP ?"; + $query .= $pfx . "{$scancolumn} REGEXP ?"; $qparams[] = $term; break; case 2: // does this work as expected? - $query .= $pfx . "BINARY ${scancolumn} = ?"; + $query .= $pfx . "BINARY {$scancolumn} = ?"; $qparams[] = $term; break; case 1: - $query .= $pfx . "${scancolumn} = ?"; + $query .= $pfx . "{$scancolumn} = ?"; $qparams[] = $term; break; default: - $query .= $pfx . "${scancolumn} LIKE ?"; - $qparams[] = "%${term}%"; + $query .= $pfx . "{$scancolumn} LIKE ?"; + $qparams[] = "%{$term}%"; break; } $pfx = ' OR '; } if ($ordercolumn != '') - $query .= " ORDER BY ${ordercolumn}"; + $query .= " ORDER BY {$ordercolumn}"; $result = usePreparedSelectBlade ($query, $qparams); return $result->fetchAll (PDO::FETCH_ASSOC); } @@ -3141,13 +3141,13 @@ function getStickerSearchResults ($tablename, $what) $result = usePreparedSelectBlade ( 'SELECT AV.object_id, AV.attr_id FROM AttributeValue AV ' . - "INNER JOIN ${tablename} O ON AV.object_id = O.id " . + "INNER JOIN {$tablename} O ON AV.object_id = O.id " . 'INNER JOIN Attribute A ON AV.attr_id = A.id ' . 'LEFT JOIN AttributeMap AM ON A.type = "dict" AND AV.object_tid = AM.objtype_id AND AV.attr_id = AM.attr_id ' . 'LEFT JOIN Dictionary D ON AM.chapter_id = D.chapter_id AND AV.uint_value = D.dict_key ' . 'WHERE string_value LIKE ? ' . 'OR (A.type = "dict" AND dict_value LIKE ?) ORDER BY object_id', - array ("%${what}%", "%${what}%") + array ("%{$what}%", "%{$what}%") ); $ret = array (); while ($row = $result->fetch (PDO::FETCH_ASSOC)) @@ -3275,7 +3275,7 @@ function searchCableIDs ($what) 'SELECT object_id, cable ' . 'FROM Link INNER JOIN Port ON porta = Port.id OR portb = Port.id ' . 'WHERE cable LIKE ? ORDER BY object_id', - array ("%${what}%") + array ("%{$what}%") ); while ($row = $result->fetch (PDO::FETCH_ASSOC)) { @@ -3792,7 +3792,7 @@ function fetchAttrsForObjects ($object_set = array()) $record['value'] = $row['uint_value']; break; default: - throw new RackTablesError ("unexpected attribute type '${row['attr_type']}'", RackTablesError::INTERNAL); + throw new RackTablesError ("unexpected attribute type '{$row['attr_type']}'", RackTablesError::INTERNAL); } $ret[$object_id][$row['attr_id']] = $record; } @@ -3864,7 +3864,7 @@ function commitUpdateAttrValue ($object_id, $attr_id, $value = '') $column = 'uint_value'; break; default: - throw new RackTablesError ("Unknown attribute type '${attr_type}' for object_id ${object_id} attr_id ${attr_id}", RackTablesError::INTERNAL); + throw new RackTablesError ("Unknown attribute type '{$attr_type}' for object_id {$object_id} attr_id {$attr_id}", RackTablesError::INTERNAL); } if (isset ($row['attr_id'])) { @@ -3932,7 +3932,7 @@ function assertListOfColumnNames ($column_names) function usePreparedInsertBlade ($tablename, $columns) { global $dbxlink; - $query = "INSERT INTO `${tablename}` SET " . makeSetSQL (array_keys ($columns)); + $query = "INSERT INTO `{$tablename}` SET " . makeSetSQL (array_keys ($columns)); // INSERT INTO `table` SET `c1` = ?, `c2` = ?, `c3` = ? try { @@ -3952,7 +3952,7 @@ function makeSetSQL ($column_names) $tmp = array(); // Same syntax works for NULL as well. foreach ($column_names as $each) - $tmp[] = "`${each}` = ?"; + $tmp[] = "`{$each}` = ?"; return implode (', ', $tmp); } @@ -3965,7 +3965,7 @@ function makeWhereSQL ($where_columns, $conjunction, &$params) $tmp = array(); foreach ($where_columns as $colname => $colvalue) if ($colvalue === NULL) - $tmp[] = "`${colname}` IS NULL"; + $tmp[] = "`{$colname}` IS NULL"; elseif (is_array ($colvalue)) { // Suppress any string keys to keep array_merge() from overwriting. @@ -3974,10 +3974,10 @@ function makeWhereSQL ($where_columns, $conjunction, &$params) } else { - $tmp[] = "`${colname}` = ?"; + $tmp[] = "`{$colname}` = ?"; $params[] = $colvalue; } - return implode (" ${conjunction} ", $tmp); + return implode (" {$conjunction} ", $tmp); } // This swiss-knife blade deletes any number of records from the specified table @@ -3988,7 +3988,7 @@ function usePreparedDeleteBlade ($tablename, $columns, $conjunction = 'AND') global $dbxlink; if (! is_array ($columns) || ! count ($columns)) throw new InvalidArgException ('columns', '(empty array)', 'in this function DELETE must have WHERE'); - $query = "DELETE FROM `${tablename}` WHERE " . makeWhereSQL ($columns, $conjunction, $where_values); + $query = "DELETE FROM `{$tablename}` WHERE " . makeWhereSQL ($columns, $conjunction, $where_values); try { $prepared = $dbxlink->prepare ($query); @@ -4024,7 +4024,7 @@ function usePreparedUpdateBlade ($tablename, $set_columns, $where_columns, $conj throw new InvalidArgException ('set_columns', '(empty array)', 'UPDATE must have SET'); if (! is_array ($where_columns) || ! count ($where_columns)) throw new InvalidArgException ('where_columns', '(empty array)', 'in this function UPDATE must have WHERE'); - $query = "UPDATE `${tablename}` SET " . makeSetSQL (array_keys ($set_columns)); + $query = "UPDATE `{$tablename}` SET " . makeSetSQL (array_keys ($set_columns)); $query .= ' WHERE ' . makeWhereSQL ($where_columns, $conjunction, $where_values); try { @@ -4200,8 +4200,8 @@ function generateEntityAutoTags ($cell) case 'ipv6net': // common (v4 & v6) rules $ver = $cell['realm'] == 'ipv4net' ? 4 : 6; - $ret[] = array ('tag' => "\$ip${ver}netid_" . $cell['id']); - $ret[] = array ('tag' => "\$any_ip${ver}net"); + $ret[] = array ('tag' => "\$ip{$ver}netid_" . $cell['id']); + $ret[] = array ('tag' => "\$any_ip{$ver}net"); $ret[] = array ('tag' => '$any_net'); $ret[] = array ('tag' => '$masklen_eq_' . $cell['mask']); @@ -4288,7 +4288,7 @@ function getTagList ($extra_sql = '') $result = usePreparedSelectBlade ( 'SELECT id, parent_id, is_assignable, tag, LPAD(HEX(color), 6, "0") AS color, description ' . - "FROM TagTree ORDER BY tag ${extra_sql}" + "FROM TagTree ORDER BY tag {$extra_sql}" ); return reindexById ($result->fetchAll (PDO::FETCH_ASSOC)); } @@ -4799,7 +4799,7 @@ function getFileStats () $ret = array(); while ($row = $result->fetch (PDO::FETCH_ASSOC)) if ($row['count'] > 0) - $ret["Links in realm '${row['entity_type']}'"] = $row['count']; + $ret["Links in realm '{$row['entity_type']}'"] = $row['count']; unset ($result); // Find number of files without any linkage @@ -5029,7 +5029,7 @@ function assertUniqueL2Addresses ($db_l2addresses, $my_object_id) // BINARY in the second comparison is what the query is actually looking for but without // the first (non-BINARY) comparison the table index does not work as expected. $query = 'SELECT l2address, object_id, name FROM Port ' . - "WHERE l2address IN(${qm}) AND BINARY l2address IN(${qm}) AND object_id != ? LIMIT 1"; + "WHERE l2address IN({$qm}) AND BINARY l2address IN({$qm}) AND object_id != ? LIMIT 1"; $params = array_merge ($db_l2addresses, $db_l2addresses, array ($my_object_id)); $result = usePreparedSelectBlade ($query, $params); if ($row = $result->fetch (PDO::FETCH_ASSOC)) @@ -5659,7 +5659,7 @@ function commitUpdateVSTRules ($vst_id, $mutex_rev, $rules) $vst = $result->fetch (PDO::FETCH_ASSOC); unset ($result); if ($vst['mutex_rev'] != $mutex_rev) - throw new InvalidRequestArgException ('mutex_rev', $mutex_rev, "already saved by ${vst['saved_by']}"); + throw new InvalidRequestArgException ('mutex_rev', $mutex_rev, "already saved by {$vst['saved_by']}"); usePreparedDeleteBlade ('VLANSTRule', array ('vst_id' => $vst_id)); foreach ($rules as $rule) usePreparedInsertBlade ('VLANSTRule', array_merge (array ('vst_id' => $vst_id), $rule)); @@ -5675,7 +5675,7 @@ function lookupEntityByString ($realm, $value, $column = 'name') if (!isset ($SQLSchema[$realm])) throw new InvalidArgException ('realm', $realm); $SQLinfo = $SQLSchema[$realm]; - $query = "SELECT ${SQLinfo['keycolumn']} AS id FROM ${SQLinfo['table']} WHERE ${SQLinfo['table']}.${column}=? LIMIT 2"; + $query = "SELECT {$SQLinfo['keycolumn']} AS id FROM {$SQLinfo['table']} WHERE {$SQLinfo['table']}.{$column}=? LIMIT 2"; $result = usePreparedSelectBlade ($query, array ($value)); $rows = $result->fetchAll (PDO::FETCH_ASSOC); return count ($rows) == 1 ? $rows[0]['id'] : NULL; @@ -5747,9 +5747,9 @@ function setConfigVar ($varname, $varvalue) if ($var['is_hidden'] != 'no') throw new InvalidArgException ('varname', $varname, 'a hidden variable cannot be changed'); if ($varvalue == '' && $var['emptyok'] != 'yes') - throw new InvalidArgException ('varvalue', $varvalue, "'${varname}' must have a non-empty value"); + throw new InvalidArgException ('varvalue', $varvalue, "'{$varname}' must have a non-empty value"); if ($varvalue != '' && $var['vartype'] == 'uint' && ! isUnsignedInteger ($varvalue)) - throw new InvalidArgException ('varvalue', $varvalue, "'${varname}' must be an unsigned integer"); + throw new InvalidArgException ('varvalue', $varvalue, "'{$varname}' must be an unsigned integer"); // Update cache only if the changes went into DB. usePreparedUpdateBlade ('Config', array ('varvalue' => $varvalue), array ('varname' => $varname)); $configCache[$varname]['varvalue'] = $varvalue; @@ -5770,9 +5770,9 @@ function setUserConfigVar ($varname, $varvalue) if ($var['is_hidden'] != 'no') throw new InvalidArgException ('varname', $varname, 'a hidden variable cannot be changed'); if ($varvalue == '' && $var['emptyok'] != 'yes') - throw new InvalidArgException ('varvalue', $varvalue, "'${varname}' must have a non-empty value"); + throw new InvalidArgException ('varvalue', $varvalue, "'{$varname}' must have a non-empty value"); if ($varvalue != '' && $var['vartype'] == 'uint' && ! isUnsignedInteger ($varvalue)) - throw new InvalidArgException ('varvalue', $varvalue, "'${varname}' must be an unsigned integer"); + throw new InvalidArgException ('varvalue', $varvalue, "'{$varname}' must be an unsigned integer"); // Update cache only if the changes went into DB. usePreparedExecuteBlade ( @@ -5997,7 +5997,7 @@ function commitModifyPatchCableAmount ($heap_id, $by_amount) 'UPDATE PatchCableHeap SET amount = amount + ? WHERE id = ? AND amount + ? >= 0', array ($by_amount, $heap_id, $by_amount) ); - addPatchCableHeapLogEntry ($heap_id, "amount adjusted by ${by_amount}"); + addPatchCableHeapLogEntry ($heap_id, "amount adjusted by {$by_amount}"); return $dbxlink->commit(); } @@ -6011,7 +6011,7 @@ function commitSetPatchCableAmount ($heap_id, $new_amount) array ('amount' => $new_amount), array ('id' => $heap_id) ); - addPatchCableHeapLogEntry ($heap_id, "amount set to ${new_amount}"); + addPatchCableHeapLogEntry ($heap_id, "amount set to {$new_amount}"); return $dbxlink->commit(); } @@ -6106,19 +6106,19 @@ function getPlugins ($state = NULL) // available global $racktables_plugins_dir; - $plugin_dirs = glob ("${racktables_plugins_dir}/*", GLOB_ONLYDIR); + $plugin_dirs = glob ("{$racktables_plugins_dir}/*", GLOB_ONLYDIR); $in_code = array (); foreach ($plugin_dirs as $plugin_dir) { $plugin = basename ($plugin_dir); - if (! file_exists ("${plugin_dir}/plugin.php")) + if (! file_exists ("{$plugin_dir}/plugin.php")) continue; - require_once "${plugin_dir}/plugin.php"; - if (! function_exists ("plugin_${plugin}_info")) + require_once "{$plugin_dir}/plugin.php"; + if (! function_exists ("plugin_{$plugin}_info")) continue; - $info = call_user_func ("plugin_${plugin}_info"); + $info = call_user_func ("plugin_{$plugin}_info"); $in_code[$info['name']] = array ( 'longname' => $info['longname'], @@ -6160,13 +6160,13 @@ function getPlugin ($name) global $racktables_plugins_dir; $in_code = array (); - if (file_exists ("$racktables_plugins_dir/${name}/plugin.php")) + if (file_exists ("$racktables_plugins_dir/{$name}/plugin.php")) { - require_once "${racktables_plugins_dir}/${name}/plugin.php"; - if (! function_exists ("plugin_${name}_info")) + require_once "{$racktables_plugins_dir}/{$name}/plugin.php"; + if (! function_exists ("plugin_{$name}_info")) return FALSE; - $code_info = call_user_func ("plugin_${name}_info"); + $code_info = call_user_func ("plugin_{$name}_info"); $in_code['name'] = $code_info['name']; $in_code['longname'] = $code_info['longname']; $in_code['code_version'] = $code_info['version']; diff --git a/wwwroot/inc/deviceconfig.php b/wwwroot/inc/deviceconfig.php index e585c2775..5df2ce46a 100644 --- a/wwwroot/inc/deviceconfig.php +++ b/wwwroot/inc/deviceconfig.php @@ -707,12 +707,12 @@ function ros11ParsePortString ($string) # Produce a list of interfaces from the given base interface # name and upper index. if ($matches[3] <= $matches[2]) - throw new InvalidArgException ('string', $string, "format error in '${item}'"); + throw new InvalidArgException ('string', $string, "format error in '{$item}'"); for ($i = $matches[2]; $i <= $matches[3]; $i++) - $ret[] = "${matches[1]}{$i}"; + $ret[] = "{$matches[1]}{$i}"; } else - throw new InvalidArgException ('string', $string, "format error in '${item}'"); + throw new InvalidArgException ('string', $string, "format error in '{$item}'"); return $ret; } @@ -875,7 +875,7 @@ function vrp55Read8021QConfig ($input) switch (TRUE) { case preg_match ('/^ port (link-type )?hybrid /', $line): - throw new RTGatewayError ("unsupported hybrid link-type for $port_name: ${line}"); + throw new RTGatewayError ("unsupported hybrid link-type for $port_name: {$line}"); case preg_match ('/^ port link-type (.+)$/', $line, $matches): $ret['current']['link-type'] = $matches[1]; break; @@ -1189,9 +1189,9 @@ function nxos4TranslatePushQueue ($dummy_object_id, $queue, $dummy_vlan_names) // Some NX-OS platforms interactively ask for a confirmation if the CLI user // is trying to overwrite the allowed VLAN list for a port. The differentiative // remove syntax works around this problem. - $ret .= "interface ${cmd['arg1']}\n"; + $ret .= "interface {$cmd['arg1']}\n"; $ret .= "switchport trunk encapsulation dot1q\n"; - $ret .= "switchport mode ${cmd['arg2']}\n"; + $ret .= "switchport mode {$cmd['arg2']}\n"; $ret .= "no switchport trunk native vlan\n"; $ret .= "switchport trunk allowed vlan remove 1-4094\n"; break; @@ -1218,38 +1218,38 @@ function ios12TranslatePushQueue ($dummy_object_id, $queue, $dummy_vlan_names) switch ($cmd['opcode']) { case 'create VLAN': - $ret .= "vlan ${cmd['arg1']}\nexit\n"; + $ret .= "vlan {$cmd['arg1']}\nexit\n"; break; case 'destroy VLAN': - $ret .= "no vlan ${cmd['arg1']}\n"; + $ret .= "no vlan {$cmd['arg1']}\n"; break; case 'add allowed': case 'rem allowed': $clause = $cmd['opcode'] == 'add allowed' ? 'add' : 'remove'; - $ret .= "interface ${cmd['port']}\n"; + $ret .= "interface {$cmd['port']}\n"; foreach (listToRanges ($cmd['vlans']) as $range) - $ret .= "switchport trunk allowed vlan ${clause} " . - ($range['from'] == $range['to'] ? $range['to'] : "${range['from']}-${range['to']}") . + $ret .= "switchport trunk allowed vlan {$clause} " . + ($range['from'] == $range['to'] ? $range['to'] : "{$range['from']}-{$range['to']}") . "\n"; $ret .= "exit\n"; break; case 'set native': - $ret .= "interface ${cmd['arg1']}\nswitchport trunk native vlan ${cmd['arg2']}\nexit\n"; + $ret .= "interface {$cmd['arg1']}\nswitchport trunk native vlan {$cmd['arg2']}\nexit\n"; break; case 'unset native': - $ret .= "interface ${cmd['arg1']}\nno switchport trunk native vlan ${cmd['arg2']}\nexit\n"; + $ret .= "interface {$cmd['arg1']}\nno switchport trunk native vlan {$cmd['arg2']}\nexit\n"; break; case 'set access': - $ret .= "interface ${cmd['arg1']}\nswitchport access vlan ${cmd['arg2']}\nexit\n"; + $ret .= "interface {$cmd['arg1']}\nswitchport access vlan {$cmd['arg2']}\nexit\n"; break; case 'unset access': - $ret .= "interface ${cmd['arg1']}\nno switchport access vlan\nexit\n"; + $ret .= "interface {$cmd['arg1']}\nno switchport access vlan\nexit\n"; break; case 'set mode': - $ret .= "interface ${cmd['arg1']}\n"; + $ret .= "interface {$cmd['arg1']}\n"; if ($cmd['arg2'] == 'trunk') $ret .= "switchport trunk encapsulation dot1q\n"; - $ret .= "switchport mode ${cmd['arg2']}\n"; + $ret .= "switchport mode {$cmd['arg2']}\n"; if ($cmd['arg2'] == 'trunk') $ret .= "no switchport trunk native vlan\nswitchport trunk allowed vlan none\n"; $ret .= "exit\n"; @@ -1308,30 +1308,30 @@ function fdry5TranslatePushQueue ($dummy_object_id, $queue, $dummy_vlan_names) switch ($cmd['opcode']) { case 'create VLAN': - $ret .= "vlan ${cmd['arg1']}\nexit\n"; + $ret .= "vlan {$cmd['arg1']}\nexit\n"; break; case 'destroy VLAN': - $ret .= "no vlan ${cmd['arg1']}\n"; + $ret .= "no vlan {$cmd['arg1']}\n"; break; case 'add allowed': foreach ($cmd['vlans'] as $vlan_id) - $ret .= "vlan ${vlan_id}\ntagged ${cmd['port']}\nexit\n"; + $ret .= "vlan {$vlan_id}\ntagged {$cmd['port']}\nexit\n"; break; case 'rem allowed': foreach ($cmd['vlans'] as $vlan_id) - $ret .= "vlan ${vlan_id}\nno tagged ${cmd['port']}\nexit\n"; + $ret .= "vlan {$vlan_id}\nno tagged {$cmd['port']}\nexit\n"; break; case 'set native': - $ret .= "interface ${cmd['arg1']}\ndual-mode ${cmd['arg2']}\nexit\n"; + $ret .= "interface {$cmd['arg1']}\ndual-mode {$cmd['arg2']}\nexit\n"; break; case 'unset native': - $ret .= "interface ${cmd['arg1']}\nno dual-mode ${cmd['arg2']}\nexit\n"; + $ret .= "interface {$cmd['arg1']}\nno dual-mode {$cmd['arg2']}\nexit\n"; break; case 'set access': - $ret .= "vlan ${cmd['arg2']}\nuntagged ${cmd['arg1']}\nexit\n"; + $ret .= "vlan {$cmd['arg2']}\nuntagged {$cmd['arg1']}\nexit\n"; break; case 'unset access': - $ret .= "vlan ${cmd['arg2']}\nno untagged ${cmd['arg1']}\nexit\n"; + $ret .= "vlan {$cmd['arg2']}\nno untagged {$cmd['arg1']}\nexit\n"; break; case 'set mode': // NOP break; @@ -1376,32 +1376,32 @@ function vrp53TranslatePushQueue ($dummy_object_id, $queue, $dummy_vlan_names) switch ($cmd['opcode']) { case 'create VLAN': - $ret .= "vlan ${cmd['arg1']}\nquit\n"; + $ret .= "vlan {$cmd['arg1']}\nquit\n"; break; case 'destroy VLAN': - $ret .= "undo vlan ${cmd['arg1']}\n"; + $ret .= "undo vlan {$cmd['arg1']}\n"; break; case 'add allowed': case 'rem allowed': $clause = $cmd['opcode'] == 'add allowed' ? '' : 'undo '; - $ret .= "interface ${cmd['port']}\n"; + $ret .= "interface {$cmd['port']}\n"; foreach (listToRanges ($cmd['vlans']) as $range) - $ret .= "${clause}port trunk allow-pass vlan " . - ($range['from'] == $range['to'] ? $range['to'] : "${range['from']} to ${range['to']}") . + $ret .= "{$clause}port trunk allow-pass vlan " . + ($range['from'] == $range['to'] ? $range['to'] : "{$range['from']} to {$range['to']}") . "\n"; $ret .= "quit\n"; break; case 'set native': case 'set access': - $ret .= "interface ${cmd['arg1']}\nport default vlan ${cmd['arg2']}\nquit\n"; + $ret .= "interface {$cmd['arg1']}\nport default vlan {$cmd['arg2']}\nquit\n"; break; case 'unset native': case 'unset access': - $ret .= "interface ${cmd['arg1']}\nundo port default vlan\nquit\n"; + $ret .= "interface {$cmd['arg1']}\nundo port default vlan\nquit\n"; break; case 'set mode': $modemap = array ('access' => 'access', 'trunk' => 'hybrid'); - $ret .= "interface ${cmd['arg1']}\nport link-type " . $modemap[$cmd['arg2']] . "\n"; + $ret .= "interface {$cmd['arg1']}\nport link-type " . $modemap[$cmd['arg2']] . "\n"; if ($cmd['arg2'] == 'hybrid') $ret .= "undo port default vlan\nundo port trunk allow-pass vlan all\n"; $ret .= "quit\n"; @@ -1451,33 +1451,33 @@ function vrp55TranslatePushQueue ($dummy_object_id, $queue, $dummy_vlan_names) { case 'create VLAN': if ($cmd['arg1'] != 1) - $ret .= "vlan ${cmd['arg1']}\nquit\n"; + $ret .= "vlan {$cmd['arg1']}\nquit\n"; break; case 'destroy VLAN': if ($cmd['arg1'] != 1) - $ret .= "undo vlan ${cmd['arg1']}\n"; + $ret .= "undo vlan {$cmd['arg1']}\n"; break; case 'add allowed': case 'rem allowed': $undo = $cmd['opcode'] == 'add allowed' ? '' : 'undo '; - $ret .= "interface ${cmd['port']}\n"; + $ret .= "interface {$cmd['port']}\n"; foreach (listToRanges ($cmd['vlans']) as $range) - $ret .= "${undo}port trunk allow-pass vlan " . - ($range['from'] == $range['to'] ? $range['to'] : "${range['from']} to ${range['to']}") . + $ret .= "{$undo}port trunk allow-pass vlan " . + ($range['from'] == $range['to'] ? $range['to'] : "{$range['from']} to {$range['to']}") . "\n"; $ret .= "quit\n"; break; case 'set native': - $ret .= "interface ${cmd['arg1']}\nport trunk pvid vlan ${cmd['arg2']}\nquit\n"; + $ret .= "interface {$cmd['arg1']}\nport trunk pvid vlan {$cmd['arg2']}\nquit\n"; break; case 'set access': - $ret .= "interface ${cmd['arg1']}\nport default vlan ${cmd['arg2']}\nquit\n"; + $ret .= "interface {$cmd['arg1']}\nport default vlan {$cmd['arg2']}\nquit\n"; break; case 'unset native': - $ret .= "interface ${cmd['arg1']}\nundo port trunk pvid vlan\nquit\n"; + $ret .= "interface {$cmd['arg1']}\nundo port trunk pvid vlan\nquit\n"; break; case 'unset access': - $ret .= "interface ${cmd['arg1']}\nundo port default vlan\nquit\n"; + $ret .= "interface {$cmd['arg1']}\nundo port default vlan\nquit\n"; break; case 'set mode': // VRP 5.50's meaning of "trunk" is much like the one of IOS @@ -1496,9 +1496,9 @@ function vrp55TranslatePushQueue ($dummy_object_id, $queue, $dummy_vlan_names) 'access' => '', 'trunk' => "undo port trunk allow-pass vlan 1\n", ); - $ret .= "interface ${cmd['arg1']}\n"; + $ret .= "interface {$cmd['arg1']}\n"; $ret .= $before[$cmd['arg2']]; - $ret .= "port link-type ${cmd['arg2']}\n"; + $ret .= "port link-type {$cmd['arg2']}\n"; $ret .= $after[$cmd['arg2']]; $ret .= "quit\n"; break; @@ -1547,33 +1547,33 @@ function vrp85TranslatePushQueue ($dummy_object_id, $queue, $dummy_vlan_names) { case 'create VLAN': if ($cmd['arg1'] != 1) - $ret .= "vlan ${cmd['arg1']}\nquit\n"; + $ret .= "vlan {$cmd['arg1']}\nquit\n"; break; case 'destroy VLAN': if ($cmd['arg1'] != 1) - $ret .= "undo vlan ${cmd['arg1']}\n"; + $ret .= "undo vlan {$cmd['arg1']}\n"; break; case 'add allowed': case 'rem allowed': $undo = $cmd['opcode'] == 'add allowed' ? '' : 'undo '; - $ret .= "interface ${cmd['port']}\n"; + $ret .= "interface {$cmd['port']}\n"; foreach (listToRanges ($cmd['vlans']) as $range) - $ret .= "${undo}port trunk allow-pass vlan " . - ($range['from'] == $range['to'] ? $range['to'] : "${range['from']} to ${range['to']}") . + $ret .= "{$undo}port trunk allow-pass vlan " . + ($range['from'] == $range['to'] ? $range['to'] : "{$range['from']} to {$range['to']}") . "\n"; $ret .= "quit\n"; break; case 'set native': - $ret .= "interface ${cmd['arg1']}\nport trunk pvid vlan ${cmd['arg2']}\nquit\n"; + $ret .= "interface {$cmd['arg1']}\nport trunk pvid vlan {$cmd['arg2']}\nquit\n"; break; case 'set access': - $ret .= "interface ${cmd['arg1']}\nport default vlan ${cmd['arg2']}\nquit\n"; + $ret .= "interface {$cmd['arg1']}\nport default vlan {$cmd['arg2']}\nquit\n"; break; case 'unset native': - $ret .= "interface ${cmd['arg1']}\nundo port trunk pvid vlan\nquit\n"; + $ret .= "interface {$cmd['arg1']}\nundo port trunk pvid vlan\nquit\n"; break; case 'unset access': - $ret .= "interface ${cmd['arg1']}\nundo port default vlan\nquit\n"; + $ret .= "interface {$cmd['arg1']}\nundo port default vlan\nquit\n"; break; case 'set mode': // VRP 5.50's meaning of "trunk" is much like the one of IOS @@ -1592,9 +1592,9 @@ function vrp85TranslatePushQueue ($dummy_object_id, $queue, $dummy_vlan_names) 'access' => '', 'trunk' => "undo port trunk allow-pass vlan 1\n", ); - $ret .= "interface ${cmd['arg1']}\n"; + $ret .= "interface {$cmd['arg1']}\n"; $ret .= $before[$cmd['arg2']]; - $ret .= "port link-type ${cmd['arg2']}\n"; + $ret .= "port link-type {$cmd['arg2']}\n"; $ret .= $after[$cmd['arg2']]; $ret .= "quit\n"; break; @@ -1643,43 +1643,43 @@ function xos12TranslatePushQueue ($dummy_object_id, $queue, $dummy_vlan_names) switch ($cmd['opcode']) { case 'create VLAN': - $ret .= "create vlan VLAN${cmd['arg1']}\n"; - $ret .= "configure vlan VLAN${cmd['arg1']} tag ${cmd['arg1']}\n"; + $ret .= "create vlan VLAN{$cmd['arg1']}\n"; + $ret .= "configure vlan VLAN{$cmd['arg1']} tag {$cmd['arg1']}\n"; break; case 'destroy VLAN': - $ret .= "delete vlan VLAN${cmd['arg1']}\n"; + $ret .= "delete vlan VLAN{$cmd['arg1']}\n"; break; case 'add allowed': foreach ($cmd['vlans'] as $vlan_id) { - $vlan_name = $vlan_id == 1 ? 'Default' : "VLAN${vlan_id}"; - $ret .= "configure vlan ${vlan_name} add ports ${cmd['port']} tagged\n"; + $vlan_name = $vlan_id == 1 ? 'Default' : "VLAN{$vlan_id}"; + $ret .= "configure vlan {$vlan_name} add ports {$cmd['port']} tagged\n"; } break; case 'rem allowed': foreach ($cmd['vlans'] as $vlan_id) { - $vlan_name = $vlan_id == 1 ? 'Default' : "VLAN${vlan_id}"; - $ret .= "configure vlan ${vlan_name} delete ports ${cmd['port']}\n"; + $vlan_name = $vlan_id == 1 ? 'Default' : "VLAN{$vlan_id}"; + $ret .= "configure vlan {$vlan_name} delete ports {$cmd['port']}\n"; } break; case 'set native': - $vlan_name = $cmd['arg2'] == 1 ? 'Default' : "VLAN${cmd['arg2']}"; - $ret .= "configure vlan ${vlan_name} delete ports ${cmd['arg1']}\n"; - $ret .= "configure vlan ${vlan_name} add ports ${cmd['arg1']} untagged\n"; + $vlan_name = $cmd['arg2'] == 1 ? 'Default' : "VLAN{$cmd['arg2']}"; + $ret .= "configure vlan {$vlan_name} delete ports {$cmd['arg1']}\n"; + $ret .= "configure vlan {$vlan_name} add ports {$cmd['arg1']} untagged\n"; break; case 'unset native': - $vlan_name = $cmd['arg2'] == 1 ? 'Default' : "VLAN${cmd['arg2']}"; - $ret .= "configure vlan ${vlan_name} delete ports ${cmd['arg1']}\n"; - $ret .= "configure vlan ${vlan_name} add ports ${cmd['arg1']} tagged\n"; + $vlan_name = $cmd['arg2'] == 1 ? 'Default' : "VLAN{$cmd['arg2']}"; + $ret .= "configure vlan {$vlan_name} delete ports {$cmd['arg1']}\n"; + $ret .= "configure vlan {$vlan_name} add ports {$cmd['arg1']} tagged\n"; break; case 'set access': - $vlan_name = $cmd['arg2'] == 1 ? 'Default' : "VLAN${cmd['arg2']}"; - $ret .= "configure vlan ${vlan_name} add ports ${cmd['arg1']} untagged\n"; + $vlan_name = $cmd['arg2'] == 1 ? 'Default' : "VLAN{$cmd['arg2']}"; + $ret .= "configure vlan {$vlan_name} add ports {$cmd['arg1']} untagged\n"; break; case 'unset access': - $vlan_name = $cmd['arg2'] == 1 ? 'Default' : "VLAN${cmd['arg2']}"; - $ret .= "configure vlan ${vlan_name} delete ports ${cmd['arg1']}\n"; + $vlan_name = $cmd['arg2'] == 1 ? 'Default' : "VLAN{$cmd['arg2']}"; + $ret .= "configure vlan {$vlan_name} delete ports {$cmd['arg1']}\n"; break; case 'set mode': case 'begin configuration': @@ -1724,7 +1724,7 @@ function jun10TranslatePushQueue ($dummy_object_id, $queue, $vlan_names) switch ($cmd['opcode']) { case 'create VLAN': - $ret .= "set vlans VLAN${cmd['arg1']} vlan-id ${cmd['arg1']}\n"; + $ret .= "set vlans VLAN{$cmd['arg1']} vlan-id {$cmd['arg1']}\n"; break; case 'destroy VLAN': if (isset ($vlan_names[$cmd['arg1']])) @@ -1734,7 +1734,7 @@ function jun10TranslatePushQueue ($dummy_object_id, $queue, $vlan_names) case 'rem allowed': $del = ($cmd['opcode'] == 'rem allowed'); $pre = ($del ? 'delete' : 'set') . - " interfaces ${cmd['port']} unit 0 family ethernet-switching vlan members"; + " interfaces {$cmd['port']} unit 0 family ethernet-switching vlan members"; if (count ($cmd['vlans']) > VLAN_MAX_ID - VLAN_MIN_ID) $ret .= "$pre " . ($del ? '' : 'all') . "\n"; else @@ -1743,33 +1743,33 @@ function jun10TranslatePushQueue ($dummy_object_id, $queue, $vlan_names) $vlan = array_shift ($cmd['vlans']); $ret .= "$pre $vlan\n"; if ($del && isset ($vlan_names[$vlan])) - $ret .= "$pre ${vlan_names[$vlan]}\n"; + $ret .= "$pre {$vlan_names[$vlan]}\n"; } break; case 'set native': - $ret .= "set interfaces ${cmd['arg1']} unit 0 family ethernet-switching native-vlan-id ${cmd['arg2']}\n"; - $pre = "delete interfaces ${cmd['arg1']} unit 0 family ethernet-switching vlan members"; + $ret .= "set interfaces {$cmd['arg1']} unit 0 family ethernet-switching native-vlan-id {$cmd['arg2']}\n"; + $pre = "delete interfaces {$cmd['arg1']} unit 0 family ethernet-switching vlan members"; $vlan = $cmd['arg2']; $ret .= "$pre $vlan\n"; if (isset ($vlan_names[$vlan])) - $ret .= "$pre ${vlan_names[$vlan]}\n"; + $ret .= "$pre {$vlan_names[$vlan]}\n"; break; case 'unset native': - $ret .= "delete interfaces ${cmd['arg1']} unit 0 family ethernet-switching native-vlan-id\n"; - $pre = "interfaces ${cmd['arg1']} unit 0 family ethernet-switching vlan members"; + $ret .= "delete interfaces {$cmd['arg1']} unit 0 family ethernet-switching native-vlan-id\n"; + $pre = "interfaces {$cmd['arg1']} unit 0 family ethernet-switching vlan members"; $vlan = $cmd['arg2']; if (isset ($vlan_names[$vlan])) - $ret .= "delete $pre ${vlan_names[$vlan]}\n"; + $ret .= "delete $pre {$vlan_names[$vlan]}\n"; $ret .= "set $pre $vlan\n"; break; case 'set access': - $ret .= "set interfaces ${cmd['arg1']} unit 0 family ethernet-switching vlan members ${cmd['arg2']}\n"; + $ret .= "set interfaces {$cmd['arg1']} unit 0 family ethernet-switching vlan members {$cmd['arg2']}\n"; break; case 'unset access': - $ret .= "delete interfaces ${cmd['arg1']} unit 0 family ethernet-switching vlan members\n"; + $ret .= "delete interfaces {$cmd['arg1']} unit 0 family ethernet-switching vlan members\n"; break; case 'set mode': - $ret .= "set interfaces ${cmd['arg1']} unit 0 family ethernet-switching port-mode ${cmd['arg2']}\n"; + $ret .= "set interfaces {$cmd['arg1']} unit 0 family ethernet-switching port-mode {$cmd['arg2']}\n"; break; case 'begin configuration': $ret .= "configure exclusive\n"; @@ -1843,17 +1843,17 @@ function ftos8TranslatePushQueue ($dummy_object_id, $queue, $vlan_names) $ret .= "show running-config interface\n"; break; case 'create VLAN': - $ret .= "int vlan ${cmd['arg1']}\nexit\n"; + $ret .= "int vlan {$cmd['arg1']}\nexit\n"; break; case 'destroy VLAN': - $ret .= "no int vlan ${cmd['arg1']}\n"; + $ret .= "no int vlan {$cmd['arg1']}\n"; break; case 'rem allowed': while (count ($cmd['vlans'])) { $vlan = array_shift ($cmd['vlans']); $ret .= "int vlan $vlan\n"; - $ret .= "no tagged ${cmd['port']}\n"; + $ret .= "no tagged {$cmd['port']}\n"; $ret .= "exit\n"; } break; @@ -1862,30 +1862,30 @@ function ftos8TranslatePushQueue ($dummy_object_id, $queue, $vlan_names) { $vlan = array_shift ($cmd['vlans']); $ret .= "int vlan $vlan\n"; - $ret .= "tagged ${cmd['port']}\n"; + $ret .= "tagged {$cmd['port']}\n"; $ret .= "exit\n"; } break; case 'unset native': - $ret .= "int vlan ${cmd['arg2']}\n"; - $ret .= "no untagged ${cmd['arg1']}\n"; - $ret .= "tagged ${cmd['arg1']}\n"; + $ret .= "int vlan {$cmd['arg2']}\n"; + $ret .= "no untagged {$cmd['arg1']}\n"; + $ret .= "tagged {$cmd['arg1']}\n"; $ret .= "exit\n"; break; case 'unset access': - $ret .= "int vlan ${cmd['arg2']}\n"; - $ret .= "no untagged ${cmd['arg1']}\n"; + $ret .= "int vlan {$cmd['arg2']}\n"; + $ret .= "no untagged {$cmd['arg1']}\n"; $ret .= "exit\n"; break; case 'set native': - $ret .= "int vlan ${cmd['arg2']}\n"; - $ret .= "no tagged ${cmd['arg1']}\n"; - $ret .= "untagged ${cmd['arg1']}\n"; + $ret .= "int vlan {$cmd['arg2']}\n"; + $ret .= "no tagged {$cmd['arg1']}\n"; + $ret .= "untagged {$cmd['arg1']}\n"; $ret .= "exit\n"; break; case 'set access': - $ret .= "int vlan ${cmd['arg2']}\n"; - $ret .= "untagged ${cmd['arg1']}\n"; + $ret .= "int vlan {$cmd['arg2']}\n"; + $ret .= "untagged {$cmd['arg1']}\n"; $ret .= "exit\n"; break; case 'set mode': @@ -1945,20 +1945,20 @@ function eos4TranslatePushQueue ($dummy_object_id, $queue, $dummy_vlan_names) $ret .= "copy running-config startup-config\n\n"; break; case 'create VLAN': - $ret .= "vlan ${cmd['arg1']}\nexit\n"; + $ret .= "vlan {$cmd['arg1']}\nexit\n"; break; case 'destroy VLAN': - $ret .= "no vlan ${cmd['arg1']}\n"; + $ret .= "no vlan {$cmd['arg1']}\n"; break; case 'set access': - $ret .= "interface ${cmd['arg1']}\nswitchport access vlan ${cmd['arg2']}\nexit\n"; + $ret .= "interface {$cmd['arg1']}\nswitchport access vlan {$cmd['arg2']}\nexit\n"; break; case 'unset access': - $ret .= "interface ${cmd['arg1']}\nno switchport access vlan\nexit\n"; + $ret .= "interface {$cmd['arg1']}\nno switchport access vlan\nexit\n"; break; case 'set mode': - $ret .= "interface ${cmd['arg1']}\n"; - $ret .= "switchport mode ${cmd['arg2']}\n"; + $ret .= "interface {$cmd['arg1']}\n"; + $ret .= "switchport mode {$cmd['arg2']}\n"; if ($cmd['arg2'] == 'trunk') $ret .= "no switchport trunk native vlan\nswitchport trunk allowed vlan none\n"; $ret .= "exit\n"; @@ -1966,18 +1966,18 @@ function eos4TranslatePushQueue ($dummy_object_id, $queue, $dummy_vlan_names) case 'add allowed': case 'rem allowed': $clause = $cmd['opcode'] == 'add allowed' ? 'add' : 'remove'; - $ret .= "interface ${cmd['port']}\n"; + $ret .= "interface {$cmd['port']}\n"; foreach (listToRanges ($cmd['vlans']) as $range) - $ret .= "switchport trunk allowed vlan ${clause} " . - ($range['from'] == $range['to'] ? $range['to'] : "${range['from']}-${range['to']}") . + $ret .= "switchport trunk allowed vlan {$clause} " . + ($range['from'] == $range['to'] ? $range['to'] : "{$range['from']}-{$range['to']}") . "\n"; $ret .= "exit\n"; break; case 'set native': - $ret .= "interface ${cmd['arg1']}\nswitchport trunk native vlan ${cmd['arg2']}\nexit\n"; + $ret .= "interface {$cmd['arg1']}\nswitchport trunk native vlan {$cmd['arg2']}\nexit\n"; break; case 'unset native': - $ret .= "interface ${cmd['arg1']}\nswitchport trunk native vlan tag\nexit\n"; + $ret .= "interface {$cmd['arg1']}\nswitchport trunk native vlan tag\nexit\n"; break; case 'getlldpstatus': $ret .= "show lldp neighbors detail\n"; @@ -2020,27 +2020,27 @@ function ros11TranslatePushQueue ($dummy_object_id, $queue, $dummy_vlan_names) $ret .= "copy running-config startup-config\nY\n"; break; case 'create VLAN': - $ret .= "vlan database\nvlan ${cmd['arg1']}\nexit\n"; + $ret .= "vlan database\nvlan {$cmd['arg1']}\nexit\n"; break; case 'destroy VLAN': - $ret .= "vlan database\nno vlan ${cmd['arg1']}\nexit\n"; + $ret .= "vlan database\nno vlan {$cmd['arg1']}\nexit\n"; break; case 'set access': - $ret .= "interface ${cmd['arg1']}\nswitchport access vlan ${cmd['arg2']}\nexit\n"; + $ret .= "interface {$cmd['arg1']}\nswitchport access vlan {$cmd['arg2']}\nexit\n"; break; case 'unset access': - $ret .= "interface ${cmd['arg1']}\nno switchport access vlan\nexit\n"; + $ret .= "interface {$cmd['arg1']}\nno switchport access vlan\nexit\n"; break; case 'set mode': - $ret .= "interface ${cmd['arg1']}\n"; - $ret .= "switchport mode ${cmd['arg2']}\n"; + $ret .= "interface {$cmd['arg1']}\n"; + $ret .= "switchport mode {$cmd['arg2']}\n"; if ($cmd['arg2'] == 'trunk') $ret .= "no switchport trunk native vlan\nswitchport trunk allowed vlan remove all\n"; $ret .= "exit\n"; break; case 'add allowed': case 'rem allowed': - $ret .= "interface ${cmd['port']}\n"; + $ret .= "interface {$cmd['port']}\n"; # default VLAN special case $ordinary = array(); foreach ($cmd['vlans'] as $vid) @@ -2053,21 +2053,21 @@ function ros11TranslatePushQueue ($dummy_object_id, $queue, $dummy_vlan_names) foreach (listToRanges ($ordinary) as $range) $ret .= 'switchport trunk allowed vlan ' . ($cmd['opcode'] == 'add allowed' ? 'add ' : 'remove ') . - ($range['from'] == $range['to'] ? $range['to'] : "${range['from']}-${range['to']}") . + ($range['from'] == $range['to'] ? $range['to'] : "{$range['from']}-{$range['to']}") . "\n"; $ret .= "exit\n"; break; case 'set native': - $ret .= "interface ${cmd['arg1']}\n"; + $ret .= "interface {$cmd['arg1']}\n"; # default VLAN special case if ($cmd['arg2'] == VLAN_DFL_ID) $ret .= "no switchport default-vlan tagged\n"; else - $ret .= "switchport trunk native vlan ${cmd['arg2']}\n"; + $ret .= "switchport trunk native vlan {$cmd['arg2']}\n"; $ret .= "exit\n"; break; case 'unset native': - $ret .= "interface ${cmd['arg1']}\n"; + $ret .= "interface {$cmd['arg1']}\n"; # default VLAN special case if ($cmd['arg2'] == VLAN_DFL_ID) $ret .= "switchport default-vlan tagged\n"; @@ -2076,7 +2076,7 @@ function ros11TranslatePushQueue ($dummy_object_id, $queue, $dummy_vlan_names) # output of "show interfaces switchport"), the config text doesn't display the # native VLAN in the list of allowed VLANs. Respectively, setting the current # native VLAN as allowed leaves it allowed, but not native any more. - $ret .= "switchport trunk allowed vlan add ${cmd['arg2']}\n"; + $ret .= "switchport trunk allowed vlan add {$cmd['arg2']}\n"; $ret .= "exit\n"; break; case 'getlldpstatus': @@ -2176,7 +2176,7 @@ function xos12Read8021QConfig ($input) if (strtolower ($matches[1]) == 'default') throw new RTGatewayError ('default VLAN tag must be 1'); if ($matches[1] != 'VLAN' . $matches[2]) - throw new RTGatewayError ("VLAN name ${matches[1]} does not match its tag ${matches[2]}"); + throw new RTGatewayError ("VLAN name {$matches[1]} does not match its tag {$matches[2]}"); $ret['vlanlist'][] = $matches[2]; break; case (preg_match ('/^configure vlan ([[:alnum:]]+) add ports (.+) (tagged|untagged) */', $line, $matches)): @@ -2300,7 +2300,7 @@ function jun10Read8021QConfig ($input) elseif (preg_match ('/^(\s+)family ethernet-switching\b/', $line, $m)) { if ($current['is_range']) - throw new RTGatewayError ("interface-range '${current['name']}' contains switchport commands, which is not supported"); + throw new RTGatewayError ("interface-range '{$current['name']}' contains switchport commands, which is not supported"); $current['is_ethernet'] = TRUE; $current['indent'] = $m[1]; } @@ -2587,7 +2587,7 @@ function ros11Read8021QConfig ($input) foreach ($ret['portdata'] as $portname => $port) { if (! array_key_exists ('mode', $port)) - throw new RTGatewayError ("unsupported configuration of port ${portname}"); + throw new RTGatewayError ("unsupported configuration of port {$portname}"); if ( ! array_key_exists ('switchport forbidden default-vlan', $port) @@ -2687,7 +2687,7 @@ function ros11Read8021QPorts (&$work, $line) { case 1 == preg_match ('/^switchport mode ([a-z]+)$/', $line, $m): if ($m[1] != 'trunk' && $m[1] != 'access') - throw new RTGatewayError ("unsupported switchport mode '${m[1]}'"); + throw new RTGatewayError ("unsupported switchport mode '{$m[1]}'"); $work['current']['config']['mode'] = $m[1]; $work['current']['config']['allowed'] = array(); $work['current']['config']['native'] = 0; @@ -3430,11 +3430,11 @@ function ucsReadInventory ($text) { case preg_match ('/^COLUMNS (.+)$/', $line, $m): if (! count ($hcols = explode (',', $m[1]))) - throw new RTGatewayError ("UCS format error: '${line}'"); + throw new RTGatewayError ("UCS format error: '{$line}'"); break; case preg_match ('/^ROW (.+)$/', $line, $m): if (count ($cols = explode (',', $m[1])) != count ($hcols)) - throw new RTGatewayError ("UCS format error: '${line}'"); + throw new RTGatewayError ("UCS format error: '{$line}'"); # $hcols and $cols have same array keys $tmp = array(); foreach ($cols as $key => $value) @@ -3442,7 +3442,7 @@ function ucsReadInventory ($text) $ret[] = $tmp; break; default: - throw new RTGatewayError ("Unrecognized line: '${line}'"); + throw new RTGatewayError ("Unrecognized line: '{$line}'"); } return $ret; } diff --git a/wwwroot/inc/dictionary.php b/wwwroot/inc/dictionary.php index 84a5d4641..1f5586a7f 100644 --- a/wwwroot/inc/dictionary.php +++ b/wwwroot/inc/dictionary.php @@ -26,7 +26,7 @@ function buildInsert ($vlist) # is likely to hit the default execution time limit of 30 seconds. foreach ($dictionary as $dict_key => $record) { - $vlist[] = "(${dict_key}, ${record['chapter_id']}, '${record['dict_value']}', 'yes')"; + $vlist[] = "({$dict_key}, {$record['chapter_id']}, '{$record['dict_value']}', 'yes')"; if (count ($vlist) == $rows_per_query) { $ret[] = buildInsert ($vlist); @@ -53,13 +53,13 @@ function isInnoDBSupported () function platform_generic_test ($is_ok, $topic, $what_if_not = 'FAILED', $error_class = 'trerror') { - echo "${topic}"; + echo "{$topic}"; if ($is_ok) { echo 'PASSED'; return 0; } - echo "${what_if_not}"; + echo "{$what_if_not}"; return 1; } diff --git a/wwwroot/inc/exceptions.php b/wwwroot/inc/exceptions.php index adf545aac..ee098e4f6 100644 --- a/wwwroot/inc/exceptions.php +++ b/wwwroot/inc/exceptions.php @@ -108,8 +108,8 @@ protected final function genHTMLPage ($title, $text) header ('Content-Type: text/html; charset=UTF-8'); echo ''."\n"; echo ''."\n"; - echo "${title}"; - echo "${text}"; + echo "{$title}"; + echo "{$text}"; if (isset ($helpdesk_banner)) echo '
' . $helpdesk_banner; echo ''; @@ -154,7 +154,7 @@ class EntityNotFoundException extends RackTablesError { function __construct ($realm, $id) { - parent::__construct ("Record '${realm}'#'${id}' does not exist"); + parent::__construct ("Record '{$realm}'#'{$id}' does not exist"); } public function dispatch() { @@ -286,8 +286,8 @@ public function dispatch() echo serializeTags ($impl_tags) . " \n"; echo 'Automatic tags:'; echo serializeTags ($auto_tags) . " \n"; - echo "Requested page:${pageno}\n"; - echo "Requested tab:${tabno}\n"; + echo "Requested page:{$pageno}\n"; + echo "Requested tab:{$tabno}\n"; echo "Click here to logout.\n"; echo "\n"; echo ''; diff --git a/wwwroot/inc/functions.php b/wwwroot/inc/functions.php index 5a6fbdc9f..ba77d7e2c 100644 --- a/wwwroot/inc/functions.php +++ b/wwwroot/inc/functions.php @@ -568,7 +568,7 @@ function getBypassValue() if (!array_key_exists ('bypass', $page[$pageno])) return NULL; if (!array_key_exists ('bypass_type', $page[$pageno])) - throw new RackTablesError ("Internal structure error at node '${pageno}' (bypass_type is not set)", RackTablesError::INTERNAL); + throw new RackTablesError ("Internal structure error at node '{$pageno}' (bypass_type is not set)", RackTablesError::INTERNAL); return genericAssertion ($page[$pageno]['bypass'], $page[$pageno]['bypass_type']); } @@ -810,7 +810,7 @@ function mergeGridFormToRack (&$rackData) for ($locidx = 0; $locidx < 3; $locidx++) if ($rackData[$unit_no][$locidx]['enabled']) $rackData[$unit_no][$locidx]['checked'] = - isCheckSet ("atom_${rack_id}_${unit_no}_${locidx}") ? ' checked' : ''; + isCheckSet ("atom_{$rack_id}_{$unit_no}_{$locidx}") ? ' checked' : ''; } // wrapper around ip4_mask and ip6_mask @@ -1285,7 +1285,7 @@ function getRSUforRow ($rowData) function string_insert_hrefs_callback ($m) { $t_url_href = 'href="' . rtrim($m[1], '.') . '"'; - $s_url_replace = "$m[1] [^]"; + $s_url_replace = "$m[1] [^]"; return $s_url_replace; } @@ -1312,19 +1312,19 @@ function string_insert_hrefs ($p_string) # valid set of characters that may occur in url scheme. Note: - should be first (A-F != -AF). $t_url_valid_chars = '-_.,!~*\';\/?%^\\\\:@&={\|}+$#[:alnum:]\pL'; - $t_url_chars = "(?:${t_url_hex}|[${t_url_valid_chars}\(\)\[\]])"; - $t_url_chars2 = "(?:${t_url_hex}|[${t_url_valid_chars}])"; - $t_url_chars_in_brackets = "(?:${t_url_hex}|[${t_url_valid_chars}\(\)])"; - $t_url_chars_in_parens = "(?:${t_url_hex}|[${t_url_valid_chars}\[\]])"; + $t_url_chars = "(?:{$t_url_hex}|[{$t_url_valid_chars}\(\)\[\]])"; + $t_url_chars2 = "(?:{$t_url_hex}|[{$t_url_valid_chars}])"; + $t_url_chars_in_brackets = "(?:{$t_url_hex}|[{$t_url_valid_chars}\(\)])"; + $t_url_chars_in_parens = "(?:{$t_url_hex}|[{$t_url_valid_chars}\[\]])"; - $t_url_part1 = "${t_url_chars}"; - $t_url_part2 = "(?:\(${t_url_chars_in_parens}*\)|\[${t_url_chars_in_brackets}*\]|${t_url_chars2})"; + $t_url_part1 = "{$t_url_chars}"; + $t_url_part2 = "(?:\({$t_url_chars_in_parens}*\)|\[{$t_url_chars_in_brackets}*\]|{$t_url_chars2})"; - $s_url_regex = "/(${t_url_protocol}(${t_url_part1}*?${t_url_part2}+))/su"; + $s_url_regex = "/({$t_url_protocol}({$t_url_part1}*?{$t_url_part2}+))/su"; # URL replacement $t_url_href = "href=\"'.rtrim('\\1','.').'\""; - $s_url_replace = "'\\1 [^]'"; + $s_url_replace = "'\\1 [^]'"; # e-mail regex $s_email_regex = substr_replace (email_regex_simple(), '(?:mailto:)?', 1, 0); @@ -1364,9 +1364,9 @@ function email_regex_simple() # a domain is one or more subdomains $t_subdomain = "(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)"; - $t_domain = "(${t_subdomain}(?:\.${t_subdomain})*)"; + $t_domain = "({$t_subdomain}(?:\.{$t_subdomain})*)"; - $s_email_regex = "/${t_recipient}\@${t_domain}/i"; + $s_email_regex = "/{$t_recipient}\@{$t_domain}/i"; } return $s_email_regex; } @@ -3027,7 +3027,7 @@ function formatFileSize ($bytes) { // bytes if($bytes < 1024) // bytes - return "${bytes} bytes"; + return "{$bytes} bytes"; // kilobytes if ($bytes < 1024000) @@ -3141,7 +3141,7 @@ function cookOptgroups ($recordList, $object_type_id = 0, $existing_value = 0) { $screenlist = array(); foreach (explode (';', getConfigVar ('VENDOR_SIEVE')) as $sieve) - if (preg_match ("/^([^@]+)(@${object_type_id})?\$/", trim ($sieve), $regs)) + if (preg_match ("/^([^@]+)(@{$object_type_id})?\$/", trim ($sieve), $regs)) $screenlist[] = $regs[1]; foreach (array_keys ($ret) as $vendor) @@ -3224,7 +3224,7 @@ function eval_expression ($expr, $tagchain, $silent = FALSE) if (!isset ($pTable[$pname])) { if (!$silent) - showWarning ("Undefined predicate [${pname}]"); + showWarning ("Undefined predicate [{$pname}]"); return NULL; } return $self ($pTable[$pname], $tagchain, $silent); @@ -3251,7 +3251,7 @@ function eval_expression ($expr, $tagchain, $silent = FALSE) return FALSE; default: if (!$silent) - showWarning ("Evaluation error, cannot process expression type '${expr['type']}'"); + showWarning ("Evaluation error, cannot process expression type '{$expr['type']}'"); return NULL; } } @@ -3348,11 +3348,11 @@ function getAllVLANOptions ($except = array()) { $domain_list = array(); foreach (getDomainVLANList ($domain_id, TRUE) as $vlan) - $domain_list["${domain_id}-${vlan['vlan_id']}"] = "${vlan['vlan_id']} ${vlan['vlan_descr']}"; + $domain_list["{$domain_id}-{$vlan['vlan_id']}"] = "{$vlan['vlan_id']} {$vlan['vlan_descr']}"; if (isset ($except[$domain_id])) foreach ($except[$domain_id] as $vid) - if (isset ($domain_list["${domain_id}-${vid}"])) - unset ($domain_list["${domain_id}-${vid}"]); + if (isset ($domain_list["{$domain_id}-{$vid}"])) + unset ($domain_list["{$domain_id}-{$vid}"]); $ret[$domain_descr] = $domain_list; } return $ret; @@ -3540,7 +3540,7 @@ function groupIntsToRanges ($list, $exclude_value = NULL) else { if ($id_to) - $result[] = $id_from == $id_to ? $id_from : "${id_from}-${id_to}"; // flush + $result[] = $id_from == $id_to ? $id_from : "{$id_from}-{$id_to}"; // flush $id_from = $id_to = $next_id; // start next pair } return $result; @@ -3696,7 +3696,7 @@ function reduceSubarraysToColumn ($input, $column) if (array_key_exists ($column, $item)) $ret[$key] = $item[$column]; else - throw new InvalidArgException ('input', '(array)', "column '${column}' is not set for subarray at index '${key}'"); + throw new InvalidArgException ('input', '(array)', "column '{$column}' is not set for subarray at index '{$key}'"); return $ret; } @@ -4593,7 +4593,7 @@ function strerror8021Q ($errno) E_8021Q_PUSH_REMOTE_ERROR => 'push failed due to remote error', E_8021Q_SYNC_DISABLED => 'sync disabled by operator', ); - return array_fetch ($errstr, $errno, "unknown error code ${errno}"); + return array_fetch ($errstr, $errno, "unknown error code {$errno}"); } function saveDownlinksReverb ($object_id, $requested_changes) @@ -5634,35 +5634,35 @@ function formatAgeSeconds ($seconds) case $seconds < 1: return 'just now'; case $seconds < 60: - return "${seconds}s" . ' ago'; + return "{$seconds}s" . ' ago'; case $seconds <= 300: $mins = intval ($seconds / 60); $secs = $seconds % 60; - return ($secs ? "{$mins}min ${secs}s" : "{$mins}min") . ' ago'; + return ($secs ? "{$mins}min {$secs}s" : "{$mins}min") . ' ago'; case $seconds < 3600: return round ($seconds / 60) . 'min' . ' ago'; case $seconds < 3 * 3600: $hrs = intval ($seconds / 3600); $mins = round (($seconds % 3600) / 60) . ''; - return ($mins ? "${hrs}h ${mins}min" : "${hrs}h") . ' ago'; + return ($mins ? "{$hrs}h {$mins}min" : "{$hrs}h") . ' ago'; case $seconds < 86400: return round ($seconds / 3600) . 'h' . ' ago'; case $seconds < 86400 * 3: $days = intval ($seconds / 86400); $hrs = round (($seconds - $days * 86400) / 3600); - return ($hrs ? "${days}d ${hrs}h" : "${days}d") . ' ago'; + return ($hrs ? "{$days}d {$hrs}h" : "{$days}d") . ' ago'; case $seconds < 86400 * 30.4375: return round ($seconds / 86400) . 'd' . ' ago'; case $seconds < 86400 * 30.4375 * 4 : $mon = intval ($seconds / 86400 / 30.4375); $days = round (($seconds - $mon * 86400 * 30.4375) / 86400); - return ($days ? "${mon}mo ${days}d" : "${mon}mo") . ' ago'; + return ($days ? "{$mon}mo {$days}d" : "{$mon}mo") . ' ago'; case $seconds < 365.25 * 86400: return (round ($seconds / 86400 / 30.4375) . 'mo') . ' ago'; case $seconds < 2 * 365.25 * 86400: $yrs = intval ($seconds / 86400 / 365.25); $mon = round (($seconds - $yrs * 86400 * 365.25) / 86400 / 30.4375); - return ($mon ? "${yrs}y ${mon}mo" : "${yrs}y") . ' ago'; + return ($mon ? "{$yrs}y {$mon}mo" : "{$yrs}y") . ' ago'; default: return (round ($seconds / 86400 / 365.25) . 'y') . ' ago'; } @@ -6209,7 +6209,7 @@ function mkCellA ($cell, $title = NULL) { global $pageno_by_etype; if (! isset ($pageno_by_etype[$cell['realm']])) - throw new RackTablesError ("Internal structure error in array \$pageno_by_etype. Page for realm '${cell['realm']}' is not set", RackTablesError::INTERNAL); + throw new RackTablesError ("Internal structure error in array \$pageno_by_etype. Page for realm '{$cell['realm']}' is not set", RackTablesError::INTERNAL); $cell_page = $pageno_by_etype[$cell['realm']]; $cell_key = $cell[$cell['realm'] == 'user' ? 'user_id' : 'id']; if ($title === NULL) @@ -6379,7 +6379,7 @@ function timestampFromDatetimestr ($s) { $format = getConfigVar ('DATETIME_FORMAT'); if (FALSE === $tmp = strptime ($s, $format)) - throw new InvalidArgException ('s', $s, "not a date in format '${format}'"); + throw new InvalidArgException ('s', $s, "not a date in format '{$format}'"); $ret = mktime ( $tmp['tm_hour'], # 0~23 @@ -6403,7 +6403,7 @@ function SQLDateFromDateStr ($s, $format = NULL) if ($format === NULL) $format = getConfigVar ('DATEONLY_FORMAT'); if (FALSE === $tmp = strptime ($s, $format)) - throw new InvalidArgException ('s', $s, "not a date in format '${format}'"); + throw new InvalidArgException ('s', $s, "not a date in format '{$format}'"); $y = $tmp['tm_year'] + 1900; $m = $tmp['tm_mon'] + 1; $d = $tmp['tm_mday']; @@ -6496,10 +6496,10 @@ function printLocationChildrenSelectOptions ($location, $parent_id, $location_id { if ($subLocation['id'] == $location_id) continue; - echo "\n"; + echo '>' . str_repeat ('» ', $level) . "{$subLocation['name']}\n"; if ($subLocation['kidc'] > 0) $self ($subLocation, $parent_id, $location_id, $level); } @@ -6630,9 +6630,9 @@ function getLastCreatedId ($realm) function formatPatchCableHeapAsPlainText ($heap) { - $text = "${heap['amount']} pcs: [${heap['end1_connector']}] ${heap['pctype']} [${heap['end2_connector']}]"; + $text = "{$heap['amount']} pcs: [{$heap['end1_connector']}] {$heap['pctype']} [{$heap['end2_connector']}]"; if ($heap['description'] != '') - $text .= " (${heap['description']})"; + $text .= " ({$heap['description']})"; return stringForOption ($text, 512); } @@ -6647,7 +6647,7 @@ function groupBy ($list, $group_field) foreach ($list as $index => $item) { if (! is_array ($item)) - throw new InvalidArgException ("list[${index}]", $item, 'must be an array'); + throw new InvalidArgException ("list[{$index}]", $item, 'must be an array'); $key = ''; if (isset ($item[$group_field])) $key = (string) $item[$group_field]; @@ -6749,10 +6749,10 @@ function requireListOfFiles ($x) function requireExtraFiles ($reqlist, $pageno, $tabno) { - if (array_key_exists ("${pageno}-${tabno}", $reqlist)) - requireListOfFiles ($reqlist["${pageno}-${tabno}"]); - if (array_key_exists ("${pageno}-*", $reqlist)) - requireListOfFiles ($reqlist["${pageno}-*"]); + if (array_key_exists ("{$pageno}-{$tabno}", $reqlist)) + requireListOfFiles ($reqlist["{$pageno}-{$tabno}"]); + if (array_key_exists ("{$pageno}-*", $reqlist)) + requireListOfFiles ($reqlist["{$pageno}-*"]); } // Return the text as a list of lines after removing CRs, empty lines diff --git a/wwwroot/inc/init.php b/wwwroot/inc/init.php index ab328ebef..4c9a8224b 100644 --- a/wwwroot/inc/init.php +++ b/wwwroot/inc/init.php @@ -31,7 +31,7 @@ throw new RackTablesError ( "This instance of RackTables misses a configuration file " . - "(${path_to_secret_php}).
" . + "({$path_to_secret_php}).
" . "The configuration file is usually generated by RackTables installer, which " . "can be launched here.", RackTablesError::MISCONFIGURED @@ -152,7 +152,7 @@ // load v1 plugins ob_start(); -if (FALSE !== $plugin_files = glob ("${racktables_plugins_dir}/*.php")) +if (FALSE !== $plugin_files = glob ("{$racktables_plugins_dir}/*.php")) foreach ($plugin_files as $plugin_file) require_once $plugin_file; // display plugins output if it contains something but newlines @@ -164,8 +164,8 @@ // load v2 plugins that are enabled $plugins = getPlugins ('enabled'); foreach (array_keys ($plugins) as $plugin) - if (function_exists ("plugin_${plugin}_init")) - call_user_func ("plugin_${plugin}_init"); + if (function_exists ("plugin_{$plugin}_init")) + call_user_func ("plugin_{$plugin}_init"); // These will be filled in by fixContext() $expl_tags = array(); diff --git a/wwwroot/inc/install.php b/wwwroot/inc/install.php index e3feb330c..0a75c363d 100644 --- a/wwwroot/inc/install.php +++ b/wwwroot/inc/install.php @@ -25,13 +25,13 @@ function renderInstallerHTML() header ('Location: ' . $_SERVER['PHP_SELF']); exit; } -$title = "RackTables installation: step ${step} of " . count ($stepfunc); +$title = "RackTables installation: step {$step} of " . count ($stepfunc); header ('Content-Type: text/html; charset=UTF-8'); // Heredoc, not nowdoc! echo <<<"ENDOFTEXT" -${title} +{$title}