feat: Add complete Docker deployment with web-based setup wizard
Major additions: - Web-based setup wizard (setup.php, setup_wizard.php, setup-wizard.js) - Production Docker configuration (docker-compose.prod.yml, .env.production) - Database initialization SQL files (deploy/init_settings.sql) - Template builder system with drag-and-drop UI - Advanced features (OAuth, CDN, enhanced analytics, monetization) - Comprehensive documentation (deployment guides, quick start, feature docs) - Design system with accessibility and responsive layout - Deployment automation scripts (deploy.ps1, generate-secrets.ps1) Setup wizard allows customization of: - Platform name and branding - Domain configuration - Membership tiers and pricing - Admin credentials - Feature toggles Database includes 270+ tables for complete video streaming platform with advanced features for analytics, moderation, template building, and monetization. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
122
parser.php
122
parser.php
@@ -16,9 +16,73 @@ if (!defined('_INCLUDE')) {
|
||||
define('_INCLUDE', true);
|
||||
}
|
||||
|
||||
// Note: _ISVALID may be defined by included modules, so we conditionally define it
|
||||
if (!defined('_ISVALID')) {
|
||||
define('_ISVALID', true);
|
||||
}
|
||||
|
||||
// Guard to prevent parser logic from running multiple times
|
||||
if (defined('_PARSER_EXECUTED')) {
|
||||
return;
|
||||
}
|
||||
define('_PARSER_EXECUTED', true);
|
||||
|
||||
// Comprehensive error logging
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', '0');
|
||||
ini_set('log_errors', '1');
|
||||
|
||||
// Custom error handler to log all errors
|
||||
set_error_handler(function($errno, $errstr, $errfile, $errline) {
|
||||
error_log("PHP ERROR [$errno]: $errstr in $errfile:$errline");
|
||||
return false; // Let PHP handle it normally
|
||||
}, E_ALL);
|
||||
|
||||
// Catch fatal errors at shutdown
|
||||
register_shutdown_function(function() {
|
||||
$error = error_get_last();
|
||||
if ($error !== null && in_array($error['type'], [E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR])) {
|
||||
error_log("FATAL ERROR: [" . $error['type'] . "] " . $error['message'] . " in " . $error['file'] . ":" . $error['line']);
|
||||
}
|
||||
});
|
||||
|
||||
// Check if setup is needed
|
||||
if (!file_exists('.setup_complete') && !strpos($_SERVER['REQUEST_URI'], 'setup.php')) {
|
||||
// First-time setup required - redirect to setup wizard
|
||||
header('Location: /setup.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
require 'f_core/config.backend.php';
|
||||
require 'f_core/config.href.php';
|
||||
|
||||
// Define helper functions BEFORE they are called to avoid "undefined function" errors
|
||||
if (!function_exists('hrefCheck')) {
|
||||
function hrefCheck($c)
|
||||
{
|
||||
$section = explode('/', $c);return $section[0];
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('keyCheck')) {
|
||||
function keyCheck($k, $a)
|
||||
{
|
||||
foreach ($k as $v) {
|
||||
if ($v == '@') {
|
||||
$v = 'channel';
|
||||
}
|
||||
if (in_array($v, $a)) {
|
||||
return $v;
|
||||
}
|
||||
}
|
||||
// Return empty string for root URL (home page)
|
||||
if (empty($k) || (count($k) == 1 && $k[0] === '')) {
|
||||
return '';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
$query_string = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : null;
|
||||
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : null;
|
||||
$request_uri = $query_string != null ? substr($request_uri, 0, strpos($request_uri, '?')) : $request_uri;
|
||||
@@ -43,10 +107,11 @@ if (isset($section_array[0]) && $section_array[0] === $backend_access_url) {
|
||||
|
||||
$sections = array(
|
||||
$backend_access_url => 'f_modules/m_backend/parser',
|
||||
$href["index"] => 'index',
|
||||
$href["index"] => 'f_modules/m_frontend/index',
|
||||
$href["error"] => 'error',
|
||||
$href["renew"] => 'f_modules/m_frontend/m_auth/renew',
|
||||
$href["signup"] => 'f_modules/m_frontend/m_auth/signup',
|
||||
$href["register"] => 'f_modules/m_frontend/m_auth/signup',
|
||||
$href["signin"] => 'f_modules/m_frontend/m_auth/signin',
|
||||
$href["signout"] => 'f_modules/m_frontend/m_auth/signout',
|
||||
$href["service"] => 'f_modules/m_frontend/m_auth/recovery',
|
||||
@@ -54,6 +119,7 @@ $sections = array(
|
||||
$href["confirm_email"] => 'f_modules/m_frontend/m_auth/verify',
|
||||
$href["captcha"] => 'f_modules/m_frontend/m_auth/captcha',
|
||||
$href["account"] => 'f_modules/m_frontend/m_acct/account',
|
||||
$href["builder"] => 'f_modules/m_frontend/templatebuilder',
|
||||
$href["channels"] => 'f_modules/m_frontend/m_acct/channels',
|
||||
$href["messages"] => 'f_modules/m_frontend/m_msg/messages',
|
||||
$href["contacts"] => 'f_modules/m_frontend/m_msg/messages',
|
||||
@@ -126,39 +192,35 @@ if (!ob_start("ob_gzhandler")) {
|
||||
}
|
||||
|
||||
$include = isset($sections[$section]) ? $sections[$section] : 'error';
|
||||
include $include . '.php';
|
||||
error_log("PARSER DEBUG: REQUEST_URI=" . $_SERVER['REQUEST_URI'] . ", section=" . var_export($section, true) . ", include=" . $include);
|
||||
|
||||
$include_file = $include . '.php';
|
||||
if (!file_exists($include_file)) {
|
||||
error_log("ERROR: Include file does not exist: $include_file");
|
||||
http_response_code(500);
|
||||
} else {
|
||||
error_log("Including file: $include_file");
|
||||
try {
|
||||
include $include_file;
|
||||
error_log("Include completed successfully: $include_file");
|
||||
} catch (Throwable $e) {
|
||||
error_log("Exception during include: " . $e->getMessage() . " in " . $e->getFile() . ":" . $e->getLine());
|
||||
http_response_code(500);
|
||||
}
|
||||
}
|
||||
|
||||
$get_ct = ob_get_contents();
|
||||
$end_ct = ob_end_clean();
|
||||
echo $get_ct;
|
||||
|
||||
function hrefCheck($c)
|
||||
{
|
||||
$section = explode('/', $c);return $section[0];
|
||||
}
|
||||
function keyCheck($k, $a)
|
||||
{
|
||||
foreach ($k as $v) {
|
||||
if ($v == '@') {
|
||||
$v = 'channel';
|
||||
}
|
||||
if (in_array($v, $a)) {
|
||||
return $v;
|
||||
}
|
||||
if (!function_exists('compress_page')) {
|
||||
function compress_page($buffer)
|
||||
{
|
||||
$search = array(
|
||||
"/ +/" => " ",
|
||||
"/<!--\{(.*?)\}-->|<!--(.*?)-->|\/\/(.*?)|[\t\r\n]|<!--|-->|\/\/ <!--|\/\/ -->|<!\[CDATA\[|\/\/ \]\]>|\]\]>|\/\/\]\]>|\/\/<!\[CDATA\[/" => "",
|
||||
);
|
||||
$buffer = preg_replace(array_keys($search), array_values($search), $buffer);
|
||||
return $buffer;
|
||||
}
|
||||
// Return empty string for root URL (home page)
|
||||
if (empty($k) || (count($k) == 1 && $k[0] === '')) {
|
||||
return '';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function compress_page($buffer)
|
||||
{
|
||||
$search = array(
|
||||
"/ +/" => " ",
|
||||
"/<!--\{(.*?)\}-->|<!--(.*?)-->|\/\/(.*?)|[\t\r\n]|<!--|-->|\/\/ <!--|\/\/ -->|<!\[CDATA\[|\/\/ \]\]>|\]\]>|\/\/\]\]>|\/\/<!\[CDATA\[/" => "",
|
||||
);
|
||||
$buffer = preg_replace(array_keys($search), array_values($search), $buffer);
|
||||
return $buffer;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user