<?php
defined('_ISVALID') or exit;

class VBrowseEnhanced extends VBrowse {
    public static function getVideos($limit = 20, $offset = 0) {
        global $class_database;
        
        $sql = "SELECT * FROM db_videofiles 
                WHERE file_type = 'video' AND privacy = 'public' 
                ORDER BY 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 * FROM db_videofiles 
                WHERE (file_title LIKE '%$query%' OR file_description LIKE '%$query%') 
                AND file_type = 'video' AND privacy = 'public' 
                ORDER BY upload_date DESC 
                LIMIT $limit";
                
        return $class_database->execute($sql);
    }
}
?>