Apply automated PHP8 safety transforms
Agent-Logs-Url: https://github.com/GameServerPanel/GSP/sessions/89922108-1604-44ae-949d-358d32b9d70a Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
parent
aca850b6cd
commit
e44519c030
465 changed files with 1716 additions and 1716 deletions
|
|
@ -135,7 +135,7 @@ function normalize_messages($messages) {
|
|||
if (empty($messages['data']) || !is_array($messages['data'])) return $out;
|
||||
|
||||
// The API returns newest first by default if not specifying; we request 'asc' in fetch.
|
||||
foreach ($messages['data'] as $m) {
|
||||
foreach ((array)$messages['data'] as $m) {
|
||||
$role = $m['role'] ?? '';
|
||||
if (!in_array($role, ['user', 'assistant', 'system'], true)) continue;
|
||||
|
||||
|
|
@ -143,14 +143,14 @@ function normalize_messages($messages) {
|
|||
|
||||
$all_text = [];
|
||||
$refs = [];
|
||||
foreach ($m['content'] as $part) {
|
||||
foreach ((array)$m['content'] as $part) {
|
||||
if (($part['type'] ?? '') === 'text' && !empty($part['text']['value'])) {
|
||||
$all_text[] = $part['text']['value'];
|
||||
|
||||
// Parse annotations for citations (file_citation)
|
||||
$anns = $part['text']['annotations'] ?? [];
|
||||
if (is_array($anns)) {
|
||||
foreach ($anns as $ann) {
|
||||
foreach ((array)$anns as $ann) {
|
||||
if (($ann['type'] ?? '') === 'file_citation' && !empty($ann['file_citation']['file_id'])) {
|
||||
$fid = $ann['file_citation']['file_id'];
|
||||
$page = null;
|
||||
|
|
@ -263,7 +263,7 @@ include(__DIR__ . '/includes/menu.php');
|
|||
|
||||
<?php if (!empty($history) && is_array($history)): ?>
|
||||
<div style="margin-top:16px; padding:10px; border:1px solid #ccc; border-radius:8px;">
|
||||
<?php foreach ($history as $msg):
|
||||
<?php foreach ((array)$history as $msg):
|
||||
// Label mapping: user => Question, assistant => Answer, system => (optional)
|
||||
$role = $msg['role'] ?? 'assistant';
|
||||
if ($role === 'user') $label = 'Question';
|
||||
|
|
@ -280,7 +280,7 @@ include(__DIR__ . '/includes/menu.php');
|
|||
<div style="margin-top:6px; font-size:12px;">
|
||||
<em>References:</em>
|
||||
<ul style="margin:6px 0 0 18px; padding:0;">
|
||||
<?php foreach ($refs as $r):
|
||||
<?php foreach ((array)$refs as $r):
|
||||
$fname = $r['filename'] ?? 'file';
|
||||
$page = $r['page'] ?? 'n/a';
|
||||
// If you have your own document links, replace '#' with a real URL.
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ $game_options = [];
|
|||
$games_dir = __DIR__ . '/../../config_games/server_configs/';
|
||||
if (is_dir($games_dir)) {
|
||||
$files = scandir($games_dir);
|
||||
foreach ($files as $file) {
|
||||
foreach ((array)$files as $file) {
|
||||
if (pathinfo($file, PATHINFO_EXTENSION) === 'xml' && strpos($file, '.bak') === false) {
|
||||
$game_key = str_replace('.xml', '', $file);
|
||||
$game_options[] = $game_key;
|
||||
|
|
@ -265,7 +265,7 @@ include(__DIR__ . '/includes/menu.php');
|
|||
<div id="game_filter_list_container" class="form-group" style="display:none;">
|
||||
<label>Select Games</label>
|
||||
<div class="game-checkboxes">
|
||||
<?php foreach ($game_options as $game): ?>
|
||||
<?php foreach ((array)$game_options as $game): ?>
|
||||
<label>
|
||||
<input type="checkbox" name="game_filter_list[]" value="<?php echo h($game); ?>">
|
||||
<?php echo h($game); ?>
|
||||
|
|
@ -325,7 +325,7 @@ include(__DIR__ . '/includes/menu.php');
|
|||
<?php if ($coupon['game_filter_type'] === 'all_games'): ?>
|
||||
All Games
|
||||
<?php else: ?>
|
||||
<?php echo count($games_filtered); ?> specific games
|
||||
<?php echo count((array)$games_filtered); ?> specific games
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
|
|
@ -397,7 +397,7 @@ include(__DIR__ . '/includes/menu.php');
|
|||
<div class="form-group" style="display:<?php echo $coupon['game_filter_type'] === 'specific_games' ? 'block' : 'none'; ?>;">
|
||||
<label>Select Games</label>
|
||||
<div class="game-checkboxes">
|
||||
<?php foreach ($game_options as $game): ?>
|
||||
<?php foreach ((array)$game_options as $game): ?>
|
||||
<label>
|
||||
<input type="checkbox" name="game_filter_list[]" value="<?php echo h($game); ?>"
|
||||
<?php echo in_array($game, $games_filtered) ? 'checked' : ''; ?>>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ function exec_ogp_module()
|
|||
$action = $_POST['bulk_action'];
|
||||
$selected = $_POST['selected_orders'];
|
||||
|
||||
foreach ($selected as $order_id) {
|
||||
foreach ((array)$selected as $order_id) {
|
||||
$order_id = $db->realEscapeSingle($order_id);
|
||||
|
||||
switch ($action) {
|
||||
|
|
@ -41,7 +41,7 @@ function exec_ogp_module()
|
|||
}
|
||||
}
|
||||
|
||||
echo "<div class='success'><p>Bulk action completed for ".count($selected)." order(s).</p></div>";
|
||||
echo "<div class='success'><p>Bulk action completed for ".count((array)$selected)." order(s).</p></div>";
|
||||
}
|
||||
|
||||
// Get filter parameters
|
||||
|
|
@ -125,7 +125,7 @@ function exec_ogp_module()
|
|||
echo "<th>Actions</th>";
|
||||
echo "</tr></thead><tbody>";
|
||||
|
||||
foreach ($orders as $order) {
|
||||
foreach ((array)$orders as $order) {
|
||||
$status_class = '';
|
||||
switch ($order['status']) {
|
||||
case 'paid': $status_class = 'label-warning'; break;
|
||||
|
|
@ -191,7 +191,7 @@ function exec_ogp_module()
|
|||
echo "<table class='tablesorter' style='width: auto;'>";
|
||||
echo "<thead><tr><th>Status</th><th>Count</th><th>Total Value</th></tr></thead><tbody>";
|
||||
|
||||
foreach ($stats as $stat) {
|
||||
foreach ((array)$stats as $stat) {
|
||||
echo "<tr>";
|
||||
echo "<td>".$stat['status']."</td>";
|
||||
echo "<td>".$stat['count']."</td>";
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ function h($s){ return htmlspecialchars((string)$s, ENT_QUOTES, 'UTF-8'); }
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($files as $f): $j = json_decode(file_get_contents($f), true) ?: []; ?>
|
||||
<?php foreach ((array)$files as $f): $j = json_decode(file_get_contents($f), true) ?: []; ?>
|
||||
<tr>
|
||||
<td><?php echo h(basename($f)); ?></td>
|
||||
<td><?php echo h($j['invoice'] ?? ($j['custom'] ?? '')); ?></td>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ $errors = [];
|
|||
|
||||
$availableFiles = [];
|
||||
$directoryIterator = new DirectoryIterator($serverConfigDir);
|
||||
foreach ($directoryIterator as $fileInfo) {
|
||||
foreach ((array)$directoryIterator as $fileInfo) {
|
||||
if ($fileInfo->isFile() && strtolower($fileInfo->getExtension()) === 'xml') {
|
||||
$availableFiles[] = $fileInfo->getFilename();
|
||||
}
|
||||
|
|
@ -86,7 +86,7 @@ function billing_render_flash(array $items, string $cssClass): void {
|
|||
return;
|
||||
}
|
||||
echo '<div class="panel ' . $cssClass . '" style="margin-bottom:12px">';
|
||||
foreach ($items as $item) {
|
||||
foreach ((array)$items as $item) {
|
||||
echo '<div>' . $item . '</div>';
|
||||
}
|
||||
echo '</div>';
|
||||
|
|
@ -134,7 +134,7 @@ function billing_render_flash(array $items, string $cssClass): void {
|
|||
<?php if (!$availableFiles): ?>
|
||||
<p style="color:#e5e7eb;">No XML files found.</p>
|
||||
<?php else: ?>
|
||||
<?php foreach ($availableFiles as $fileName): ?>
|
||||
<?php foreach ((array)$availableFiles as $fileName): ?>
|
||||
<?php $isActive = ($fileName === $selectedFile); ?>
|
||||
<a href="admin_xml_editor.php?file=<?php echo urlencode($fileName); ?>" class="<?php echo $isActive ? 'active' : ''; ?>"><?php echo htmlspecialchars($fileName, ENT_QUOTES, 'UTF-8'); ?></a>
|
||||
<?php endforeach; ?>
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ function col_exists($db, $table, $col){
|
|||
function parse_id_list($s){
|
||||
$tokens = preg_split('/\s+/', trim((string)$s));
|
||||
$out = [];
|
||||
foreach ($tokens as $t) {
|
||||
foreach ((array)$tokens as $t) {
|
||||
if ($t === '') continue;
|
||||
if (preg_match('/^\d+$/', $t)) $out[] = (int)$t;
|
||||
}
|
||||
|
|
@ -73,7 +73,7 @@ if (isset($_POST['update_remote_servers'])) {
|
|||
$enabledIds = array_map('intval', $_POST['rs'] ?? []);
|
||||
$enabledSet = array_flip($enabledIds);
|
||||
$allIds = fetch_all_assoc($db, "SELECT remote_server_id FROM {$table_prefix}remote_servers");
|
||||
foreach ($allIds as $row) {
|
||||
foreach ((array)$allIds as $row) {
|
||||
$id = (int)$row['remote_server_id'];
|
||||
$e = isset($enabledSet[$id]) ? 1 : 0;
|
||||
$db->query("UPDATE {$table_prefix}remote_servers SET enabled={$e} WHERE remote_server_id={$id}");
|
||||
|
|
@ -134,7 +134,7 @@ if (isset($_POST['update_single']) && isset($_POST['service']) && is_array($_POS
|
|||
|
||||
/* B2) BULK UPDATE (single button at bottom) */
|
||||
if (isset($_POST['bulk_update']) && !empty($_POST['service']) && is_array($_POST['service'])) {
|
||||
foreach ($_POST['service'] as $sid => $svc) {
|
||||
foreach ((array)$_POST['service'] as $sid => $svc) {
|
||||
update_service_row($db, $locationCol, (int)$sid, (array)$svc);
|
||||
}
|
||||
$flash[] = "All edited services have been updated.";
|
||||
|
|
@ -153,15 +153,15 @@ $services = fetch_all_assoc($db, "SELECT service_id, service_name, `{$locat
|
|||
?>
|
||||
|
||||
<?php if ($flash): ?>
|
||||
<div class="panel" style="margin-bottom:12px"><?php foreach($flash as $m) echo "<div>".h($m)."</div>"; ?></div>
|
||||
<div class="panel mb-12"><?php foreach($flash as $m) echo "<div>".h($m)."</div>"; ?></div>
|
||||
<div class="panel" style="margin-bottom:12px"><?php foreach ((array)$flash as $m) echo "<div>".h($m)."</div>"; ?></div>
|
||||
<div class="panel mb-12"><?php foreach ((array)$flash as $m) echo "<div>".h($m)."</div>"; ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<h2>Enable/Disable Server Locations (Global)</h2>
|
||||
<form method="post" action="">
|
||||
<input type="hidden" name="update_remote_servers" value="1">
|
||||
<div style="display:flex;flex-wrap:wrap;gap:10px;">
|
||||
<?php foreach ($remoteServers as $rs): ?>
|
||||
<?php foreach ((array)$remoteServers as $rs): ?>
|
||||
<label class="loc-label min-w-240">
|
||||
<input type="checkbox" name="rs[]" value="<?php echo (int)$rs['remote_server_id']; ?>" <?php echo ((int)$rs['enabled']===1?'checked':''); ?>>
|
||||
<b><?php echo h($rs['remote_server_name']); ?></b>
|
||||
|
|
@ -199,7 +199,7 @@ $services = fetch_all_assoc($db, "SELECT service_id, service_name, `{$locat
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($services as $row): ?>
|
||||
<?php foreach ((array)$services as $row): ?>
|
||||
<?php
|
||||
$sid = (int)$row['service_id'];
|
||||
$selected = parse_id_list($row['locs'] ?? '');
|
||||
|
|
@ -277,7 +277,7 @@ $services = fetch_all_assoc($db, "SELECT service_id, service_name, `{$locat
|
|||
<tr>
|
||||
<td colspan="8" style="border-bottom:1px solid #f0f0f0; padding:8px 6px; text-align:left;">
|
||||
<div class="locs-box" data-sid="<?php echo $sid; ?>" style="display:flex; flex-wrap:wrap; gap:8px;">
|
||||
<?php foreach ($remoteServers as $rs): ?>
|
||||
<?php foreach ((array)$remoteServers as $rs): ?>
|
||||
<?php
|
||||
$rid = (int)$rs['remote_server_id'];
|
||||
$isChecked = isset($selSet[$rid]);
|
||||
|
|
@ -317,7 +317,7 @@ $services = fetch_all_assoc($db, "SELECT service_id, service_name, `{$locat
|
|||
<form method="post" action="" style="display:flex;gap:8px;align-items:center;">
|
||||
<input type="hidden" name="remove_service" value="1">
|
||||
<select name="service_id_remove">
|
||||
<?php foreach ($services as $s): ?>
|
||||
<?php foreach ((array)$services as $s): ?>
|
||||
<option value="<?php echo (int)$s['service_id']; ?>">
|
||||
<?php echo h($s['service_name']); ?> (ID: <?php echo (int)$s['service_id']; ?>)
|
||||
</option>
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ function normalize_messages($messages) {
|
|||
if (empty($messages['data']) || !is_array($messages['data'])) return $out;
|
||||
|
||||
// The API returns newest first by default if not specifying; we request 'asc' in fetch.
|
||||
foreach ($messages['data'] as $m) {
|
||||
foreach ((array)$messages['data'] as $m) {
|
||||
$role = $m['role'] ?? '';
|
||||
if (!in_array($role, ['user', 'assistant', 'system'], true)) continue;
|
||||
|
||||
|
|
@ -143,14 +143,14 @@ function normalize_messages($messages) {
|
|||
|
||||
$all_text = [];
|
||||
$refs = [];
|
||||
foreach ($m['content'] as $part) {
|
||||
foreach ((array)$m['content'] as $part) {
|
||||
if (($part['type'] ?? '') === 'text' && !empty($part['text']['value'])) {
|
||||
$all_text[] = $part['text']['value'];
|
||||
|
||||
// Parse annotations for citations (file_citation)
|
||||
$anns = $part['text']['annotations'] ?? [];
|
||||
if (is_array($anns)) {
|
||||
foreach ($anns as $ann) {
|
||||
foreach ((array)$anns as $ann) {
|
||||
if (($ann['type'] ?? '') === 'file_citation' && !empty($ann['file_citation']['file_id'])) {
|
||||
$fid = $ann['file_citation']['file_id'];
|
||||
$page = null;
|
||||
|
|
@ -263,7 +263,7 @@ include(__DIR__ . '/includes/menu.php');
|
|||
|
||||
<?php if (!empty($history) && is_array($history)): ?>
|
||||
<div style="margin-top:16px; padding:10px; border:1px solid #ccc; border-radius:8px;">
|
||||
<?php foreach ($history as $msg):
|
||||
<?php foreach ((array)$history as $msg):
|
||||
// Label mapping: user => Question, assistant => Answer, system => (optional)
|
||||
$role = $msg['role'] ?? 'assistant';
|
||||
if ($role === 'user') $label = 'Question';
|
||||
|
|
@ -280,7 +280,7 @@ include(__DIR__ . '/includes/menu.php');
|
|||
<div style="margin-top:6px; font-size:12px;">
|
||||
<em>References:</em>
|
||||
<ul style="margin:6px 0 0 18px; padding:0;">
|
||||
<?php foreach ($refs as $r):
|
||||
<?php foreach ((array)$refs as $r):
|
||||
$fname = $r['filename'] ?? 'file';
|
||||
$page = $r['page'] ?? 'n/a';
|
||||
// If you have your own document links, replace '#' with a real URL.
|
||||
|
|
|
|||
|
|
@ -76,14 +76,14 @@ create_order_log('PARSED_INPUT', [
|
|||
'currency' => $currency,
|
||||
'invoice_id' => $invoice_id,
|
||||
'custom_id' => $custom_id,
|
||||
'items_count' => $items ? count($items) : 0,
|
||||
'line_invoices_count' => $line_invoices ? count($line_invoices) : 0
|
||||
'items_count' => $items ? count((array)$items) : 0,
|
||||
'line_invoices_count' => $line_invoices ? count((array)$line_invoices) : 0
|
||||
]);
|
||||
|
||||
$amount_value = number_format((float)$amount_in, 2, '.', '');
|
||||
if ($items) {
|
||||
$sum = 0.00;
|
||||
foreach ($items as $it) {
|
||||
foreach ((array)$items as $it) {
|
||||
$qty = isset($it['quantity']) ? (int)$it['quantity'] : 1;
|
||||
$val = isset($it['unit_amount']['value']) ? (float)$it['unit_amount']['value'] : 0.00;
|
||||
$sum += $qty * $val;
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ if (!$db) {
|
|||
mysqli_free_result($result);
|
||||
}
|
||||
|
||||
$cart_empty = (count($invoices) === 0);
|
||||
$cart_empty = (count((array)$invoices) === 0);
|
||||
}
|
||||
|
||||
// Handle coupon application
|
||||
|
|
@ -120,9 +120,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['apply_coupon'])) {
|
|||
$game_valid = true;
|
||||
if ($coupon['game_filter_type'] === 'specific_games' && !empty($coupon['game_filter_list'])) {
|
||||
$allowed_games = json_decode($coupon['game_filter_list'], true);
|
||||
if (is_array($allowed_games) && count($allowed_games) > 0) {
|
||||
if (is_array($allowed_games) && count((array)$allowed_games) > 0) {
|
||||
$has_valid_game = false;
|
||||
foreach ($invoices as $inv) {
|
||||
foreach ((array)$invoices as $inv) {
|
||||
$inv_game_key = isset($inv['game_key']) ? $inv['game_key'] : null;
|
||||
if ($inv_game_key !== null && in_array($inv_game_key, $allowed_games)) {
|
||||
$has_valid_game = true;
|
||||
|
|
@ -256,7 +256,7 @@ $client_id = 'AfvY_C2zA_hTHxHq7TIhtOeub4xBdySYrt_Hjj3d_WYQwjWI9NfOAVOTeResx2rgZ_
|
|||
|
||||
// Prepare PayPal items
|
||||
$paypal_items = [];
|
||||
foreach ($invoices as $inv) {
|
||||
foreach ((array)$invoices as $inv) {
|
||||
$game_display = !empty($inv['game_name']) ? $inv['game_name'] : 'Game Server';
|
||||
$qty = max(1, intval($inv['qty']));
|
||||
$paypal_items[] = [
|
||||
|
|
@ -550,7 +550,7 @@ $siteBase = $protocol . $host;
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($invoices as $inv): ?>
|
||||
<?php foreach ((array)$invoices as $inv): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="game-name"><?php echo htmlspecialchars($inv['game_name'] ?? 'Game Server'); ?></div>
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ if (mysqli_num_rows($last_result) > 0) {
|
|||
|
||||
while ($row = mysqli_fetch_assoc($last_result)) {
|
||||
echo "<tr>";
|
||||
foreach ($row as $val) {
|
||||
foreach ((array)$row as $val) {
|
||||
echo "<td>" . htmlspecialchars($val ?? 'NULL') . "</td>";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ function exec_ogp_module()
|
|||
$provisioned_count = 0;
|
||||
$failed_count = 0;
|
||||
|
||||
foreach($orders as $order)
|
||||
foreach ((array)$orders as $order)
|
||||
{
|
||||
$order_id = $order['order_id'];
|
||||
$processed_orders[] = intval($order_id);
|
||||
|
|
@ -137,7 +137,7 @@ function exec_ogp_module()
|
|||
If you have any questions or requests, visit our website or contact us directly in our Discord Server.";
|
||||
|
||||
$mail = mymail($email, $subject, $message, $settings);
|
||||
$rundate = date('d/M/y G:i',$now);
|
||||
$rundate = date('d/M/y G:i', is_numeric($now) ? (int)$now : strtotime($now));
|
||||
|
||||
if (!$mail)
|
||||
$db->logger( "Email FAILED - Server Renewed " . $home_id);
|
||||
|
|
@ -180,7 +180,7 @@ function exec_ogp_module()
|
|||
//Add IP:Port Pair to the Game Home
|
||||
//need to get the IP_ID for this remote server.
|
||||
$result = $db->resultQuery("SELECT ip_id FROM OGP_DB_PREFIXremote_server_ips WHERE remote_server_id=".$ip);
|
||||
foreach ($result as $rs)
|
||||
foreach ((array)$result as $rs)
|
||||
{
|
||||
$ip_id = $rs['ip_id'];
|
||||
}
|
||||
|
|
@ -303,7 +303,7 @@ function exec_ogp_module()
|
|||
You can login to the Game Panel and click on Game Monitor to see your server. <br><br>
|
||||
Thank you!<br> ";
|
||||
$mail = mymail($email, $subject, $message, $settings);
|
||||
$rundate = date('d/M/y G:i',$now);
|
||||
$rundate = date('d/M/y G:i', is_numeric($now) ? (int)$now : strtotime($now));
|
||||
|
||||
if (!$mail)
|
||||
$db->logger( "Email FAILED - Server Created " . $home_id);
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ $today = time();
|
|||
$invoice_date = strtotime('+ 7 days'); // Create invoice 7 days before expiration
|
||||
$suspend_date = $today; // Suspend immediately when overdue
|
||||
$removal_date = strtotime('- 7 days'); // Remove 7 days after suspension
|
||||
$rundate = date('Y-m-d H:i:s', $today);
|
||||
$rundate = date('Y-m-d H:i:s', is_numeric($today) ? (int)$today : strtotime($today));
|
||||
|
||||
$db->logger("BILLING-CRON: Server lifecycle automation running at " . $rundate);
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ $upcoming_expirations = $db->resultQuery("
|
|||
");
|
||||
|
||||
if (is_array($upcoming_expirations)) {
|
||||
foreach ($upcoming_expirations as $order) {
|
||||
foreach ((array)$upcoming_expirations as $order) {
|
||||
$user_id = $order['user_id'];
|
||||
$order_id = $order['order_id'];
|
||||
$home_id = $order['home_id'];
|
||||
|
|
@ -158,7 +158,7 @@ $servers_to_suspend = $db->resultQuery("
|
|||
");
|
||||
|
||||
if (is_array($servers_to_suspend)) {
|
||||
foreach ($servers_to_suspend as $order) {
|
||||
foreach ((array)$servers_to_suspend as $order) {
|
||||
$user_id = $order['user_id'];
|
||||
$home_id = $order['home_id'];
|
||||
$order_id = $order['order_id'];
|
||||
|
|
@ -185,7 +185,7 @@ if (is_array($servers_to_suspend)) {
|
|||
$control_type = isset($server_xml->control_protocol_type) ? $server_xml->control_protocol_type : "";
|
||||
$addresses = $db->getHomeIpPorts($home_id);
|
||||
|
||||
foreach ($addresses as $address) {
|
||||
foreach ((array)$addresses as $address) {
|
||||
$remote->remote_stop_server($home_id, $address['ip'], $address['port'],
|
||||
$server_xml->control_protocol, $home_info['control_password'],
|
||||
$control_type, $home_info['home_path']);
|
||||
|
|
@ -234,7 +234,7 @@ $servers_to_delete = $db->resultQuery("
|
|||
");
|
||||
|
||||
if (is_array($servers_to_delete)) {
|
||||
foreach ($servers_to_delete as $order) {
|
||||
foreach ((array)$servers_to_delete as $order) {
|
||||
$user_id = $order['user_id'];
|
||||
$home_id = $order['home_id'];
|
||||
$order_id = $order['order_id'];
|
||||
|
|
@ -305,7 +305,7 @@ if (!is_array($user_homes))
|
|||
}
|
||||
else
|
||||
{
|
||||
foreach($user_homes as $user_home)
|
||||
foreach ((array)$user_homes as $user_home)
|
||||
{
|
||||
|
||||
// Developer note:
|
||||
|
|
@ -358,7 +358,7 @@ if (!is_array($user_homes))
|
|||
}
|
||||
else
|
||||
{
|
||||
foreach($user_homes as $user_home)
|
||||
foreach ((array)$user_homes as $user_home)
|
||||
{
|
||||
$user_id = $user_home['user_id'];
|
||||
$home_id = $user_home['home_id'];
|
||||
|
|
@ -371,7 +371,7 @@ else
|
|||
$server_xml = read_server_config(SERVER_CONFIG_LOCATION."/".$home_info['home_cfg_file']);
|
||||
if(isset($server_xml->control_protocol_type))$control_type = $server_xml->control_protocol_type; else $control_type = "";
|
||||
$addresses = $db->getHomeIpPorts($home_id);
|
||||
foreach($addresses as $address)
|
||||
foreach ((array)$addresses as $address)
|
||||
{
|
||||
$remote->remote_stop_server($home_id,$address['ip'],$address['port'],$server_xml->control_protocol,$home_info['control_password'],$control_type,$home_info['home_path']);
|
||||
}
|
||||
|
|
@ -412,7 +412,7 @@ if (!is_array($user_homes))
|
|||
}
|
||||
else
|
||||
{
|
||||
foreach($user_homes as $user_home)
|
||||
foreach ((array)$user_homes as $user_home)
|
||||
{
|
||||
$user_id = $user_home['user_id'];
|
||||
$home_id = $user_home['home_id'];
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ function getDocCategories($docsDir) {
|
|||
|
||||
$folders = array_diff(scandir($docsDir), ['.', '..']);
|
||||
|
||||
foreach ($folders as $folder) {
|
||||
foreach ((array)$folders as $folder) {
|
||||
$folderPath = $docsDir . '/' . $folder;
|
||||
|
||||
// Skip if not a directory
|
||||
|
|
@ -96,7 +96,7 @@ $categories = getDocCategories($docsDir);
|
|||
|
||||
// Group by category
|
||||
$grouped = [];
|
||||
foreach ($categories as $cat) {
|
||||
foreach ((array)$categories as $cat) {
|
||||
$category = $cat['category'];
|
||||
if (!isset($grouped[$category])) {
|
||||
$grouped[$category] = [];
|
||||
|
|
@ -387,20 +387,20 @@ uksort($grouped, function($a, $b) use ($categoryOrder) {
|
|||
<!-- Navigation Links -->
|
||||
<div class="nav-links">
|
||||
<h3>Jump to Section:</h3>
|
||||
<?php foreach ($grouped as $category => $docs): ?>
|
||||
<?php foreach ((array)$grouped as $category => $docs): ?>
|
||||
<a href="#<?php echo htmlspecialchars($category); ?>">
|
||||
<?php echo htmlspecialchars($categoryLabels[$category] ?? ucfirst($category)); ?>
|
||||
(<?php echo count($docs); ?>)
|
||||
(<?php echo count((array)$docs); ?>)
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<?php foreach ($grouped as $category => $docs): ?>
|
||||
<?php foreach ((array)$grouped as $category => $docs): ?>
|
||||
<div class="category-section" id="<?php echo htmlspecialchars($category); ?>">
|
||||
<h2 class="category-title"><?php echo htmlspecialchars($categoryLabels[$category] ?? ucfirst($category)); ?></h2>
|
||||
|
||||
<div class="docs-grid">
|
||||
<?php foreach ($docs as $doc): ?>
|
||||
<?php foreach ((array)$docs as $doc): ?>
|
||||
<a href="docs.php?action=view&doc=<?php echo urlencode($doc['folder']); ?>" class="doc-card">
|
||||
<div class="doc-icon-wrapper">
|
||||
<?php if (!empty($doc['icon'])): ?>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ function billing_render_markdown($markdown)
|
|||
$html = '';
|
||||
$inCode = false;
|
||||
$inList = false;
|
||||
foreach ($lines as $line) {
|
||||
foreach ((array)$lines as $line) {
|
||||
$trim = trim($line);
|
||||
if ($trim === '```') {
|
||||
if ($inCode) {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ function get_cart_count() {
|
|||
return 0;
|
||||
}
|
||||
$count = 0;
|
||||
foreach ($_SESSION['cart'] as $item) {
|
||||
foreach ((array)$_SESSION['cart'] as $item) {
|
||||
if (is_array($item) && isset($item['quantity'])) {
|
||||
$count += (int) $item['quantity'];
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ $attempted[] = $localConfig;
|
|||
|
||||
$message = "GSP Billing module cannot find config.inc.php.\n";
|
||||
$message .= "Looked in:\n";
|
||||
foreach ($attempted as $path) {
|
||||
foreach ((array)$attempted as $path) {
|
||||
if (!$path) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ function process_payment_record(array $record) {
|
|||
|
||||
$processed_count = 0;
|
||||
|
||||
foreach ($invoices_to_process as $inv) {
|
||||
foreach ((array)$invoices_to_process as $inv) {
|
||||
$invoice_id = intval($inv['invoice_id']);
|
||||
$order_id = intval($inv['order_id'] ?? 0);
|
||||
$user_id = intval($inv['user_id']);
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ function h($s){ return htmlspecialchars((string)$s, ENT_QUOTES, 'UTF-8'); }
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($records as $r): ?>
|
||||
<?php foreach ((array)$records as $r): ?>
|
||||
<tr>
|
||||
<td><?php echo h($r['invoice'] ?? ($r['custom'] ?? 'NO-ID')); ?></td>
|
||||
<td><?php echo h(($r['currency'] ?? '') . ' ' . number_format((float)($r['amount'] ?? 0),2)); ?></td>
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ usort($invoices, function($a, $b) {
|
|||
|
||||
// Organize invoices by status
|
||||
$invoices_by_status = [];
|
||||
foreach ($invoices as $inv) {
|
||||
foreach ((array)$invoices as $inv) {
|
||||
$status = strtolower($inv['status'] ?? 'pending');
|
||||
if (!isset($invoices_by_status[$status])) {
|
||||
$invoices_by_status[$status] = [];
|
||||
|
|
@ -355,11 +355,11 @@ $status_config = [
|
|||
|
||||
<!-- Invoices Section - Organized by Status -->
|
||||
<?php if (!empty($invoices_by_status)): ?>
|
||||
<?php foreach ($status_config as $status_key => $status_info): ?>
|
||||
<?php foreach ((array)$status_config as $status_key => $status_info): ?>
|
||||
<?php if (isset($invoices_by_status[$status_key]) && !empty($invoices_by_status[$status_key])): ?>
|
||||
<div class="account-section">
|
||||
<h2><?php echo htmlspecialchars($status_info['label']); ?></h2>
|
||||
<?php foreach ($invoices_by_status[$status_key] as $invoice): ?>
|
||||
<?php foreach ((array)$invoices_by_status[$status_key] as $invoice): ?>
|
||||
<div class="invoice-item">
|
||||
<div>
|
||||
<div class="invoice-id">Invoice #<?php echo htmlspecialchars($invoice['invoice'] ?? $invoice['custom'] ?? 'N/A'); ?></div>
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ function exec_ogp_module()
|
|||
echo "<th>Action</th>";
|
||||
echo "</tr></thead><tbody>";
|
||||
|
||||
foreach ($orders as $order) {
|
||||
foreach ((array)$orders as $order) {
|
||||
echo "<tr>";
|
||||
echo "<td>".$order['order_id']."</td>";
|
||||
echo "<td>".$order['home_name']."</td>";
|
||||
|
|
@ -75,11 +75,11 @@ function exec_ogp_module()
|
|||
echo "</tbody></table>";
|
||||
|
||||
// Provision all button
|
||||
if (count($orders) > 1) {
|
||||
if (count((array)$orders) > 1) {
|
||||
echo "<div style='margin-top: 20px;'>";
|
||||
echo "<form method='post' action='home.php?m=billing&p=provision_servers'>";
|
||||
echo "<input type='hidden' name='provision_all' value='1'>";
|
||||
echo "<button type='submit' class='btn btn-primary'>Provision All My Servers (".count($orders).")</button>";
|
||||
echo "<button type='submit' class='btn btn-primary'>Provision All My Servers (".count((array)$orders).")</button>";
|
||||
echo "</form>";
|
||||
echo "</div>";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ THIS IS WHAT WE DISPLAY ON THE SHOP PAGE AT THE TOP
|
|||
return;
|
||||
}
|
||||
|
||||
foreach ($services as $key => $row) {
|
||||
foreach ((array)$services as $key => $row) {
|
||||
$service_ids[$key] = $row['service_id'];
|
||||
$home_cfg_id[$key] = $row['home_cfg_id'];
|
||||
$mod_cfg_id[$key] = $row['mod_cfg_id'];
|
||||
|
|
@ -97,7 +97,7 @@ THIS IS WHAT WE DISPLAY ON THE SHOP PAGE AT THE TOP
|
|||
?>
|
||||
<div class="clearfix">
|
||||
<?php
|
||||
foreach($services as $row)
|
||||
foreach ((array)$services as $row)
|
||||
{
|
||||
if(!isset($_REQUEST['service_id']))
|
||||
{
|
||||
|
|
@ -196,11 +196,11 @@ if ($row['price_monthly'] == 0.0) {
|
|||
//get the out of stock into an array and see if the rsID is in that array
|
||||
$available_server = false;
|
||||
//loop through each of the assigned servers and see if its disabled
|
||||
foreach($rsiArray as $rsi)
|
||||
foreach ((array)$rsiArray as $rsi)
|
||||
{
|
||||
$query = "SELECT * FROM {$table_prefix}remote_servers WHERE remote_server_id = ".$rsi;
|
||||
$result = $db->query($query);
|
||||
foreach($result as $rs)
|
||||
foreach ((array)$result as $rs)
|
||||
{
|
||||
|
||||
$rsID =$rs['remote_server_id'];
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ if ($db && $user_id > 0) {
|
|||
</ul>
|
||||
</div>
|
||||
|
||||
<?php if (count($orders) > 0): ?>
|
||||
<?php if (count((array)$orders) > 0): ?>
|
||||
<h2>Your Orders</h2>
|
||||
<table class="orders-table">
|
||||
<thead>
|
||||
|
|
@ -196,7 +196,7 @@ if ($db && $user_id > 0) {
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($orders as $order): ?>
|
||||
<?php foreach ((array)$orders as $order): ?>
|
||||
<tr>
|
||||
<td>#<?php echo htmlspecialchars($order['order_id']); ?></td>
|
||||
<td><?php echo htmlspecialchars($order['home_name']); ?></td>
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ function money_fmt($value, $currency) {
|
|||
<?php
|
||||
$currency = $details['currency'] ?? ($items[0]['unit_amount']['currency_code'] ?? '');
|
||||
$grand = 0.00;
|
||||
foreach ($items as $it) {
|
||||
foreach ((array)$items as $it) {
|
||||
$name = $it['name'] ?? '';
|
||||
$sku = $it['sku'] ?? '';
|
||||
$qty = isset($it['quantity']) ? (int)$it['quantity'] : 1;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ include(__DIR__ . '/includes/menu.php');
|
|||
|
||||
<!-- Services container: clearfix to contain floated service cards so footer clears correctly -->
|
||||
<div class="clearfix container-wide">
|
||||
<?php foreach ($services as $row): ?>
|
||||
<?php foreach ((array)$services as $row): ?>
|
||||
<?php if (!isset($_REQUEST['service_id'])): ?>
|
||||
<!-- Service listing (all) -->
|
||||
<div class="float-left p-30-20">
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ while ($row = mysqli_fetch_assoc($result)) {
|
|||
}
|
||||
|
||||
$all_present = true;
|
||||
foreach ($required_columns as $col) {
|
||||
foreach ((array)$required_columns as $col) {
|
||||
if (in_array($col, $existing_columns)) {
|
||||
echo "<p class='success'>✓ Column '$col' exists</p>";
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ function exec_ogp_module()
|
|||
'admin_orders.php' => 'Admin order management'
|
||||
);
|
||||
|
||||
foreach ($pages as $file => $desc) {
|
||||
foreach ((array)$pages as $file => $desc) {
|
||||
$path = "modules/billing/".$file;
|
||||
if (file_exists($path)) {
|
||||
echo "<div class='success'>✓ $file - $desc</div>";
|
||||
|
|
@ -56,7 +56,7 @@ function exec_ogp_module()
|
|||
'billing_invoices' => 'Payment records'
|
||||
);
|
||||
|
||||
foreach ($tables as $table => $desc) {
|
||||
foreach ((array)$tables as $table => $desc) {
|
||||
$result = $db->query("SHOW TABLES LIKE 'OGP_DB_PREFIX".$table."'");
|
||||
if ($result && $db->num_rows($result) > 0) {
|
||||
echo "<div class='success'>✓ $table - $desc</div>";
|
||||
|
|
@ -72,7 +72,7 @@ function exec_ogp_module()
|
|||
if (!empty($stats)) {
|
||||
echo "<table class='tablesorter'>";
|
||||
echo "<thead><tr><th>Status</th><th>Count</th></tr></thead><tbody>";
|
||||
foreach ($stats as $stat) {
|
||||
foreach ((array)$stats as $stat) {
|
||||
echo "<tr><td>".$stat['status']."</td><td>".$stat['count']."</td></tr>";
|
||||
}
|
||||
echo "</tbody></table>";
|
||||
|
|
|
|||
|
|
@ -34,6 +34,6 @@ echo "RESPONSE:\n" . $res . "\n";
|
|||
$dataDir = realpath(__DIR__ . '/../data');
|
||||
$files = glob($dataDir . '/*.json');
|
||||
echo "Files in data/ after run: \n";
|
||||
foreach ($files as $f) echo basename($f) . "\n";
|
||||
foreach ((array)$files as $f) echo basename($f) . "\n";
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ if (isset($res['purchase_units'][0]['items']) && is_array($res['purchase_units']
|
|||
if (!$items && $type === 'PAYMENT.CAPTURE.COMPLETED') {
|
||||
$orderId = $res['supplementary_data']['related_ids']['order_id'] ?? null;
|
||||
if (!$orderId && isset($res['links']) && is_array($res['links'])) {
|
||||
foreach ($res['links'] as $lnk) {
|
||||
foreach ((array)$res['links'] as $lnk) {
|
||||
if (!empty($lnk['href']) && !empty($lnk['rel']) && stripos($lnk['href'], '/v2/checkout/orders/') !== false) {
|
||||
$orderId = basename(parse_url($lnk['href'], PHP_URL_PATH));
|
||||
break;
|
||||
|
|
@ -157,7 +157,7 @@ if (in_array($type, ['PAYMENT.CAPTURE.COMPLETED','PAYMENT.SALE.COMPLETED'], true
|
|||
}
|
||||
}
|
||||
|
||||
if (function_exists('site_log_info')) site_log_info('webhook_event',['type'=>$type,'invoice'=>($invoice ?: 'none'),'items_count'=>count($items),'status'=>$status]);
|
||||
else log_line("EVENT $type invoice=".($invoice ?: 'none')." items_count=".count($items)." status=$status");
|
||||
if (function_exists('site_log_info')) site_log_info('webhook_event',['type'=>$type,'invoice'=>($invoice ?: 'none'),'items_count'=>count((array)$items),'status'=>$status]);
|
||||
else log_line("EVENT $type invoice=".($invoice ?: 'none')." items_count=".count((array)$items)." status=$status");
|
||||
|
||||
?>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue