// ═══════════════════════════════════════════════════════════════════════════ // 🌐 DESKTOP & WEB ROUTER DISPATCHING (FOR NON-ACTION WEB REQUESTS) // ═══════════════════════════════════════════════════════════════════════════ if (!isset($_REQUEST['action'])) { define("APPPATH", __DIR__ . "/php/"); // Include AltoRouter if not loaded if (!class_exists('AltoRouter')) { require_once __DIR__ . '/includes/classes/AltoRouter.php'; } $router = new AltoRouter(); $bp = trim(str_replace("\\", "/", dirname($_SERVER["SCRIPT_NAME"])), "/"); $router->setBasePath($bp ? "/" . $bp : ""); // Core Web Routes $router->map('GET|POST', '/', 'home.php'); $router->map('GET|POST', '/search', 'search.php'); $router->map('GET|POST', '/home/[a:lang]?/?', 'home.php'); $router->map('GET|POST', '/login/?', 'login.php'); $router->map('GET|POST', '/signup/?', 'signup.php'); $router->map('GET|POST', '/logout/?', 'logout.php'); $router->map('GET|POST', '/dashboard/?', 'dashboard.php'); $router->map('GET|POST', '/my_ads/[*:page]?/?', 'ad-my.php'); $router->map('GET|POST', '/my_wallet/?', 'my_wallet.php'); $router->map('GET|POST', '/profile/?', 'my_profile.php'); $router->map('GET|POST', '/ad/[i:id]?/[*:slug]?/?', 'ad-detail.php'); $router->map('GET|POST', '/profile/[i:id]?/[*:slug]?/?', 'ad-user.php'); $router->map('GET|POST', '/listing_ads/?', 'listing.php'); $router->map('GET|POST', '/category/[*:cat]?/[*:subcat]?/[*:subsubcat]?/[*:subsubsubcat]?/[*:subsubsubsubcat]?/?', 'listing.php'); $router->map('GET|POST', '/category/[*:cat]?/[*:subcat]?/[*:subsubcat]?/[*:subsubsubcat]?/?', 'listing.php'); $router->map('GET|POST', '/category/[*:cat]?/[*:subcat]?/[*:subsubcat]?/?', 'listing.php'); $router->map('GET|POST', '/category/[*:cat]?/[*:subcat]?/?', 'listing.php'); $router->map('GET|POST', '/page/[*:id]?/?', 'html.php'); $match = $router->match(); if ($match && file_exists(APPPATH . $match['target'])) { $_GET = array_merge($match['params'], $_GET); require_once APPPATH . $match['target']; exit(); } else { require_once APPPATH . 'home.php'; exit(); } }