1
0

Инициализация проекта

Загрузка проекта на GIT
This commit is contained in:
2026-01-11 15:01:35 +07:00
commit 301e179160
28 changed files with 7769 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
<?php
use Medoo\Medoo;
class Database
{
public static $db;
// Магический метод для вызова методов класса Medoo
public static function __callStatic($name, $arguments) {
if (!self::$db) {
self::init();
}
return call_user_func_array([self::$db, $name], $arguments);
}
// Инициализация подключения к БД
public static function init() {
if (!self::$db) {
try {
self::$db = new Medoo([
'type' => 'mysql',
'host' => DB_HOST,
'database' => DB_NAME,
'username' => DB_USER,
'password' => DB_PASS,
'port' => DB_PORT,
'charset' => DB_CHARSET,
'collation' => 'utf8mb4_unicode_ci',
'error' => \PDO::ERRMODE_EXCEPTION
]);
} catch (\PDOException $e) {
die('Ошибка подключения к БД: ' . $e->getMessage());
exit;
}
}
return self::$db;
}
}

File diff suppressed because it is too large Load Diff

19
backend/app/config.php Normal file
View File

@@ -0,0 +1,19 @@
<?php
// Подключение классов базы данных
require_once __DIR__ . '/class/database/class_Medoo.php';
require_once __DIR__ . '/class/database/class_Database.php';
// Подключение классов Функций
require_once __DIR__ . '/functions/function.php';
require_once __DIR__ . '/functions/routing.php';
// Данные подключения к БД
define('DB_HOST', '192.168.1.9');
define('DB_USER', 'root');
define('DB_PASS', 'root');
define('DB_NAME', 'taskboard');
define('DB_PORT', 3306);
define('DB_CHARSET', 'utf8mb4');
?>

View File

@@ -0,0 +1,4 @@
<?php
?>

View File

@@ -0,0 +1,19 @@
<?php
// Функция роутинга API
function handleRouting($routes = []) {
$request = $_SERVER['REQUEST_URI'];
$path = parse_url($request, PHP_URL_PATH);
if (isset($routes[$path])) {
$file_path = $routes[$path];
global $_POST, $_FILES, $_SERVER, $_GET;
include $file_path;
exit;
}
}