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

110 行
3.1 KiB
PHP
Raw 通常表示 履歴

2018-01-24 01:36:47 +09:00
<?php
namespace App\Http\Controllers;
2018-01-24 04:44:45 +09:00
use Illuminate\Support\Facades\DB;
2018-01-24 01:36:47 +09:00
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class FileController extends Controller {
2018-01-24 04:44:45 +09:00
public function getAllFiles() { // /api/rpc/file/getallfiles
2018-01-24 23:58:21 +09:00
return DB::table('str_file')
->select('*')
->get();
2018-01-24 01:36:47 +09:00
}
2018-01-24 04:44:45 +09:00
public function getAllApprovedFiles() { // /api/rpc/file/getallapprovedfiles
2018-01-24 23:58:21 +09:00
return DB::table('str_file')
->select('*')
->where('isApproved', 1)
->get();
2018-01-24 01:36:47 +09:00
}
2018-01-24 04:44:45 +09:00
public function getAllBrokenFiles() { // /api/rpc/file/getallbrokenfiles
2018-01-24 23:58:21 +09:00
return DB::table('str_file')
->select('*')
->where('isBroken', 1)
->get();
2018-01-24 01:36:47 +09:00
}
2018-01-24 04:44:45 +09:00
public function getAllPendingFiles() { // /api/rpc/file/getallpendingfiles
2018-01-24 23:58:21 +09:00
return DB::table('str_file')
->select('*')
->where('isApproved', 0)
->get();
2018-01-24 01:36:47 +09:00
}
2018-01-24 04:44:45 +09:00
public function getNewFiles() { // /api/rpc/file/getnewfiles
2018-01-24 13:39:01 +09:00
return DB::table('str_file')
->select('id', 'title', 'submit_date')
->where('isApproved', 1)
->orderBy('submit_date', 'desc')
->limit(5)
->get();
2018-01-24 01:36:47 +09:00
}
2018-01-24 04:44:45 +09:00
public function getHotFiles() { // /api/rpc/file/gethotfiles
2018-01-24 13:39:01 +09:00
return DB::table('str_file')
->select('id', 'title', 'downloads')
->where('isApproved', 1)
->orderBy('downloads', 'desc')
->limit(5)
->get();
2018-01-24 01:36:47 +09:00
}
2018-01-24 04:44:45 +09:00
public function getFile($id) { // /api/rpc/file/getfile/id
2018-01-24 23:58:21 +09:00
return DB::table('str_file')
->select('*')
->where('id', $id)
->get();
2018-01-24 01:36:47 +09:00
}
2018-01-25 00:35:17 +09:00
public function getFileTitle($id) { // /api/rpc/file/getfiletitle/id
2018-01-25 23:12:47 +09:00
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)
2018-01-25 23:12:47 +09:00
->where('file_id', $id)
->get(array(
"user_id",
"title",
"version",
"views",
"downloads",
"submit_date",
"last_date",
"username",
"avatar",
"perm_id",
2018-01-25 23:12:47 +09:00
"gender",
"display_name",
"name_colour",
));
2018-01-25 00:35:17 +09:00
}
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')
2018-01-25 05:55:08 +09:00
->select('changelog', 'version')
2018-01-25 00:35:17 +09:00
->where('id', $id)
->get();
}
2018-01-24 04:44:45 +09:00
public function getFilesInCategory($cat_id) { // /api/rpc/file/getfilesincategory/cat_id
2018-01-24 23:58:21 +09:00
return DB::table('str_file')
->select('*')
->where('cat_id', $cat_id)
->get();
2018-01-24 01:36:47 +09:00
}
2018-01-25 00:30:18 +09:00
2018-01-25 00:35:17 +09:00
public function entry($file_id) { // /entry/file_id
2018-01-25 21:51:55 +09:00
return view('entry', compact('file_id'));
2018-01-25 00:30:18 +09:00
}
2018-01-24 01:36:47 +09:00
}