diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php deleted file mode 100644 index 6a247fe..0000000 --- a/app/Http/Controllers/Auth/ForgotPasswordController.php +++ /dev/null @@ -1,32 +0,0 @@ -middleware('guest'); - } -} diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php deleted file mode 100644 index b2ea669..0000000 --- a/app/Http/Controllers/Auth/LoginController.php +++ /dev/null @@ -1,39 +0,0 @@ -middleware('guest')->except('logout'); - } -} diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php deleted file mode 100644 index f77265a..0000000 --- a/app/Http/Controllers/Auth/RegisterController.php +++ /dev/null @@ -1,71 +0,0 @@ -middleware('guest'); - } - - /** - * Get a validator for an incoming registration request. - * - * @param array $data - * @return \Illuminate\Contracts\Validation\Validator - */ - protected function validator(array $data) - { - return Validator::make($data, [ - 'name' => 'required|string|max:255', - 'email' => 'required|string|email|max:255|unique:users', - 'password' => 'required|string|min:6|confirmed', - ]); - } - - /** - * Create a new user instance after a valid registration. - * - * @param array $data - * @return \App\User - */ - protected function create(array $data) - { - return User::create([ - 'name' => $data['name'], - 'email' => $data['email'], - 'password' => bcrypt($data['password']), - ]); - } -} diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php deleted file mode 100644 index cf726ee..0000000 --- a/app/Http/Controllers/Auth/ResetPasswordController.php +++ /dev/null @@ -1,39 +0,0 @@ -middleware('guest'); - } -} diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php deleted file mode 100644 index 2326851..0000000 --- a/app/Http/Controllers/CategoryController.php +++ /dev/null @@ -1,43 +0,0 @@ -select('*') - ->get(); - } - - 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/store/category/getcategoryparent/1 - return DB::table('str_category') - ->select('parent_id') - ->where('id', $id) - ->get(); - } - - public function getCategoryMinScreenshots($id) { // /api/rpc/store/category/getcategoryminscrot/1 - return DB::table('str_category') - ->select('min_screenshots') - ->where('id', $id) - ->get(); - } - - public function getCategoryName($id) { // /api/rpc/store/category/getcategoryname/id - return DB::table('str_category') - ->select('name') - ->where('id', $id) - ->get(); - } -} diff --git a/app/Http/Controllers/ExampleController.php b/app/Http/Controllers/ExampleController.php deleted file mode 100644 index 9ae7227..0000000 --- a/app/Http/Controllers/ExampleController.php +++ /dev/null @@ -1,36 +0,0 @@ -where('file_id', $file_id) - ->count(); - } - - 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') - ->where('file_id', $file_id) - ->get(array( - "user_id", - "title", - "version", - "views", - "downloads", - "submit_date", - "last_date", - "username", - "avatar", - "perm_id", - "gender", - "display_name", - "name_colour", - )); - } - - 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/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') - ->where('user_id', $user_id) - ->get(array( - "user_id", - "title", - "version", - "views", - "downloads", - "submit_date", - "last_date", - "username", - "avatar", - "perm_id", - "gender", - "display_name", - "name_colour", - )); - } -} diff --git a/app/Http/Controllers/FileController.php b/app/Http/Controllers/StoreController.php similarity index 67% rename from app/Http/Controllers/FileController.php rename to app/Http/Controllers/StoreController.php index 111f13b..b0347e6 100644 --- a/app/Http/Controllers/FileController.php +++ b/app/Http/Controllers/StoreController.php @@ -6,35 +6,72 @@ use Illuminate\Support\Facades\DB; use Illuminate\Http\Request; use Illuminate\Support\Facades\Log; -class FileController extends Controller { - public function getAllFiles() { // /api/rpc/store/file/getallfiles +class StoreController extends Controller { + // Category + + public function getCategories() { // /api/rpc/store/category/getcategories + return DB::table('str_category') + ->select('*') + ->get(); + } + + 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/store/category/getcategoryparent/1 + return DB::table('str_category') + ->select('parent_id') + ->where('id', $id) + ->get(); + } + + public function getCategoryMinScreenshots($id) { // /api/rpc/store/category/getcategoryminscrot/1 + return DB::table('str_category') + ->select('min_screenshots') + ->where('id', $id) + ->get(); + } + + public function getCategoryName($id) { // /api/rpc/store/category/getcategoryname/id + return DB::table('str_category') + ->select('name') + ->where('id', $id) + ->get(); + } + + // Entries + public function getAllEntries() { // /api/rpc/store/entry/getallentries return DB::table('str_file') ->select('*') ->get(); } - public function getAllApprovedFiles() { // /api/rpc/store/file/getallapprovedfiles + public function getAllApprovedEntries() { // /api/rpc/store/entry/getallapprovedentries return DB::table('str_file') ->select('*') ->where('isApproved', 1) ->get(); } - public function getAllBrokenFiles() { // /api/rpc/store/file/getallbrokenfiles + public function getAllBrokenEntries() { // /api/rpc/store/entry/getallbrokenentries return DB::table('str_file') ->select('*') ->where('isBroken', 1) ->get(); } - public function getAllPendingFiles() { // /api/rpc/store/file/getallpendingfiles + public function getAllPendingEntries() { // /api/rpc/store/entry/getallpendingentries return DB::table('str_file') ->select('*') ->where('isApproved', 0) ->get(); } - public function getNewFiles() { // /api/rpc/store/file/getnewfiles + public function getNewEntries() { // /api/rpc/store/entry/getnewentries return DB::table('str_file') ->select( 'id', @@ -48,7 +85,7 @@ class FileController extends Controller { ->get(); } - public function getHotFiles() { // /api/rpc/store/file/gethotfiles + public function getHotEntries() { // /api/rpc/store/entry/gethotentries return DB::table('str_file') ->select( 'id', @@ -62,7 +99,7 @@ class FileController extends Controller { ->get(); } - public function getFilesPageAll($cat, $from, $to) { // /api/rpc/store/file/getfilespageall/cat/from/to + public function getEntriesPageAll($cat, $from, $to) { // /api/rpc/store/entry/getentriespageall/cat/from/to return DB::table('str_file') ->select( 'id', @@ -80,7 +117,7 @@ class FileController extends Controller { ->get(); } - public function getFilesPageApproved($cat, $from, $to) { // /api/rpc/store/file/getfilespageapproved/cat/from/to + public function getEntriesPageApproved($cat, $from, $to) { // /api/rpc/store/entry/getentriespageapproved/cat/from/to return DB::table('str_file') ->select( 'id', @@ -99,7 +136,7 @@ class FileController extends Controller { ->get(); } - public function getFilesPagePopularView($cat, $from, $to) { // /api/rpc/store/file/getfilespagepopularview/cat/from/to + public function getEntriesPagePopularView($cat, $from, $to) { // /api/rpc/store/entry/getentriespagepopularview/cat/from/to return DB::table('str_file') ->select( 'id', @@ -118,7 +155,7 @@ class FileController extends Controller { ->get(); } - public function getFilesPagePopularDownload($cat, $from, $to) { // /api/rpc/store/file/getfilespagepopulardownload/cat/from/to + public function getEntriesPagePopularDownload($cat, $from, $to) { // /api/rpc/store/entry/getentriespagepopulardownload/cat/from/to return DB::table('str_file') ->select( 'id', @@ -137,7 +174,7 @@ class FileController extends Controller { ->get(); } - public function getFile($id) { // /api/rpc/store/file/getfile/id + public function getEntry($id) { // /api/rpc/store/entry/getentry/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') @@ -163,38 +200,38 @@ class FileController extends Controller { )); } - public function getFileName($id) { // /api/rpc/store/file/getfilename/id + public function getEntryName($id) { // /api/rpc/store/entry/getfilename/id return DB::table('str_file') ->select('title') ->where('id', $id) ->get(); } - public function getFilesInCategory($cat_id) { // /api/rpc/store/file/getfilesincategory/cat_id + public function getEntriesInCategory($cat_id) { // /api/rpc/store/entry/getentriesincategory/cat_id return DB::table('str_file') ->select('*') ->where('cat_id', $cat_id) ->get(); } - public function countFilesInCategory($cat_id) { // /api/rpc/store/file/countfilesincategory/cat_id + public function countEntriesInCategory($cat_id) { // /api/rpc/store/entry/countentriesincategory/cat_id return DB::table('str_file') ->where('cat_id', $cat_id) ->where('isApproved', 1) ->count(); } - public function countFilesInCategoryFull($cat_id) { // /api/rpc/store/file/countfilesincategoryfull/cat_id + public function countEntriesInCategoryFull($cat_id) { // /api/rpc/store/entry/countentriesincategoryfull/cat_id return DB::table('str_file') ->where('cat_id', $cat_id) ->count(); } - public function insertEntry(Request $request) { // /api/rpc/store/file/insert + public function insertEntry(Request $request) { // /api/rpc/store/entry/insert return; } - public function updateEntry(Request $request) { // /api/rpc/store/file/update + public function updateEntry(Request $request) { // /api/rpc/store/entry/update return DB::table('str_file') ->where('id', $request->id) ->update([ @@ -208,13 +245,13 @@ class FileController extends Controller { ]); } - public function restoreEntry(Request $request) { // /api/rpc/store/file/restore + public function restoreEntry(Request $request) { // /api/rpc/store/entry/restore return DB::table('str_file') ->where('id', $request->id) ->update(['isApproved', 1]); } - public function removeEntry(Request $request) { // /api/rpc/store/file/remove + public function removeEntry(Request $request) { // /api/rpc/store/entry/remove return DB::table('str_file') ->where('id', $request->id) ->update(['isApproved', 0]); diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 62b1890..85e7a35 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -12,6 +12,7 @@ use Tymon\JWTAuth\Facades\JWTAuth; use Tymon\JWTAuth\Exceptions\JWTException; class UserController extends Controller { + // User public function getUsers() { // /api/rpc/user/user/getusers return DB::table('for_users') ->select('*') @@ -113,10 +114,9 @@ class UserController extends Controller { //dd($cookieP); //dd($request); //dd($cookie->name)); - //return response('') - //->cookie('username', $cookieU) - //->cookie('password', $cookieP); - } + //return response('') + //->cookie('username', $cookieU) + //->cookie('password', $cookieP); } return "bad"; @@ -136,4 +136,62 @@ class UserController extends Controller { // public function passwordReset() {} // public function confirmReset() {} + + // Owner + public function countOwnersOfEntry($file_id) { // /api/rpc/user/owner/countownersofentry/id + return DB::table('str_owners') + ->where('file_id', $file_id) + ->count(); + } + + public function getOwnersOfEntry($file_id) { // /api/rpc/user/owner/getownersofentry/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', $file_id) + ->get(array( + "user_id", + "title", + "version", + "views", + "downloads", + "submit_date", + "last_date", + "username", + "avatar", + "perm_id", + "gender", + "display_name", + "name_colour", + )); + } + + public function countEntriesOfOwner($user_id) { // /api/rpc/user/owner/countentriesofowner/id + return DB::table('str_owners') + ->where('user_id', $user_id) + ->count(); + } + + + public function getEntriesOfOwner($user_id) { // /api/rpc/user/owner/getentriesofowner/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('user_id', $user_id) + ->get(array( + "user_id", + "title", + "version", + "views", + "downloads", + "submit_date", + "last_date", + "username", + "avatar", + "perm_id", + "gender", + "display_name", + "name_colour", + )); + } } diff --git a/app/User.php b/app/User.php deleted file mode 100644 index bfd96a6..0000000 --- a/app/User.php +++ /dev/null @@ -1,29 +0,0 @@ -middleware('auth'); -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/getfilename/{id}', 'FileController@getFileName'); -Route::get('/api/rpc/store/file/getfilesincategory/{cat_id}', 'FileController@getFilesInCategory'); -Route::get('/api/rpc/store/file/countfilesincategory/{cat_id}', 'FileController@countFilesInCategory'); -Route::get('/api/rpc/store/file/countfilesincategoryfull/{cat_id}', 'FileController@countFilesInCategoryFull'); -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'); +Route::get('/api/rpc/store/entry/getallapprovedentries', 'StoreController@getAllApprovedEntries'); +Route::get('/api/rpc/store/entry/getallbrokenentries', 'StoreController@getAllBrokenEntries'); +Route::get('/api/rpc/store/entry/getallpendingentries', 'StoreController@getAllPendingEntries'); +Route::get('/api/rpc/store/entry/getnewentries', 'StoreController@getNewEntries'); +Route::get('/api/rpc/store/entry/gethotentries', 'StoreController@getHotEntries'); +Route::get('/api/rpc/store/entry/getentriespageall/{cat}/{from}/{to}', 'StoreController@getEntriesPageAll'); +Route::get('/api/rpc/store/entry/getentriespageapproved/{cat}/{from}/{to}', 'StoreController@getEntriesPageApproved'); +Route::get('/api/rpc/store/entry/getentriespagepopularview/{cat}/{from}/{to}', 'StoreController@getEntriesPagePopularView'); +Route::get('/api/rpc/store/entry/getentriespagepopulardownload/{cat}/{from}/{to}', 'StoreController@getEntriesPagePopularDownload'); +Route::get('/api/rpc/store/entry/getentry/{id}', 'StoreController@getEntry'); +Route::get('/api/rpc/store/entry/getentryname/{id}', 'StoreController@getEntryName'); +Route::get('/api/rpc/store/entry/getentriesincategory/{cat_id}', 'StoreController@getEntriesInCategory'); +Route::get('/api/rpc/store/entry/countentriesincategory/{cat_id}', 'StoreController@countEntriesInCategory'); +Route::get('/api/rpc/store/entry/countentriesincategoryfull/{cat_id}', 'StoreController@countEntriesInCategoryFull'); +Route::post('/api/rpc/store/entry/insert', 'StoreController@insertEntry'); +Route::post('/api/rpc/store/entry/update', 'StoreController@updateEntry'); +Route::post('/api/rpc/store/entry/restore', 'StoreController@restoreEntry'); +Route::post('/api/rpc/store/entry/remove', 'StoreController@removeEntry'); diff --git a/routes/class/user.php b/routes/class/user.php index c222d6e..c1fe208 100644 --- a/routes/class/user.php +++ b/routes/class/user.php @@ -20,10 +20,10 @@ Route::group(['middleware' => 'jwt'], function () { }); // 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'); +Route::get('/api/rpc/user/owner/countownersofentry/{id}', 'UserController@countOwnersOfEntry'); +Route::get('/api/rpc/user/owner/getownersofentry/{id}', 'UserController@getOwnersOfEntry'); +Route::get('/api/rpc/user/owner/countentriesofowner/{id}', 'UserController@countEntriesOfOwner'); +Route::get('/api/rpc/user/owner/getentriesofowner/{id}', 'UserController@getEntriesOfOwner'); // User Route::get('/api/rpc/user/user/getusers', 'UserController@getUsers');