mirror of
https://github.com/twisterarmy/cloud-server.git
synced 2025-03-13 05:51:46 +00:00
initial commit
This commit is contained in:
parent
8784a8c57d
commit
d1cd3286b0
BIN
database/cloud-server.mwb
Normal file
BIN
database/cloud-server.mwb
Normal file
Binary file not shown.
3
src/application/controller/index.php
Normal file
3
src/application/controller/index.php
Normal file
@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
require(PROJECT_DIR . '/view/index.phtml');
|
20
src/application/model/model.php
Normal file
20
src/application/model/model.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
class Model {
|
||||
|
||||
protected $db;
|
||||
|
||||
public function __construct(string $database,
|
||||
string $hostname,
|
||||
int $port,
|
||||
string $user,
|
||||
string $password) {
|
||||
try {
|
||||
$this->db = new PDO('mysql:dbname=' . $database . ';host=' . $hostname . ';port=' . $port . ';charset=utf8', $user, $password, [PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8']);
|
||||
$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$this->db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
|
||||
} catch(PDOException $e) {
|
||||
trigger_error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
0
src/application/view/index.phtml
Normal file
0
src/application/view/index.phtml
Normal file
5
src/bootstrap.php
Normal file
5
src/bootstrap.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
require(__DIR__ . '/config.php');
|
||||
|
||||
require(PROJECT_DIR . '/model/model.php');
|
12
src/config-default.php
Normal file
12
src/config-default.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
// COMMON
|
||||
define('PROJECT_HOST', '');
|
||||
define('PROJECT_DIR', __DIR__);
|
||||
|
||||
// DB
|
||||
define('DB_HOSTNAME', 'localhost');
|
||||
define('DB_PORT', 3306);
|
||||
define('DB_DATABASE', '');
|
||||
define('DB_USERNAME', '');
|
||||
define('DB_PASSWORD', '');
|
3
src/public/index.php
Normal file
3
src/public/index.php
Normal file
@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
require('../bootstrap.php');
|
8
src/system/helper/common.php
Normal file
8
src/system/helper/common.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
function plural(int $number,
|
||||
array $texts) {
|
||||
|
||||
$cases = [2, 0, 1, 1, 1, 2];
|
||||
return $texts[(($number % 100) > 4 && ($number % 100) < 20) ? 2 : $cases[min($number % 10, 5)]];
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user