-
Notifications
You must be signed in to change notification settings - Fork 1
/
data.php
54 lines (43 loc) · 1.51 KB
/
data.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
require_once 'vendor/autoload.php';
use Symfony\Component\Mailer\Mailer;
use Symfony\Component\Mailer\Transport;
use Symfony\Component\Mime\Email;
$email_configuration = [
'dsn' => 'smtp://[email protected]:[email protected]:465?encryption=tls',
'from' => '[email protected]',
'host_info' => 'http://localhost:8080'
];
date_default_timezone_set("Europe/Moscow");
setlocale(LC_ALL, 'ru_RU');
$dsn = $email_configuration['dsn'];
$transport = Transport::fromDSN($dsn);
$connection = mysqli_connect('localhost', 'root', '', 'readme');
if (!$connection) {
$error = mysqli_error($connection);
$page_content = include_template('error.php', ['error' => $error]);
}
mysqli_set_charset($connection, 'utf8');
const SECONDS_IN_MIN = 60;
const SECONDS_IN_HOUR = 3600;
const SECONDS_IN_DAY = 86400;
const SECONDS_IN_WEEK = 604800;
const SECONDS_IN_MONTH = 2419200;
const QUOTE_AUTHOR_MIN_LENGTH = 5;
const QUOTE_AUTHOR_MAX_LENGTH = 128;
const COMMENT_MIN_LENGTH = 4;
const LOGIN_MIN_LENGTH = 3;
const LOGIN_MAX_LENGTH = 320;
const PAGE_POST_LIMIT = 6;
const MESSAGE_PREVIEW_LENGTH = 4;
const TEXT_PREVIEW_LENGTH = 300;
const MESSAGE_MIN_LENGTH = 1;
const COMMENT_OFFSET = 4;
$form_templates = [
'photo' => 'add_templates/add_forms/add-post-photo.php',
'text' => 'add_templates/add_forms/add-post-text.php',
'link' => 'add_templates/add_forms/add-post-link.php',
'video' => 'add_templates/add_forms/add-post-video.php',
'quote' => 'add_templates/add_forms/add-post-quote.php'
];
?>