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 '
No videos found
'; } $html = '
'; 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 .= "
\"$title\" $duration

{$title}

$username $views views

"; } $html .= '
'; return $html; } } ?>