このリポジトリは2023-09-09にアーカイブされています。 ファイルの閲覧とクローンは可能ですが、プッシュ、イシューの作成、プルリクエストはできません。
076server/app/Http/Controllers/FileController.php

110 行
3.1 KiB
PHP

<?php
namespace App\Http\Controllers;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class FileController extends Controller {
public function getAllFiles() { // /api/rpc/file/getallfiles
return DB::table('str_file')
->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 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",
"group",
"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'));
}
}