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:
112
f_modules/m_backend/template_manager.php
Normal file
112
f_modules/m_backend/template_manager.php
Normal file
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
/**
|
||||
* Template Builder Management - Admin Interface
|
||||
* Allows users to manage their custom templates
|
||||
*/
|
||||
|
||||
// Include core
|
||||
require_once dirname(__FILE__) . '/../../f_core/config.core.php';
|
||||
|
||||
// Check if user is logged in
|
||||
if (!isset($_SESSION['USER_ID']) || $_SESSION['USER_ID'] <= 0) {
|
||||
header('Location: /signin.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
// Initialize template builder
|
||||
require_once $cfg['classes_dir'] . '/class.templatebuilder.php';
|
||||
$templateBuilder = new VTemplateBuilder();
|
||||
|
||||
// Handle actions
|
||||
$action = isset($_GET['action']) ? $_GET['action'] : 'list';
|
||||
$message = '';
|
||||
$messageType = '';
|
||||
|
||||
switch ($action) {
|
||||
case 'new':
|
||||
// Show builder for new template
|
||||
showBuilder(0, $templateBuilder);
|
||||
exit;
|
||||
|
||||
case 'edit':
|
||||
// Show builder for existing template
|
||||
$templateId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
||||
showBuilder($templateId, $templateBuilder);
|
||||
exit;
|
||||
|
||||
case 'delete':
|
||||
$templateId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
||||
$result = $templateBuilder->deleteTemplate($templateId);
|
||||
if ($result['success']) {
|
||||
$message = 'Template deleted successfully';
|
||||
$messageType = 'success';
|
||||
} else {
|
||||
$message = $result['error'];
|
||||
$messageType = 'error';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'duplicate':
|
||||
$templateId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
||||
$result = $templateBuilder->duplicateTemplate($templateId);
|
||||
if ($result['success']) {
|
||||
$message = 'Template duplicated successfully';
|
||||
$messageType = 'success';
|
||||
} else {
|
||||
$message = $result['error'];
|
||||
$messageType = 'error';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'toggle_active':
|
||||
$templateId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
||||
$isActive = isset($_GET['is_active']) ? (int)$_GET['is_active'] : 0;
|
||||
$result = $templateBuilder->updateTemplate($templateId, ['is_active' => $isActive]);
|
||||
if ($result['success']) {
|
||||
$message = 'Template ' . ($isActive ? 'activated' : 'deactivated') . ' successfully';
|
||||
$messageType = 'success';
|
||||
} else {
|
||||
$message = $result['error'];
|
||||
$messageType = 'error';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Get all templates
|
||||
$templates = $templateBuilder->getUserTemplates();
|
||||
$userPrefs = $templateBuilder->getUserPreferences();
|
||||
|
||||
// Assign to Smarty
|
||||
$smarty->assign('templates', $templates);
|
||||
$smarty->assign('user_prefs', $userPrefs);
|
||||
$smarty->assign('message', $message);
|
||||
$smarty->assign('message_type', $messageType);
|
||||
|
||||
// Display page
|
||||
echo $smarty->fetch('tpl_backend/tpl_template_manager.tpl');
|
||||
|
||||
/**
|
||||
* Show template builder interface
|
||||
*/
|
||||
function showBuilder($templateId, $templateBuilder)
|
||||
{
|
||||
global $smarty, $cfg;
|
||||
|
||||
$template = null;
|
||||
$templateJson = '{}';
|
||||
|
||||
if ($templateId > 0) {
|
||||
$template = $templateBuilder->getTemplate($templateId);
|
||||
if (!$template) {
|
||||
header('Location: /account.php?s=templates&error=not_found');
|
||||
exit;
|
||||
}
|
||||
$templateJson = json_encode($template);
|
||||
}
|
||||
|
||||
$smarty->assign('template', $template);
|
||||
$smarty->assign('template_json', $templateJson);
|
||||
$smarty->assign('page_title', $templateId > 0 ? 'Edit Template' : 'New Template');
|
||||
|
||||
echo $smarty->fetch('tpl_frontend/tpl_builder/tpl_builder_main.tpl');
|
||||
}
|
||||
Reference in New Issue
Block a user