- 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
80 lines
3.0 KiB
PHP
80 lines
3.0 KiB
PHP
<?php
|
|
defined('_ISVALID') or exit;
|
|
|
|
class VVideoBrowse {
|
|
public static function getLatestVideos($limit = 20, $page = 1) {
|
|
global $class_database;
|
|
|
|
$offset = ($page - 1) * $limit;
|
|
$sql = "SELECT vf.*, au.usr_user as username
|
|
FROM db_videofiles vf
|
|
LEFT JOIN db_accountuser au ON vf.usr_id = au.usr_id
|
|
WHERE vf.privacy = 'public' AND vf.approved = 1
|
|
ORDER BY vf.upload_date DESC
|
|
LIMIT $limit OFFSET $offset";
|
|
|
|
return $class_database->execute($sql);
|
|
}
|
|
|
|
public static function searchVideos($query, $limit = 20) {
|
|
global $class_database;
|
|
|
|
$query = $class_database->escape($query);
|
|
$sql = "SELECT vf.*, au.usr_user as username
|
|
FROM db_videofiles vf
|
|
LEFT JOIN db_accountuser au ON vf.usr_id = au.usr_id
|
|
WHERE (vf.file_title LIKE '%$query%' OR vf.file_description LIKE '%$query%')
|
|
AND vf.privacy = 'public' AND vf.approved = 1
|
|
ORDER BY vf.upload_date DESC
|
|
LIMIT $limit";
|
|
|
|
return $class_database->execute($sql);
|
|
}
|
|
|
|
public static function getVideosByCategory($category_id, $limit = 20) {
|
|
global $class_database;
|
|
|
|
$sql = "SELECT vf.*, au.usr_user as username
|
|
FROM db_videofiles vf
|
|
LEFT JOIN db_accountuser au ON vf.usr_id = au.usr_id
|
|
WHERE vf.file_category = ? AND vf.privacy = 'public' AND vf.approved = 1
|
|
ORDER BY vf.upload_date DESC
|
|
LIMIT $limit";
|
|
|
|
return $class_database->execute($sql, [$category_id]);
|
|
}
|
|
|
|
public static function renderVideoGrid($videos) {
|
|
if (empty($videos)) {
|
|
return '<div class="no-videos">No videos found</div>';
|
|
}
|
|
|
|
$html = '<div class="video-grid">';
|
|
foreach ($videos as $video) {
|
|
$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);
|
|
|
|
$html .= "
|
|
<div class=\"video-item\">
|
|
<div class=\"video-thumb\">
|
|
<img src=\"$thumb\" alt=\"$title\">
|
|
<span class=\"duration\">$duration</span>
|
|
</div>
|
|
<div class=\"video-info\">
|
|
<h3><a href=\"/watch/{$video['file_key']}\">{$title}</a></h3>
|
|
<p class=\"video-meta\">
|
|
<span class=\"username\">$username</span>
|
|
<span class=\"views\">$views views</span>
|
|
</p>
|
|
</div>
|
|
</div>";
|
|
}
|
|
$html .= '</div>';
|
|
|
|
return $html;
|
|
}
|
|
}
|
|
?>
|