feat: Add comprehensive documentation suite and reorganize project structure

- Created complete documentation in docs/ directory
- Added PROJECT_OVERVIEW.md with feature highlights and getting started guide
- Added ARCHITECTURE.md with system design and technical details
- Added SECURITY.md with comprehensive security implementation guide
- Added DEVELOPMENT.md with development workflows and best practices
- Added DEPLOYMENT.md with production deployment instructions
- Added API.md with complete REST API documentation
- Added CONTRIBUTING.md with contribution guidelines
- Added CHANGELOG.md with version history and migration notes
- Reorganized all documentation files into docs/ directory for better organization
- Updated README.md with proper documentation links and quick navigation
- Enhanced project structure with professional documentation standards
This commit is contained in:
SamiAhmed7777
2025-10-21 00:39:45 -07:00
commit 0b7e2d0a5b
6080 changed files with 1332936 additions and 0 deletions

View File

@@ -0,0 +1,140 @@
<?php
defined('_ISVALID') or exit;
class VHomepageEnhanced {
public static function getHomepageData() {
global $class_database;
$data = [];
// Get latest videos
$data['latest_videos'] = self::getLatestVideos(12);
// Get trending videos (most viewed in last 7 days)
$data['trending_videos'] = self::getTrendingVideos(8);
// Get featured videos
$data['featured_videos'] = self::getFeaturedVideos(6);
// Get platform stats
$data['stats'] = self::getPlatformStats();
// Get categories
$data['categories'] = self::getCategories();
return $data;
}
public static function getLatestVideos($limit = 12) {
global $class_database;
$sql = "SELECT vf.*, au.usr_user as username, au.usr_key as user_key
FROM db_videofiles vf
LEFT JOIN db_accountuser au ON vf.usr_id = au.usr_id
WHERE vf.privacy = 'public' AND vf.approved = 1 AND vf.usr_id > 0
ORDER BY vf.upload_date DESC
LIMIT ?";
return $class_database->execute($sql, [$limit]);
}
public static function getTrendingVideos($limit = 8) {
global $class_database;
$sql = "SELECT vf.*, au.usr_user as username, au.usr_key as user_key
FROM db_videofiles vf
LEFT JOIN db_accountuser au ON vf.usr_id = au.usr_id
WHERE vf.privacy = 'public' AND vf.approved = 1
AND vf.upload_date > DATE_SUB(NOW(), INTERVAL 7 DAY)
ORDER BY vf.file_views DESC, vf.upload_date DESC
LIMIT ?";
return $class_database->execute($sql, [$limit]);
}
public static function getFeaturedVideos($limit = 6) {
global $class_database;
$sql = "SELECT vf.*, au.usr_user as username, au.usr_key as user_key
FROM db_videofiles vf
LEFT JOIN db_accountuser au ON vf.usr_id = au.usr_id
WHERE vf.privacy = 'public' AND vf.approved = 1
AND vf.featured = 1
ORDER BY vf.upload_date DESC
LIMIT ?";
return $class_database->execute($sql, [$limit]);
}
public static function getPlatformStats() {
global $class_database;
$stats = [];
// Total videos
$result = $class_database->execute("SELECT COUNT(*) as count FROM db_videofiles WHERE privacy = 'public' AND approved = 1");
$stats['total_videos'] = number_format($result[0]['count'] ?? 0);
// Total views
$result = $class_database->execute("SELECT SUM(file_views) as total FROM db_videofiles WHERE privacy = 'public'");
$stats['total_views'] = number_format($result[0]['total'] ?? 0);
// Total users
$result = $class_database->execute("SELECT COUNT(*) as count FROM db_accountuser WHERE usr_active = 1");
$stats['total_users'] = number_format($result[0]['count'] ?? 0);
// Videos uploaded today
$result = $class_database->execute("SELECT COUNT(*) as count FROM db_videofiles WHERE DATE(upload_date) = CURDATE()");
$stats['videos_today'] = $result[0]['count'] ?? 0;
return $stats;
}
public static function getCategories() {
global $class_database;
$sql = "SELECT c.*, COUNT(vf.file_id) as video_count
FROM db_categories c
LEFT JOIN db_videofiles vf ON c.ct_id = vf.file_category AND vf.privacy = 'public' AND vf.approved = 1
WHERE c.ct_active = 1
GROUP BY c.ct_id
ORDER BY video_count DESC, c.ct_name ASC";
return $class_database->execute($sql);
}
public static function renderVideoCard($video, $size = 'medium') {
$thumb = $video['file_thumbnail'] ?: '/f_scripts/fe/img/default-thumb.jpg';
$title = htmlspecialchars($video['file_title']);
$username = htmlspecialchars($video['username'] ?: 'Unknown');
$duration = $video['file_duration'] ?: '00:00';
$views = number_format($video['file_views'] ?: 0);
$upload_date = date('M j, Y', strtotime($video['upload_date']));
$card_class = $size === 'large' ? 'video-card-large' : 'video-card';
return "
<div class=\"$card_class\">
<div class=\"video-thumbnail\">
<a href=\"/watch/{$video['file_key']}\">
<img src=\"$thumb\" alt=\"$title\" loading=\"lazy\">
<span class=\"duration\">$duration</span>
<div class=\"play-overlay\">
<i class=\"icon-play\"></i>
</div>
</a>
</div>
<div class=\"video-details\">
<h3 class=\"video-title\">
<a href=\"/watch/{$video['file_key']}\">$title</a>
</h3>
<div class=\"video-meta\">
<a href=\"/user/{$video['user_key']}\" class=\"username\">$username</a>
<span class=\"views\">$views views</span>
<span class=\"date\">$upload_date</span>
</div>
</div>
</div>";
}
}
?>