<?php if (!defined('DASHBOARD_ROOT')) { http_response_code(403); exit; } $metaToken = ServiceSecrets::hasService('META_ACCESS_TOKEN') ? 'Set' : 'Not Set'; $metaApp = ServiceSecrets::hasService('META_APP_ID') ? 'Set' : 'Not Set'; $metaPixel = Database::scalar("SELECT setting_value FROM settings WHERE setting_key='meta_pixel_id'") ?: ''; ?> <div id="meta-setup" class="editor-form"> <span class="section-label">Meta Ads Configuration</span> <div class="detail-grid"> <div><span class="kpi-label">Access Token</span><span><?= UI::badge($metaToken, $metaToken==='Set'?'success':'warning') ?> </span></div> <div><span class="kpi-label">App ID</span><span><?= UI::badge($metaApp, $metaApp==='Set'?'success':'warning') ?> </span></div> </div> <div class="form-group"><span>Meta Pixel ID</span><input id="setup-pixel" class="form-group input" type="text" value="<?= UI::e($metaPixel) ?> " placeholder="XXXXXXXXXXXXXXXXX"></div> <div class="form-actions"><a id="setup-save" class="btn btn-primary" href="javascript:void(0)"><span>Save Pixel</span></a></div> <div class="alert-info"><span>API keys are stored in /var/www/private/services.secret.php — update via SSH.</span></div> </div> <script nonce="<?= $cspNonce ?? '' ?> "> document.getElementById('setup-save').addEventListener('click',function(){ window.dashFetch('modify',{entity:'settings','data[meta_pixel_id]':document.getElementById('setup-pixel').value},function(r){if(r.ok){alert('Saved.');location.reload();}else{alert(r.error);}}); }); </script>