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-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-05 11:51:14 +03:00
|
|
|
|
2024-07-04 12:50:26 +03:00
|
|
|
Router::post('/api/login', 'ApiController@login');
|
2024-07-05 11:13:28 +03:00
|
|
|
Router::get('/api/photo/vote', 'ApiController@photovote');
|
2024-07-04 13:20:40 +03:00
|
|
|
Router::post('/api/register', 'ApiController@register');
|
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-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 07:26:39 +03:00
|
|
|
Router::post('/api/upload', 'ApiController@upload');
|
2024-07-05 11:51:14 +03:00
|
|
|
Router::post('/api/photo/comment', 'ApiController@photocomment');
|
|
|
|
Router::post('/api/photo/getcomments/$id', 'ApiController@photocommentload');
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|