select('*') ->get(); } public function getAllApprovedFiles() { // /api/rpc/file/getallapprovedfiles return DB::table('str_file') ->select('*') ->where('isApproved', 1) ->get(); } public function getAllBrokenFiles() { // /api/rpc/file/getallbrokenfiles return DB::table('str_file') ->select('*') ->where('isBroken', 1) ->get(); } public function getAllPendingFiles() { // /api/rpc/file/getallpendingfiles return DB::table('str_file') ->select('*') ->where('isApproved', 0) ->get(); } public function getNewFiles() { // /api/rpc/file/getnewfiles return DB::table('str_file') ->select('id', 'title', 'submit_date') ->where('isApproved', 1) ->orderBy('submit_date', 'desc') ->limit(5) ->get(); } public function getHotFiles() { // /api/rpc/file/gethotfiles return DB::table('str_file') ->select('id', 'title', 'downloads') ->where('isApproved', 1) ->orderBy('downloads', 'desc') ->limit(5) ->get(); } public function getFilesPageAll($cat, $from, $to) { // /api/rpc/file/getfilespageall/cat/from/to return DB::table('str_file') ->select( 'id', 'title', 'version', 'description', 'submit_date', 'last_date', 'views', 'downloads' ) ->where('cat_id', $cat) ->offset($from) ->limit($to) ->get(); } public function getFilesPageApproved($cat, $from, $to) { // /api/rpc/file/getfilespageapproved/cat/from/to return DB::table('str_file') ->select( 'id', 'title', 'version', 'description', 'submit_date', 'last_date', 'views', 'downloads' ) ->where('cat_id', $cat) ->where('isApproved', 1) ->offset($from) ->limit($to) ->get(); } public function getFilesPagePopularView($cat, $from, $to) { // /api/rpc/file/getfilespagepopularview/cat/from/to return DB::table('str_file') ->select( 'id', 'title', 'version', 'description', 'submit_date', 'last_date', 'views', 'downloads' ) ->where('cat_id', $cat) ->where('views', '>', 1000) ->offset($from) ->limit($to) ->get(); } public function getFilesPagePopularDownload($cat, $from, $to) { // /api/rpc/file/getfilespagepopulardownload/cat/from/to return DB::table('str_file') ->select( 'id', 'title', 'version', 'description', 'submit_date', 'last_date', 'views', 'downloads' ) ->where('cat_id', $cat) ->where('downloads', '>', 1000) ->offset($from) ->limit($to) ->get(); } public function getFile($id) { // /api/rpc/file/getfile/id return DB::table('str_file') ->select('*') ->where('id', $id) ->get(); } public function getFileTitle($id) { // /api/rpc/file/getfiletitle/id return DB::table('str_owners') ->join('str_file', 'str_owners.file_id', '=', 'str_file.id') ->join('for_users', 'str_owners.user_id', '=', 'for_users.id') // ->take(1) ->where('file_id', $id) ->get(array( "user_id", "title", "version", "views", "downloads", "submit_date", "last_date", "username", "avatar", "perm_id", "gender", "display_name", "name_colour", )); } public function getFileDescription($id) { // /api/rpc/file/getfiledescription/id return DB::table('str_file') ->select('description') ->where('id', $id) ->get(); } public function getFileChangelog($id) { // /api/rpc/file/getfilechangelog/id return DB::table('str_file') ->select('changelog', 'version') ->where('id', $id) ->get(); } public function getFilesInCategory($cat_id) { // /api/rpc/file/getfilesincategory/cat_id return DB::table('str_file') ->select('*') ->where('cat_id', $cat_id) ->get(); } public function entry($file_id) { // /entry/file_id return view('entry', compact('file_id')); } }