nativegallery/app/Core/Routes.php

79 lines
3.8 KiB
PHP
Raw Permalink Normal View History

2024-07-04 12:04:41 +03:00
<?php
namespace App\Core;
use \App\Services\{Router, Auth, DB};
use \App\Core\{Page};
class Routes
{
public static function init()
{
Router::get('/', 'MainController@i');
2024-07-21 04:53:34 +03:00
Router::get('/robots.txt', 'MainController@robots');
2024-07-05 07:26:39 +03:00
Router::get('/t', 'MainController@t');
2024-07-04 12:50:26 +03:00
Router::get('/login', 'LoginController@i');
2024-07-04 13:09:20 +03:00
Router::get('/register', 'RegisterController@i');
2024-07-04 12:36:23 +03:00
Router::get('/photo/$id', 'PhotoController@i');
2024-07-05 06:33:46 +03:00
Router::get('/author/$id', 'ProfileController@i');
2024-07-04 12:50:26 +03:00
Router::post('/api/login', 'ApiController@login');
2024-07-04 13:20:40 +03:00
Router::post('/api/register', 'ApiController@register');
2024-07-21 00:48:11 +03:00
Router::get('/api/photo/stats', 'ApiController@photostats');
2024-07-08 21:31:59 +03:00
Router::get('/about', 'MainController@about');
2024-07-18 14:24:19 +03:00
Router::get('/rules', 'MainController@rules');
Router::get('/vehicle/$id', 'MainController@vehicle');
Router::get('/rules/pub', 'MainController@publicationRules');
Router::get('/rules/photo', 'MainController@photoRules');
Router::get('/rules/video', 'MainController@videoRules');
2024-10-06 01:08:10 +03:00
Router::get('/feed', 'MainController@feed');
Router::get('/update', 'MainController@update');
2024-07-19 01:13:24 +03:00
Router::get('/top30', 'MainController@top30');
2024-07-21 00:48:11 +03:00
Router::get('/photoext', 'PhotoController@photoext');
2024-09-14 22:57:33 +03:00
Router::get('/api/photo/compress', 'ApiController@photocompress');
Router::get('/api/photo/loadrecent', 'ApiController@recentphotos');
2024-10-03 20:35:13 +03:00
Router::get('/api/users/load/$id', 'ApiController@loaduser');
2024-10-06 01:47:20 +03:00
Router::get('/article/$id', 'MainController@gallery');
2024-07-04 12:04:41 +03:00
2024-07-05 07:26:39 +03:00
2024-07-04 12:04:41 +03:00
if (Auth::userid() > 0) {
2024-07-18 16:05:32 +03:00
$user = new \App\Models\User(Auth::userid());
2024-07-05 06:33:46 +03:00
Router::get('/lk', 'ProfileController@lk');
2024-07-05 06:58:17 +03:00
Router::get('/lk/upload', 'ProfileController@upload');
2024-07-05 12:21:52 +03:00
Router::get('/lk/history', 'ProfileController@lkhistory');
2024-07-05 15:03:35 +03:00
Router::get('/lk/profile', 'ProfileController@lkprofile');
2024-10-06 16:03:11 +03:00
Router::get('/lk/pday', 'ProfileController@photoindexhistory');
Router::get('/fav_authors', 'MainController@favauthors');
2024-07-08 23:01:54 +03:00
Router::get('/search', 'SearchController@i');
2024-10-06 01:26:58 +03:00
Router::get('/fav', 'MainController@fav');
2024-07-05 07:26:39 +03:00
Router::post('/api/upload', 'ApiController@upload');
2024-07-05 15:03:35 +03:00
Router::post('/api/profile/update', 'ApiController@updateprofile');
2024-07-05 11:51:14 +03:00
Router::post('/api/photo/comment', 'ApiController@photocomment');
2024-10-06 01:26:58 +03:00
Router::get('/api/photo/$id/favorite', 'ApiController@photofavorite');
2024-07-19 01:37:41 +03:00
Router::get('/api/subscribe', 'ApiController@subscribeuser');
2024-07-05 11:51:14 +03:00
Router::post('/api/photo/getcomments/$id', 'ApiController@photocommentload');
2024-07-06 09:57:51 +03:00
Router::get('/api/photo/vote', 'ApiController@photovote');
2024-07-20 23:50:52 +03:00
Router::get('/api/photo/checkall', 'ApiController@checkallphotos');
2024-07-06 09:57:51 +03:00
Router::get('/api/photo/comment/rate', 'ApiController@photocommentvote');
2024-10-05 14:16:39 +03:00
Router::post('/api/photo/comment/$id/edit', 'ApiController@photocommentedit');
2024-10-08 21:42:55 +03:00
Router::post('/api/photo/comment/$id/delete', 'ApiController@photocommentdelete');
Router::get('/api/vehicles/load', 'ApiController@vehiclesload');
2024-07-18 16:05:32 +03:00
if ($user->i('admin') > 0) {
Router::any('/admin', 'AdminController@index');
2024-07-18 16:13:50 +03:00
Router::any('/api/admin/images/setvisibility', 'ApiController@adminsetvis');
2024-07-21 17:22:27 +03:00
Router::any('/api/admin/createnews', 'ApiController@admincreatenews');
2024-07-21 17:28:10 +03:00
Router::any('/api/admin/loadnews', 'ApiController@adminloadnews');
2024-10-06 23:03:55 +03:00
Router::any('/api/admin/getvehicleinputs/$id', 'ApiController@admingetvehicleinputs');
2024-07-18 16:05:32 +03:00
}
2024-07-08 21:31:59 +03:00
Router::get('/logout', 'MainController@logout');
2024-07-08 20:17:49 +03:00
Router::get('/404', 'ExceptionRegister@notfound');
2024-07-04 12:04:41 +03:00
} else {
2024-07-05 06:33:46 +03:00
Router::redirect('/login?return='.$_SERVER['HTTP_REFERER']);
2024-07-04 12:04:41 +03:00
}
}
}