Organisation.

このコミットが含まれているのは:
テクニカル諏訪子 2018-02-02 18:27:57 +09:00
コミット c3bf8544e2
14個のファイルの変更171行の追加157行の削除

ファイルの表示

@ -7,34 +7,30 @@ use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class CategoryController extends Controller {
public function getCategories() { // /api/rpc/category/getcategories
public function getCategories() { // /api/rpc/store/category/getcategories
return DB::table('str_category')
->select('*')
->get();
}
public function getCategory($id) { // /api/rpc/category/getcategory/1
public function getCategory($id) { // /api/rpc/store/category/getcategory/1
return DB::table('str_category')
->select('*')
->where('id', $id)
->get();
}
public function getCategoryParent($id) { // /api/rpc/category/getcategoryparent/1
public function getCategoryParent($id) { // /api/rpc/store/category/getcategoryparent/1
return DB::table('str_category')
->select('parent_id')
->where('id', $id)
->get();
}
public function getCategoryMinScreenshots($id) { // /api/rpc/category/getcategoryminscrot/1
public function getCategoryMinScreenshots($id) { // /api/rpc/store/category/getcategoryminscrot/1
return DB::table('str_category')
->select('min_screenshots')
->where('id', $id)
->get();
}
public function category($cat_id) { // /category/cat_id
return view('category', compact('cat_id'));
}
}

ファイルの表示

@ -7,34 +7,34 @@ use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class FileController extends Controller {
public function getAllFiles() { // /api/rpc/file/getallfiles
public function getAllFiles() { // /api/rpc/store/file/getallfiles
return DB::table('str_file')
->select('*')
->get();
}
public function getAllApprovedFiles() { // /api/rpc/file/getallapprovedfiles
public function getAllApprovedFiles() { // /api/rpc/store/file/getallapprovedfiles
return DB::table('str_file')
->select('*')
->where('isApproved', 1)
->get();
}
public function getAllBrokenFiles() { // /api/rpc/file/getallbrokenfiles
public function getAllBrokenFiles() { // /api/rpc/store/file/getallbrokenfiles
return DB::table('str_file')
->select('*')
->where('isBroken', 1)
->get();
}
public function getAllPendingFiles() { // /api/rpc/file/getallpendingfiles
public function getAllPendingFiles() { // /api/rpc/store/file/getallpendingfiles
return DB::table('str_file')
->select('*')
->where('isApproved', 0)
->get();
}
public function getNewFiles() { // /api/rpc/file/getnewfiles
public function getNewFiles() { // /api/rpc/store/file/getnewfiles
return DB::table('str_file')
->select(
'id',
@ -48,7 +48,7 @@ class FileController extends Controller {
->get();
}
public function getHotFiles() { // /api/rpc/file/gethotfiles
public function getHotFiles() { // /api/rpc/store/file/gethotfiles
return DB::table('str_file')
->select(
'id',
@ -62,7 +62,7 @@ class FileController extends Controller {
->get();
}
public function getFilesPageAll($cat, $from, $to) { // /api/rpc/file/getfilespageall/cat/from/to
public function getFilesPageAll($cat, $from, $to) { // /api/rpc/store/file/getfilespageall/cat/from/to
return DB::table('str_file')
->select(
'id',
@ -80,7 +80,7 @@ class FileController extends Controller {
->get();
}
public function getFilesPageApproved($cat, $from, $to) { // /api/rpc/file/getfilespageapproved/cat/from/to
public function getFilesPageApproved($cat, $from, $to) { // /api/rpc/store/file/getfilespageapproved/cat/from/to
return DB::table('str_file')
->select(
'id',
@ -99,7 +99,7 @@ class FileController extends Controller {
->get();
}
public function getFilesPagePopularView($cat, $from, $to) { // /api/rpc/file/getfilespagepopularview/cat/from/to
public function getFilesPagePopularView($cat, $from, $to) { // /api/rpc/store/file/getfilespagepopularview/cat/from/to
return DB::table('str_file')
->select(
'id',
@ -118,7 +118,7 @@ class FileController extends Controller {
->get();
}
public function getFilesPagePopularDownload($cat, $from, $to) { // /api/rpc/file/getfilespagepopulardownload/cat/from/to
public function getFilesPagePopularDownload($cat, $from, $to) { // /api/rpc/store/file/getfilespagepopulardownload/cat/from/to
return DB::table('str_file')
->select(
'id',
@ -137,18 +137,35 @@ class FileController extends Controller {
->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
public function getFile($id) { // /api/rpc/store/file/getfile/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')
->where('file_id', $id)
->get(array(
"file_id",
"user_id",
"title",
"version",
"description",
"changelog",
"views",
"downloads",
"submit_date",
"last_date",
"username",
"avatar",
"perm_id",
"gender",
"display_name",
"name_colour",
));
}
public function getFileTitle($id) { // /api/rpc/store/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",
@ -167,32 +184,32 @@ class FileController extends Controller {
));
}
public function getFileDescription($id) { // /api/rpc/file/getfiledescription/id
public function getFileDescription($id) { // /api/rpc/store/file/getfiledescription/id
return DB::table('str_file')
->select('description')
->where('id', $id)
->get();
}
public function getFileChangelog($id) { // /api/rpc/file/getfilechangelog/id
public function getFileChangelog($id) { // /api/rpc/store/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
public function getFilesInCategory($cat_id) { // /api/rpc/store/file/getfilesincategory/cat_id
return DB::table('str_file')
->select('*')
->where('cat_id', $cat_id)
->get();
}
public function insertEntry(Request $request) { // /api/rpc/file/insert
public function insertEntry(Request $request) { // /api/rpc/store/file/insert
return;
}
public function updateEntry(Request $request) { // /api/rpc/file/update
public function updateEntry(Request $request) { // /api/rpc/store/file/update
return DB::table('str_file')
->where('id', $request->id)
->update([
@ -206,19 +223,15 @@ class FileController extends Controller {
]);
}
public function restoreEntry(Request $request) { // /api/rpc/file/restore
public function restoreEntry(Request $request) { // /api/rpc/store/file/restore
return DB::table('str_file')
->where('id', $request->id)
->update(['isApproved', 1]);
}
public function removeEntry(Request $request) { // /api/rpc/file/remove
public function removeEntry(Request $request) { // /api/rpc/store/file/remove
return DB::table('str_file')
->where('id', $request->id)
->update(['isApproved', 0]);
}
public function entry($file_id) { // /entry/file_id
return view('entry', compact('file_id'));
}
}

ファイルの表示

@ -1,17 +0,0 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class HomeController extends Controller
{
/**
* Show the homepage.
*
* @return \Illuminate\Http\Response
*/
public function index() {
return view('home');
}
}

ファイルの表示

@ -7,13 +7,13 @@ use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class OwnerController extends Controller {
public function countOwnersOfFile($file_id) { // /api/rpc/owner/countownersoffile/id
public function countOwnersOfFile($file_id) { // /api/rpc/user/owner/countownersoffile/id
return DB::table('str_owners')
->where('file_id', $file_id)
->count();
}
public function getOwnersOfFile($file_id) { // /api/rpc/owner/getownersoffile/id
public function getOwnersOfFile($file_id) { // /api/rpc/user/owner/getownersoffile/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')
@ -35,14 +35,14 @@ class OwnerController extends Controller {
));
}
public function countFilesOfOwner($user_id) { // /api/rpc/owner/countfilesofowner/id
public function countFilesOfOwner($user_id) { // /api/rpc/user/owner/countfilesofowner/id
return DB::table('str_owners')
->where('user_id', $user_id)
->count();
}
public function getFilesOfOwner($user_id) { // /api/rpc/owner/getfilesofowner/id
public function getFilesOfOwner($user_id) { // /api/rpc/user/owner/getfilesofowner/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')

ファイルの表示

@ -1,26 +0,0 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class UploadController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct() {
$this->middleware('auth');
}
/**
* Show the upload page.
*
* @return \Illuminate\Http\Response
*/
public function index() {
return view('upload');
}
}

ファイルの表示

@ -9,13 +9,13 @@ use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class UserController extends Controller {
public function getUsers() { // /api/rpc/user/getusers
public function getUsers() { // /api/rpc/user/user/getusers
return DB::table('for_users')
->select('*')
->get();
}
public function getUser($id) { // /api/rpc/user/getuser/id
public function getUser($id) { // /api/rpc/user/user/getuser/id
return DB::table('for_users')
->select(
'id',
@ -47,7 +47,7 @@ class UserController extends Controller {
->get();
}
public function getGroupColours() { // /api/rpc/user/getgroupcolours
public function getGroupColours() { // /api/rpc/user/user/getgroupcolours
return DB::table('usr_perm_module')
->select(
'id',

10
routes/class/board.php ノーマルファイル
ファイルの表示

@ -0,0 +1,10 @@
<?php
/*
|--------------------------------------------------------------------------
| Board class
|--------------------------------------------------------------------------
|
| These are the API routes corresponding to board.
|
*/

10
routes/class/document.php ノーマルファイル
ファイルの表示

@ -0,0 +1,10 @@
<?php
/*
|--------------------------------------------------------------------------
| Document class
|--------------------------------------------------------------------------
|
| These are the API routes corresponding to document.
|
*/

10
routes/class/image.php ノーマルファイル
ファイルの表示

@ -0,0 +1,10 @@
<?php
/*
|--------------------------------------------------------------------------
| Image class
|--------------------------------------------------------------------------
|
| These are the API routes corresponding to image.
|
*/

10
routes/class/odb.php ノーマルファイル
ファイルの表示

@ -0,0 +1,10 @@
<?php
/*
|--------------------------------------------------------------------------
| ODB class
|--------------------------------------------------------------------------
|
| These are the API routes corresponding to odb.
|
*/

10
routes/class/page.php ノーマルファイル
ファイルの表示

@ -0,0 +1,10 @@
<?php
/*
|--------------------------------------------------------------------------
| Page class
|--------------------------------------------------------------------------
|
| These are the API routes corresponding to page.
|
*/

39
routes/class/store.php ノーマルファイル
ファイルの表示

@ -0,0 +1,39 @@
<?php
// namespace \App\Http\Controllers\Store;
/*
|--------------------------------------------------------------------------
| Store class
|--------------------------------------------------------------------------
|
| These are the API routes corresponding to store.
|
*/
// Category
Route::get('/api/rpc/store/category/getcategories', 'CategoryController@getCategories');
Route::get('/api/rpc/store/category/getcategory/{id}', 'CategoryController@getCategory');
Route::get('/api/rpc/store/category/getcategoryparent/{id}', 'CategoryController@getCategoryParent');
Route::get('/api/rpc/store/category/getcategoryminscrot/{id}', 'CategoryController@getCategoryMinScreenshots');
// File
Route::get('/api/rpc/store/file/getallfiles', 'FileController@getAllFiles');
Route::get('/api/rpc/store/file/getallapprovedfiles', 'FileController@getAllApprovedFiles');
Route::get('/api/rpc/store/file/getallbrokenfiles', 'FileController@getAllBrokenFiles');
Route::get('/api/rpc/store/file/getallpendingfiles', 'FileController@getAllPendingFiles');
Route::get('/api/rpc/store/file/getnewfiles', 'FileController@getNewFiles');
Route::get('/api/rpc/store/file/gethotfiles', 'FileController@getHotFiles');
Route::get('/api/rpc/store/file/getfilespageall/{cat}/{from}/{to}', 'FileController@getFilesPageAll');
Route::get('/api/rpc/store/file/getfilespageapproved/{cat}/{from}/{to}', 'FileController@getFilesPageApproved');
Route::get('/api/rpc/store/file/getfilespagepopularview/{cat}/{from}/{to}', 'FileController@getFilesPagePopularView');
Route::get('/api/rpc/store/file/getfilespagepopulardownload/{cat}/{from}/{to}', 'FileController@getFilesPagePopularDownload');
Route::get('/api/rpc/store/file/getfile/{id}', 'FileController@getFile');
Route::get('/api/rpc/store/file/getfiletitle/{id}', 'FileController@getFileTitle');
Route::get('/api/rpc/store/file/getfiledescription/{id}', 'FileController@getFileDescription');
Route::get('/api/rpc/store/file/getfilechangelog/{id}', 'FileController@getFileChangelog');
Route::get('/api/rpc/store/file/getfilesincategory/{cat_id}', 'FileController@getFilesInCategory');
Route::post('/api/rpc/store/file/insert', 'FileController@insertEntry');
Route::post('/api/rpc/store/file/update', 'FileController@updateEntry');
Route::post('/api/rpc/store/file/restore', 'FileController@restoreEntry');
Route::post('/api/rpc/store/file/remove', 'FileController@removeEntry');

21
routes/class/user.php ノーマルファイル
ファイルの表示

@ -0,0 +1,21 @@
<?php
/*
|--------------------------------------------------------------------------
| User class
|--------------------------------------------------------------------------
|
| These are the API routes corresponding to user.
|
*/
// Owner
Route::get('/api/rpc/user/owner/countownersoffile/{id}', 'OwnerController@countOwnersOfFile');
Route::get('/api/rpc/user/owner/getownersoffile/{id}', 'OwnerController@getOwnersOfFile');
Route::get('/api/rpc/user/owner/countfilesofowner/{id}', 'OwnerController@countFilesOfOwner');
Route::get('/api/rpc/user/owner/getfilesofowner/{id}', 'OwnerController@getFilesOfOwner');
// User
Route::get('/api/rpc/user/user/getusers', 'UserController@getUsers');
Route::get('/api/rpc/user/user/getuser/{id}', 'UserController@getUser');
Route::get('/api/rpc/user/user/getgroupcolours', 'UserController@getGroupColours');

ファイルの表示

@ -14,49 +14,13 @@
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: "Origin, X-Requested-With, Content-Type, Accept"');
Auth::routes();
// FRONTEND
Route::get('/', 'HomeController@index')->name('home');
Route::get('/upload', 'UploadController@index')->name('upload');
Route::get('/search', 'SearchController@index')->name('search');
Route::get('/category/{cat_id}', 'CategoryController@category')->name('category');
Route::get('/entry/{file_id}', 'FileController@entry')->name('entry');
Route::get('/profile/{user_id}', 'ProfileController@index')->name('profile');
// BACKEND
// Category
Route::get('/api/rpc/category/getcategories', 'CategoryController@getCategories');
Route::get('/api/rpc/category/getcategory/{id}', 'CategoryController@getCategory');
Route::get('/api/rpc/category/getcategoryparent/{id}', 'CategoryController@getCategoryParent');
Route::get('/api/rpc/category/getcategoryminscrot/{id}', 'CategoryController@getCategoryMinScreenshots');
// File
Route::get('/api/rpc/file/getallfiles', 'FileController@getAllFiles');
Route::get('/api/rpc/file/getallapprovedfiles', 'FileController@getAllApprovedFiles');
Route::get('/api/rpc/file/getallbrokenfiles', 'FileController@getAllBrokenFiles');
Route::get('/api/rpc/file/getallpendingfiles', 'FileController@getAllPendingFiles');
Route::get('/api/rpc/file/getnewfiles', 'FileController@getNewFiles');
Route::get('/api/rpc/file/gethotfiles', 'FileController@getHotFiles');
Route::get('/api/rpc/file/getfilespageall/{cat}/{from}/{to}', 'FileController@getFilesPageAll');
Route::get('/api/rpc/file/getfilespageapproved/{cat}/{from}/{to}', 'FileController@getFilesPageApproved');
Route::get('/api/rpc/file/getfilespagepopularview/{cat}/{from}/{to}', 'FileController@getFilesPagePopularView');
Route::get('/api/rpc/file/getfilespagepopulardownload/{cat}/{from}/{to}', 'FileController@getFilesPagePopularDownload');
Route::get('/api/rpc/file/getfile/{id}', 'FileController@getFile');
Route::get('/api/rpc/file/getfiletitle/{id}', 'FileController@getFileTitle');
Route::get('/api/rpc/file/getfiledescription/{id}', 'FileController@getFileDescription');
Route::get('/api/rpc/file/getfilechangelog/{id}', 'FileController@getFileChangelog');
Route::get('/api/rpc/file/getfilesincategory/{cat_id}', 'FileController@getFilesInCategory');
Route::post('/api/rpc/file/insert', 'FileController@insertEntry');
Route::post('/api/rpc/file/update', 'FileController@updateEntry');
Route::post('/api/rpc/file/restore', 'FileController@restoreEntry');
Route::post('/api/rpc/file/remove', 'FileController@removeEntry');
// Owners
Route::get('/api/rpc/owner/countownersoffile/{id}', 'OwnerController@countOwnersOfFile');
Route::get('/api/rpc/owner/getownersoffile/{id}', 'OwnerController@getOwnersOfFile');
Route::get('/api/rpc/owner/countfilesofowner/{id}', 'OwnerController@countFilesOfOwner');
Route::get('/api/rpc/owner/getfilesofowner/{id}', 'OwnerController@getFilesOfOwner');
// require(__DIR__.'/class/board.php');
// require(__DIR__.'/class/document.php');
// require(__DIR__.'/class/image.php');
// require(__DIR__.'/class/odb.php');
// require(__DIR__.'/class/page.php');
require(__DIR__.'/class/store.php');
require(__DIR__.'/class/user.php');
// Permissions
Route::get('/api/rpc/permission/getpermissionsfrommodule', 'PermissionController@getPermissionsFromModule');
@ -67,29 +31,3 @@ Route::get('/api/rpc/permission/getstorepermissionuser/{id}', 'PermissionControl
Route::get('/api/rpc/permission/getuserpermissions', 'PermissionController@getUserPermissions');
Route::get('/api/rpc/permission/getuserpermissiongroup/{id}', 'PermissionController@getUserPermissionGroup');
Route::get('/api/rpc/permission/getuserpermissionuser/{id}', 'PermissionController@getUserPermissionUser');
// Users
Route::get('/api/rpc/user/getusers', 'UserController@getUsers');
Route::get('/api/rpc/user/getuser/{id}', 'UserController@getUser');
Route::get('/api/rpc/user/getgroupcolours', 'UserController@getGroupColours');
// Localization
Route::get('/js/lang.js', function () {
$strings = Cache::rememberForever('lang.js', function () {
$lang = config('app.locale');
$files = glob(resource_path('lang/' . $lang . '/*.php'));
$strings = [];
foreach ($files as $file) {
$name = basename($file, '.php');
$strings[$name] = require $file;
}
return $strings;
});
header('Content-Type: text/javascript');
echo('window.i18n = ' . json_encode($strings) . ';');
exit();
})->name('assets.lang');