mirror of
https://github.com/myronblair/do-server-config
synced 2026-07-28 13:32:58 -05:00
[orbis] Weekly backup 2026-07-07 — 318 files changed, 48597 insertions(+), 7 deletions(-)
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Tom's Java Jive - Admin API: Customer Email History
|
||||
*/
|
||||
require_once dirname(__DIR__, 2) . '/includes/auth.php';
|
||||
AdminAuth::require();
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$customerId = trim($_GET['customer_id'] ?? '');
|
||||
if (!$customerId) {
|
||||
echo json_encode(['emails' => []]);
|
||||
exit;
|
||||
}
|
||||
|
||||
$emails = db()->fetchAll(
|
||||
"SELECT id, subject, status, opened, open_count, opened_at, tags,
|
||||
DATE_FORMAT(sent_at, '%b %e, %Y %l:%i %p') as sent_at,
|
||||
message_id, error_message
|
||||
FROM email_log
|
||||
WHERE customer_id = :cid
|
||||
ORDER BY sent_at DESC
|
||||
LIMIT 50",
|
||||
['cid' => $customerId]
|
||||
);
|
||||
|
||||
echo json_encode(['emails' => $emails]);
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../../includes/auth.php';
|
||||
header('Content-Type: application/json');
|
||||
if (!AdminAuth::isLoggedIn()) { echo json_encode(['error'=>'Unauthorized']); exit; }
|
||||
$cid = trim($_GET['customer_id'] ?? '');
|
||||
if (!$cid) { echo json_encode(['error'=>'No customer ID','orders'=>[]]); exit; }
|
||||
try {
|
||||
$orders = db()->fetchAll(
|
||||
"SELECT order_id, order_number, total, order_status, payment_status, items, shipping_address, tracking_number, created_at FROM orders WHERE customer_id = :id ORDER BY created_at DESC",
|
||||
['id' => $cid]
|
||||
);
|
||||
echo json_encode(['success'=>true,'orders'=>$orders]);
|
||||
} catch (Exception $e) {
|
||||
echo json_encode(['error'=>$e->getMessage(),'orders'=>[]]);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../../includes/auth.php';
|
||||
header('Content-Type: application/json');
|
||||
|
||||
if (!AdminAuth::getUser()) {
|
||||
http_response_code(401);
|
||||
echo json_encode(['error' => 'Unauthorized']);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
||||
echo json_encode(['error' => 'No file received']); exit;
|
||||
}
|
||||
|
||||
$result = handleImageUpload('image', __DIR__ . '/../../uploads/splashes/', 'splash_');
|
||||
|
||||
if (isset($result['success'])) {
|
||||
echo json_encode(['success' => true, 'url' => '/uploads/splashes/' . $result['filename']]);
|
||||
} else {
|
||||
echo json_encode(['error' => $result['error']]);
|
||||
}
|
||||
Reference in New Issue
Block a user