13 Commits

2733 changed files with 5781 additions and 148310 deletions

1
public/Api.html Symbolic link
View File

@@ -0,0 +1 @@
Api.php

View File

@@ -3,7 +3,7 @@
## RÈGLES
- php -l avant deploy, cp backup, chown www-data, chmod 644
- DB: localhost adx_system admin/admin123 schema admin
- DB: localhost adx_system admin/REDACTED_PASS schema admin
- APIs dans /opt/wevads-arsenal/public/api/
---

1
public/Offers.html Symbolic link
View File

@@ -0,0 +1 @@
Offers.php

1
public/ab-testing.html Symbolic link
View File

@@ -0,0 +1 @@
ab-testing.php

View File

@@ -1,11 +1,12 @@
<?php
require_once("/opt/wevads/config/credentials.php");
/**
* A/B TESTING ENGINE
* Multi-variant testing with auto-winner
*/
header('Content-Type: application/json');
$pdo = new PDO("pgsql:host=localhost;dbname=adx_system", "admin", "admin123", [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
$pdo = get_pdo("adx_system");
$pdo->exec("
CREATE TABLE IF NOT EXISTS admin.ab_tests (

View File

@@ -1,6 +1,7 @@
<?php include_once("/opt/wevads-arsenal/public/api/wevads-metrics.php"); ?>
<?php
@$_db=new PDO("pgsql:host=localhost;dbname=adx_system","admin","admin123");
require_once("/opt/wevads/config/credentials.php"); include_once("/opt/wevads-arsenal/public/api/wevads-metrics.php"); ?>
<?php
@$_db=get_pdo("adx_system");
$_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
$_db->exec("SET search_path TO admin");
$_db->exec("SET statement_timeout = 8000");

View File

@@ -0,0 +1 @@
account-factory-ia.php

1
public/account-factory.html Symbolic link
View File

@@ -0,0 +1 @@
account-factory.php

1
public/account-forge.html Symbolic link
View File

@@ -0,0 +1 @@
account-forge.php

View File

@@ -1,9 +1,10 @@
<?php
require_once("/opt/wevads/config/credentials.php");
$page_title = "Global Account Forge";
$page_icon = "fas fa-hammer";
// Connexion DB adx_system
$db = pg_connect("host=localhost dbname=adx_system user=admin password=admin123");
$db = pg_connect("host=localhost dbname=adx_system user=admin password=" . WEVADS_DB_PASS);
if (!$db) die("DB connection failed");
if (isset($_GET['action']) && $_GET['action'] == 'forge') {

1
public/accounts.html Symbolic link
View File

@@ -0,0 +1 @@
accounts.php

View File

@@ -1,5 +1,6 @@
<?php
require_once("/opt/wevads/config/credentials.php");
header('Content-Type: application/json');
error_reporting(E_ALL);
ini_set('display_errors', 0);
@@ -7,7 +8,7 @@ ini_set('display_errors', 0);
// Database connection (if needed)
$db = null;
try {
$db = pg_connect("host=localhost dbname=adx_system user=admin password=admin123");
$db = pg_connect("host=localhost dbname=adx_system user=admin password=" . WEVADS_DB_PASS);
if ($db) {
pg_query($db, "SET search_path TO admin, public");
}

View File

@@ -0,0 +1 @@
admin-permissions.php

View File

@@ -1,5 +1,6 @@
<?php
$pdo=new PDO("pgsql:host=localhost;dbname=adx_system","admin","admin123");
require_once("/opt/wevads/config/credentials.php");
$pdo=get_pdo("adx_system");
$pdo->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
$pdo->exec("DROP TABLE IF EXISTS wevads_permissions CASCADE");
$pdo->exec("DROP TABLE IF EXISTS wevads_users CASCADE");

View File

@@ -0,0 +1 @@
ads-commander-api.php

View File

@@ -131,6 +131,5 @@ function rA(){fetch('/api/ads-platform.php?action=arbitrage').then(r=>r.json()).
function lD(){location.reload()}
function cC2(){var n=prompt('Campaign name?');if(n)fetch('/api/ads-platform.php?action=create_campaign',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({name:n})}).then(r=>r.json()).then(d=>{alert('Created: '+(d.campaign_id||d.status));location.reload()}).catch(()=>alert('Queued'))}
</script>
<script src="arsenal-common.js?v1770778169">
<?php include("/opt/wevads-arsenal/public/universal-drill.html"); ?>
<\/body><\/html></script>
</body>
</html>

View File

@@ -1,8 +1,9 @@
<?php require_once("/opt/wevads/config/credentials.php"); ?>
<?php
// WEVADS YouTube Factory + Ads Commander Config
if (!defined('WV_DB_DSN')) define('WV_DB_DSN', 'pgsql:host=localhost;dbname=adx_system');
if (!defined('WV_DB_USER')) define('WV_DB_USER', 'admin');
if (!defined('WV_DB_PASS')) define('WV_DB_PASS', 'admin123');
if (!defined('WV_DB_PASS')) define('WV_DB_PASS', WEVADS_DB_PASS);
if (!defined('HAMID_API')) define('HAMID_API', 'http://127.0.0.1:5890/api/hamid/generate');
if (!defined('OLLAMA_API')) define('OLLAMA_API', 'http://127.0.0.1:11434/api/generate');
if (!defined('YT_OUTPUT')) define('YT_OUTPUT', '/opt/wevads/youtube-factory/output/');

View File

@@ -1,8 +1,9 @@
<?php require_once("/opt/wevads/config/credentials.php"); ?>
<?php
define("ADS_DB_HOST","localhost");
define("ADS_DB_NAME","adx_system");
define("ADS_DB_USER","admin");
define("ADS_DB_PASS","admin123");
define("ADS_DB_PASS",WEVADS_DB_PASS);
define("ADS_LOGS","/opt/wevads-arsenal/public/ads-commander/logs/");
define("META_API","https://graph.facebook.com/v18.0/");
define("TIKTOK_API","https://business-api.tiktok.com/open_api/v1.3/");

1
public/ads-platform.html Symbolic link
View File

@@ -0,0 +1 @@
ads-platform.php

View File

@@ -1,7 +1,8 @@
<?php
require_once("/opt/wevads/config/credentials.php");
header('Content-Type: application/json');
// CORS locked by WAF shield
$db = pg_connect("host=localhost dbname=adx_system user=admin password=admin123") or die(json_encode(['error'=>'DB']));
$db = pg_connect("host=localhost dbname=adx_system user=admin password=" . WEVADS_DB_PASS) or die(json_encode(['error'=>'DB']));
pg_query($db, "SET search_path TO admin,public");
$action = $_GET['action'] ?? $_POST['action'] ?? 'dashboard';
$platform = $_GET['platform'] ?? $_POST['platform'] ?? '';

View File

@@ -0,0 +1 @@
advanced-capabilities.php

View File

@@ -1,5 +1,6 @@
<?php include_once("/opt/wevads-arsenal/public/api/wevads-metrics.php"); ?>
<?php @$_db=new PDO("pgsql:host=localhost;dbname=adx_system","admin","admin123");$_db->exec("SET search_path TO admin");$_acf_t=(int)$_db->query("SELECT COUNT(*) FROM scrapping_results")->fetchColumn();$_acf_a=(int)$_db->query("SELECT COUNT(*) FROM dark_scraper_jobs WHERE status='running'")->fetchColumn();$_acf_v=(int)$_db->query("SELECT COUNT(*) FROM scrapping_results WHERE is_verified=true")->fetchColumn();$_acf_r=$_acf_t>0?round($_acf_v/$_acf_t*100,1):0;$_acf_td=(int)$_db->query("SELECT COUNT(*) FROM scrapping_results WHERE extracted_at::date=CURRENT_DATE")->fetchColumn();?>
<?php
require_once("/opt/wevads/config/credentials.php"); include_once("/opt/wevads-arsenal/public/api/wevads-metrics.php"); ?>
<?php @$_db=get_pdo("adx_system");$_db->exec("SET search_path TO admin");$_acf_t=(int)$_db->query("SELECT COUNT(*) FROM scrapping_results")->fetchColumn();$_acf_a=(int)$_db->query("SELECT COUNT(*) FROM dark_scraper_jobs WHERE status='running'")->fetchColumn();$_acf_v=(int)$_db->query("SELECT COUNT(*) FROM scrapping_results WHERE is_verified=true")->fetchColumn();$_acf_r=$_acf_t>0?round($_acf_v/$_acf_t*100,1):0;$_acf_td=(int)$_db->query("SELECT COUNT(*) FROM scrapping_results WHERE extracted_at::date=CURRENT_DATE")->fetchColumn();?>
<!DOCTYPE html><html lang="en"><head>
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>WEVADS - Advanced Craping Factory — Arsenal</title>

View File

@@ -0,0 +1 @@
advanced-craping.php

View File

@@ -0,0 +1 @@
advanced-dashboard-live.php

View File

@@ -0,0 +1 @@
advanced-scraping.php

View File

@@ -102,7 +102,6 @@ async function loadHistory(){
}
}
init();
</script><script src="arsenal-common.js?v1770778169">
<?php include("/opt/wevads-arsenal/public/universal-drill.html"); ?>
<\/body><\/html>
</script>
</body>
</html>

View File

@@ -1,7 +1,8 @@
<?php
require_once("/opt/wevads/config/credentials.php");
header("Content-Type: application/json");
// CORS locked by WAF shield
$db = new PDO('pgsql:host=localhost;dbname=adx_system', 'admin', 'admin123');
$db = get_pdo("adx_system");
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$action = $_GET["action"] ?? $_POST["action"] ?? "status";

1
public/adx-send-bridge.html Symbolic link
View File

@@ -0,0 +1 @@
adx-send-bridge.php

1
public/adx-tag-engine.html Symbolic link
View File

@@ -0,0 +1 @@
adx-tag-engine.php

View File

@@ -0,0 +1 @@
affiliate-hamid-check.php

View File

@@ -178,8 +178,5 @@ async function loadAll() {
loadAll();
setInterval(loadAll, 60000);
</script>
<script src="arsenal-common.js?v1770778169">
<?php include("/opt/wevads-arsenal/public/universal-drill.html"); ?>
<\/body>
<\/html>
</script>
</body>
</html>

1
public/ai-bridge.html Symbolic link
View File

@@ -0,0 +1 @@
ai-bridge.php

View File

@@ -1,4 +1,5 @@
<?php
require_once("/opt/wevads/config/credentials.php");
/**
* Universal Factory API — Smart schema-aware stats/list/health
* Each factory .php symlinks or includes this with correct table mapping
@@ -7,7 +8,7 @@ header('Content-Type: application/json');
header('Access-Control-Allow-Origin: https://weval-consulting.com');
try {
$pdo = new PDO('pgsql:host=localhost;dbname=adx_system', 'admin', 'admin123');
$pdo = get_pdo("adx_system");
$pdo->exec('SET search_path TO admin, public');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db_ok = true;

View File

@@ -0,0 +1 @@
ai-discovery-api.php

View File

@@ -1,5 +1,6 @@
<?php
require_once("/opt/wevads/config/credentials.php");
/**
* AI DISCOVERY API - Auto-discover and integrate new AI providers
* Corrigé pour éviter les erreurs SQL
@@ -8,7 +9,7 @@ header('Content-Type: application/json');
error_reporting(0);
try {
$db = new PDO("pgsql:host=127.0.0.1;dbname=adx_system", "admin", "admin123");
$db = get_pdo("adx_system");
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (Exception $e) {
echo json_encode(['error' => 'DB connection failed']);

1
public/ai-failsafe.html Symbolic link
View File

@@ -0,0 +1 @@
ai-failsafe.php

View File

@@ -1,7 +1,8 @@
<?php
require_once("/opt/wevads/config/credentials.php");
header('Content-Type: application/json');
$pdo = new PDO("pgsql:host=localhost;dbname=adx_system", "admin", "admin123", [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
$pdo = get_pdo("adx_system");
$action = $_GET['action'] ?? $_POST['action'] ?? '';

1
public/ai-rotation.html Symbolic link
View File

@@ -0,0 +1 @@
ai-rotation.php

View File

@@ -1,11 +1,12 @@
<?php
require_once("/opt/wevads/config/credentials.php");
/**
* AI PROVIDER ROTATION ENGINE
* Smart failover + load balancing across 11 providers
*/
header('Content-Type: application/json');
$pdo = new PDO("pgsql:host=localhost;dbname=adx_system", "admin", "admin123", [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
$pdo = get_pdo("adx_system");
$pdo->exec("
CREATE TABLE IF NOT EXISTS admin.ai_providers (
@@ -52,7 +53,7 @@ class AIRotation {
'Claude' => ['url' => 'https://api.anthropic.com/v1/messages', 'model' => 'claude-3-haiku-20240307', 'limit' => 500],
'Cohere' => ['url' => 'https://api.cohere.ai/v1/chat', 'model' => 'command-r-plus', 'limit' => 1000],
'OpenAI' => ['url' => 'https://api.openai.com/v1/chat/completions', 'model' => 'gpt-4o-mini', 'limit' => 500],
'Ollama' => ['url' => 'http://localhost:11434/api/chat', 'model' => 'llama3', 'limit' => 99999]
'Ollama' => ['url' => 'http://10.1.0.2:11435/api/chat', 'model' => 'llama3', 'limit' => 99999]
];
public function __construct($pdo) {

1
public/alert-system.html Symbolic link
View File

@@ -0,0 +1 @@
alert-system.php

View File

@@ -1,4 +1,5 @@
<?php
require_once("/opt/wevads/config/credentials.php");
/**
* WEVAL SEND ALERT SYSTEM
* Notifications via Email & Telegram
@@ -9,7 +10,7 @@ ini_set('display_errors', 0);
function getDb() {
static $pdo = null;
if ($pdo === null) {
$pdo = new PDO('pgsql:host=localhost;dbname=adx_system', 'admin', 'admin123');
$pdo = get_pdo("adx_system");
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
return $pdo;

1
public/all-screens.html Symbolic link
View File

@@ -0,0 +1 @@
all-screens.php

1
public/analyse-brain.html Symbolic link
View File

@@ -0,0 +1 @@
analyse-brain.php

View File

@@ -0,0 +1 @@
analysis-manager.php

View File

@@ -1,5 +1,6 @@
<?php
$pdo = new PDO('pgsql:host=localhost;dbname=adx_system', 'admin', 'admin123');
require_once("/opt/wevads/config/credentials.php");
$pdo = get_pdo("adx_system");
?>
<!DOCTYPE html>
<html><head>

1
public/analytics.html Symbolic link
View File

@@ -0,0 +1 @@
analytics.php

View File

@@ -1,11 +1,12 @@
<?php
require_once("/opt/wevads/config/credentials.php");
error_reporting(E_ALL);
ini_set('display_errors', 0);
function getDb() {
static $pdo = null;
if ($pdo === null) {
$pdo = new PDO('pgsql:host=localhost;dbname=adx_system', 'admin', 'admin123');
$pdo = get_pdo("adx_system");
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
return $pdo;

1
public/api-bridge.html Symbolic link
View File

@@ -0,0 +1 @@
api-bridge.php

View File

@@ -1,4 +1,5 @@
<?php
require_once("/opt/wevads/config/credentials.php");
/**
* WEVADS iResponse API Bridge
* Translates legacy iResponse Tracking API calls (procceedTracking, getAdxRtl, checkEmail)
@@ -23,7 +24,7 @@ if ($controller !== 'Tracking') {
}
$db = @pg_connect("host=/var/run/postgresql dbname=adx_system user=admin password=admin123");
if (!$db) $db = @pg_connect("host=127.0.0.1 dbname=adx_system user=admin password=admin123");
if (!$db) $db = @pg_connect("host=localhost dbname=adx_system user=admin password=" . WEVADS_DB_PASS);
if (!$db) {
echo json_encode(['status' => 500, 'message' => 'DB connection failed', 'data' => []]);
exit;

1
public/api-config.html Symbolic link
View File

@@ -0,0 +1 @@
api-config.php

View File

@@ -1,10 +1,11 @@
<?php
require_once("/opt/wevads/config/credentials.php");
/**
* API KEYS CONFIGURATION CENTER
* Configure all external API keys in one place
*/
session_start();
$pdo = new PDO("pgsql:host=localhost;dbname=adx_system", "admin", "admin123", [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
$pdo = get_pdo("adx_system");
// Create config table
$pdo->exec("

View File

@@ -0,0 +1 @@
api-gateway-light.php

1
public/api-gateway.html Symbolic link
View File

@@ -0,0 +1 @@
api-gateway.php

View File

@@ -289,8 +289,5 @@ async function testAllKeys(name){
loadAll();
</script>
<script src="arsenal-common.js?v1770778169">
<?php include("/opt/wevads-arsenal/public/universal-drill.html"); ?>
<\/body>
<\/html>
</script>
</body>
</html>

1
public/api-keys.html Symbolic link
View File

@@ -0,0 +1 @@
api-keys.php

View File

@@ -1,6 +1,7 @@
<?php
require_once("/opt/wevads/config/credentials.php");
session_start();
$pdo = new PDO("pgsql:host=localhost;dbname=adx_system", "admin", "admin123");
$pdo = get_pdo("adx_system");
$msg = '';
if ($_POST['action'] ?? '' === 'save') {

View File

@@ -0,0 +1 @@
api-security-check.php

0
public/api/"blacklist"] Normal file
View File

0
public/api/"metrics"] Normal file
View File

0
public/api/35?36:ROW_ADD Normal file
View File

0
public/api/70?30:cnt Normal file
View File

1
public/api/ab-testing.html Symbolic link
View File

@@ -0,0 +1 @@
ab-testing.php

View File

@@ -1,11 +1,12 @@
<?php
require_once("/opt/wevads/config/credentials.php");
/**
* A/B TESTING ENGINE
* Multi-variant testing with auto-winner
*/
header('Content-Type: application/json');
$pdo = new PDO("pgsql:host=localhost;dbname=adx_system", "admin", "admin123", [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
$pdo = get_pdo("adx_system");
$pdo->exec("
CREATE TABLE IF NOT EXISTS admin.ab_tests (

View File

@@ -0,0 +1 @@
account-creator-simple.php

View File

@@ -0,0 +1 @@
account-creator.php

View File

@@ -0,0 +1 @@
account-factory-ia.php

View File

@@ -0,0 +1 @@
account-factory.php

1
public/api/accounts.html Symbolic link
View File

@@ -0,0 +1 @@
accounts.php

View File

@@ -1,5 +1,6 @@
<?php
require_once("/opt/wevads/config/credentials.php");
header('Content-Type: application/json');
error_reporting(E_ALL);
ini_set('display_errors', 0);
@@ -7,7 +8,7 @@ ini_set('display_errors', 0);
// Database connection (if needed)
$db = null;
try {
$db = pg_connect("host=localhost dbname=adx_system user=admin password=admin123");
$db = pg_connect("host=localhost dbname=adx_system user=admin password=" . WEVADS_DB_PASS);
if ($db) {
pg_query($db, "SET search_path TO admin, public");
}

1
public/api/ads-api.html Symbolic link
View File

@@ -0,0 +1 @@
ads-api.php

View File

@@ -0,0 +1 @@
ads-commander-api.php

View File

@@ -0,0 +1 @@
ads-platform.php

View File

@@ -1,7 +1,8 @@
<?php
require_once("/opt/wevads/config/credentials.php");
header('Content-Type: application/json');
// CORS locked by WAF shield
$db = pg_connect("host=localhost dbname=adx_system user=admin password=admin123") or die(json_encode(['error'=>'DB']));
$db = pg_connect("host=localhost dbname=adx_system user=admin password=" . WEVADS_DB_PASS) or die(json_encode(['error'=>'DB']));
pg_query($db, "SET search_path TO admin,public");
$action = $_GET['action'] ?? $_POST['action'] ?? 'dashboard';
$platform = $_GET['platform'] ?? $_POST['platform'] ?? '';

View File

@@ -0,0 +1 @@
advanced-capabilities.php

View File

@@ -0,0 +1 @@
advanced-craping.php

View File

@@ -0,0 +1 @@
advanced-scraping.php

View File

@@ -1,4 +1,5 @@
<?php
require_once("/opt/wevads/config/credentials.php");
/**
* Advanced Scraping Factory — API Backend v2
* Uses existing tables: dark_scraper_jobs + scrapping_results
@@ -10,7 +11,7 @@ header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
header('Access-Control-Allow-Headers: Content-Type');
if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') { http_response_code(200); exit; }
$db = new PDO('pgsql:host=localhost;dbname=adx_system','admin','admin123');
$db = get_pdo("adx_system");
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->exec('SET search_path TO admin, public');

View File

@@ -0,0 +1 @@
adversarial-sandbox.php

View File

@@ -1,7 +1,8 @@
<?php
require_once("/opt/wevads/config/credentials.php");
header("Content-Type: application/json");
// CORS locked by WAF shield
$db = new PDO('pgsql:host=localhost;dbname=adx_system', 'admin', 'admin123');
$db = get_pdo("adx_system");
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$action = $_GET["action"] ?? $_POST["action"] ?? "status";

View File

@@ -0,0 +1 @@
adx-send-bridge.php

View File

@@ -0,0 +1 @@
adx-tag-engine.php

View File

@@ -0,0 +1 @@
affiliate-hamid-check.php

View File

@@ -0,0 +1 @@
affiliate-monitor.php

1
public/api/ai-bridge.html Symbolic link
View File

@@ -0,0 +1 @@
ai-bridge.php

View File

@@ -0,0 +1 @@
ai-copywriter-simple.php

View File

@@ -0,0 +1 @@
ai-copywriter.php

View File

@@ -1,4 +1,5 @@
<?php
require_once("/opt/wevads/config/credentials.php");
/**
* Universal Factory API — Smart schema-aware stats/list/health
* Each factory .php symlinks or includes this with correct table mapping
@@ -7,7 +8,7 @@ header('Content-Type: application/json');
// CORS locked by WAF shield
try {
$pdo = new PDO('pgsql:host=localhost;dbname=adx_system', 'admin', 'admin123');
$pdo = get_pdo("adx_system");
$pdo->exec('SET search_path TO admin, public');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db_ok = true;

View File

@@ -1,128 +0,0 @@
<?php
header('Content-Type: application/json');
header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
header('Access-Control-Allow-Headers: Content-Type');
if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') { http_response_code(200); exit; }
require_once('/opt/wevads/hamid-providers-config.php');
$pdo = new PDO('pgsql:host=localhost;dbname=adx_system','admin','admin123');
$pdo->exec('SET search_path TO admin,affiliate,public');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$input = json_decode(file_get_contents('php://input'), true) ?: $_REQUEST;
$action = $_GET['action'] ?? $input['action'] ?? 'status';
switch($action) {
case 'generate':
$type = $input['type'] ?? 'subject_body';
$niche = $input['niche'] ?? 'E-commerce';
$lang = $input['lang'] ?? 'Français';
$tone = $input['tone'] ?? 'Professionnel';
$offer_desc = $input['offer_desc'] ?? '';
$variants = (int)($input['variants'] ?? 3);
$offer_id = $input['offer_id'] ?? null;
// If offer_id provided, load real offer data
$offer_context = '';
if ($offer_id) {
$stmt = $pdo->prepare("SELECT name, description, payout, countries FROM affiliate.offers WHERE id=?");
$stmt->execute([$offer_id]);
$offer = $stmt->fetch(PDO::FETCH_ASSOC);
if ($offer) {
$offer_context = "Offer: {$offer['name']}, Payout: {$offer['payout']}, Countries: {$offer['countries']}, Description: " . substr($offer['description'] ?? '',0,200);
}
}
$prompt = "Tu es un expert copywriter email marketing. Génère exactement {$variants} variantes d'email pour une campagne.
TYPE: {$type}
LANGUE: {$lang}
TON: {$tone}
NICHE: {$niche}
OFFRE: {$offer_desc} {$offer_context}
RÈGLES IMPORTANTES:
- Chaque variante doit avoir un subject (sujet) et body (corps HTML)
- Utilise les variables {{prenom}}, {{nom}}, {{ville}} pour personnaliser
- Sujets courts, percutants, avec emoji
- Corps concis mais persuasif, max 150 mots
- Inclure un CTA clair avec {{tracking_link}}
- Score chaque variante de 1-100 sur son potentiel d'ouverture/clic
RÉPONDS UNIQUEMENT en JSON valide avec cette structure:
{\"variants\": [{\"label\": \"A\", \"subject\": \"...\", \"body\": \"...\", \"score\": 85}, ...]}";
$result = callWithFailover($prompt, $input['provider'] ?? null);
if (isset($result['error'])) {
echo json_encode(['status'=>'error','error'=>$result['error']]);
exit;
}
// Parse JSON from response
$raw = $result['response'] ?? '';
// Extract JSON from potential markdown
if (preg_match('/\{[\s\S]*"variants"[\s\S]*\}/m', $raw, $m)) {
$parsed = json_decode($m[0], true);
} else {
$parsed = json_decode($raw, true);
}
if ($parsed && isset($parsed['variants'])) {
// Save to creative_templates
foreach ($parsed['variants'] as $v) {
try {
$stmt2 = $pdo->prepare("INSERT INTO admin.creative_templates (vertical, template_name, subject_patterns, from_name_patterns, html_body_template, keywords, avg_open_rate, times_used) VALUES (?,?,?,?,?,?,?,0)");
$stmt2->execute([
$niche,
$v['label'] . ' - ' . substr($v['subject'],0,50),
'{' . json_encode($v['subject']) . '}',
'{"WEVAL"}',
$v['body'],
'{}',
($v['score'] ?? 75) / 100.0 * 50
]);
} catch(Exception $e) {}
}
echo json_encode([
'status'=>'success',
'variants'=>$parsed['variants'],
'provider'=>$result['provider'] ?? 'unknown',
'model'=>$result['model'] ?? '',
'latency'=>$result['latency'] ?? 0,
'saved'=>true
]);
} else {
echo json_encode([
'status'=>'success',
'raw_response'=>$raw,
'provider'=>$result['provider'] ?? 'unknown',
'parse_error'=>'Could not parse JSON variants'
]);
}
break;
case 'offers':
// Return CX3 offers for dropdown
$rows = $pdo->query("SELECT id, name, payout, countries FROM affiliate.offers WHERE status='Activated' ORDER BY name LIMIT 50")->fetchAll(PDO::FETCH_ASSOC);
echo json_encode(['status'=>'success','offers'=>$rows]);
break;
case 'templates':
$rows = $pdo->query("SELECT * FROM admin.creative_templates ORDER BY id DESC LIMIT 30")->fetchAll(PDO::FETCH_ASSOC);
echo json_encode(['status'=>'success','templates'=>$rows,'count'=>count($rows)]);
break;
case 'stats':
$total = (int)$pdo->query("SELECT COUNT(*) FROM admin.creative_templates")->fetchColumn();
$verticals = $pdo->query("SELECT vertical, count(*) as c FROM admin.creative_templates GROUP BY vertical ORDER BY c DESC")->fetchAll(PDO::FETCH_ASSOC);
echo json_encode(['status'=>'success','data'=>['total_templates'=>$total,'verticals'=>$verticals,'offers_available'=>(int)$pdo->query("SELECT COUNT(*) FROM affiliate.offers WHERE status='Activated'")->fetchColumn()]]);
break;
default:
$total = (int)$pdo->query("SELECT COUNT(*) FROM admin.creative_templates")->fetchColumn();
$offers = (int)$pdo->query("SELECT COUNT(*) FROM affiliate.offers WHERE status='Activated'")->fetchColumn();
echo json_encode(['service'=>'ai-copywriter','label'=>'AI Copywriter','hamid_connected'=>true,'templates'=>$total,'offers_available'=>$offers,'actions'=>['generate','offers','templates','stats'],'timestamp'=>date('c')]);
}

View File

@@ -0,0 +1 @@
ai-discovery-api.php

View File

@@ -1,5 +1,6 @@
<?php
require_once("/opt/wevads/config/credentials.php");
/**
* AI DISCOVERY API - Auto-discover and integrate new AI providers
* Corrigé pour éviter les erreurs SQL
@@ -8,7 +9,7 @@ header('Content-Type: application/json');
error_reporting(0);
try {
$db = new PDO("pgsql:host=127.0.0.1;dbname=adx_system", "admin", "admin123");
$db = get_pdo("adx_system");
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (Exception $e) {
echo json_encode(['error' => 'DB connection failed']);

1
public/api/ai-failsafe.html Symbolic link
View File

@@ -0,0 +1 @@
ai-failsafe.php

View File

@@ -1,7 +1,8 @@
<?php
require_once("/opt/wevads/config/credentials.php");
header('Content-Type: application/json');
$pdo = new PDO("pgsql:host=localhost;dbname=adx_system", "admin", "admin123", [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
$pdo = get_pdo("adx_system");
$action = $_GET['action'] ?? $_POST['action'] ?? '';

1
public/api/ai-rotation.html Symbolic link
View File

@@ -0,0 +1 @@
ai-rotation.php

View File

@@ -1,11 +1,12 @@
<?php
require_once("/opt/wevads/config/credentials.php");
/**
* AI PROVIDER ROTATION ENGINE
* Smart failover + load balancing across 11 providers
*/
header('Content-Type: application/json');
$pdo = new PDO("pgsql:host=localhost;dbname=adx_system", "admin", "admin123", [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
$pdo = get_pdo("adx_system");
$pdo->exec("
CREATE TABLE IF NOT EXISTS admin.ai_providers (
@@ -52,7 +53,7 @@ class AIRotation {
'Claude' => ['url' => 'https://api.anthropic.com/v1/messages', 'model' => 'claude-3-haiku-20240307', 'limit' => 500],
'Cohere' => ['url' => 'https://api.cohere.ai/v1/chat', 'model' => 'command-r-plus', 'limit' => 1000],
'OpenAI' => ['url' => 'https://api.openai.com/v1/chat/completions', 'model' => 'gpt-4o-mini', 'limit' => 500],
'Ollama' => ['url' => 'http://localhost:11434/api/chat', 'model' => 'llama3', 'limit' => 99999]
'Ollama' => ['url' => 'http://10.1.0.2:11435/api/chat', 'model' => 'llama3', 'limit' => 99999]
];
public function __construct($pdo) {

1
public/api/analytics.html Symbolic link
View File

@@ -0,0 +1 @@
analytics.php

View File

@@ -1,11 +1,12 @@
<?php
require_once("/opt/wevads/config/credentials.php");
error_reporting(E_ALL);
ini_set('display_errors', 0);
function getDb() {
static $pdo = null;
if ($pdo === null) {
$pdo = new PDO('pgsql:host=localhost;dbname=adx_system', 'admin', 'admin123');
$pdo = get_pdo("adx_system");
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
return $pdo;

Submodule public/api/antigravity-awesome-skills added at 1a3d92b6f8

View File

@@ -0,0 +1 @@
api-gateway-light.php

1
public/api/api-gateway.html Symbolic link
View File

@@ -0,0 +1 @@
api-gateway.php

1
public/api/aqualink.html Symbolic link
View File

@@ -0,0 +1 @@
aqualink.php

Some files were not shown because too many files have changed in this diff Show More