From 191d01d4226258301244a3fde07a734617ffacf5 Mon Sep 17 00:00:00 2001 From: Glorferiel Date: Thu, 12 Dec 2024 01:08:26 +0300 Subject: [PATCH 1/3] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20=D0=BE=D1=82=D1=84=D0=BE=D1=80=D0=BC=D0=BE?= =?UTF-8?q?=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20=D1=87?= =?UTF-8?q?=D0=B8=D1=81=D0=BB=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index a6b7951..8095aa5 100644 --- a/index.php +++ b/index.php @@ -1,6 +1,11 @@ 5400, 'pic' => 'img/lot-6.jpg' ] -]; + ]; ?> @@ -115,7 +120,7 @@
- ценар +
12:23 From e11708cb657c15433b70cbd227c9edb3b7dd50cd Mon Sep 17 00:00:00 2001 From: Glorferiel Date: Mon, 16 Dec 2024 00:23:57 +0300 Subject: [PATCH 2/3] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20phpdoc=20=D0=BF=D0=BE=20=D1=84=D1=83=D0=BD=D0=BA=D1=86?= =?UTF-8?q?=D0=B8=D0=B8=20=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=82=D0=B0=20?= =?UTF-8?q?=D1=81=D1=83=D0=BC=D0=BC=D1=8B=20=D0=B2=20index=20=D0=B8=20help?= =?UTF-8?q?ers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helpers.php | 11 +++++++++++ index.php | 17 +++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/helpers.php b/helpers.php index 87b1f62..6ef33c1 100644 --- a/helpers.php +++ b/helpers.php @@ -20,6 +20,17 @@ function is_date_valid(string $date) : bool { return $dateTimeObj !== false && array_sum(date_get_last_errors()) === 0; } +/** + * Форматирует cумму лота и добавляет знак рубля + * @param int|float $price + * @return string + */ +function formatAmount(int|float $price): string +{ + $price = number_format($price, 0, '.', ' '); + return $price . ' ₽'; +} + /** * Создает подготовленное выражение на основе готового SQL запроса и переданных данных * diff --git a/index.php b/index.php index 8095aa5..073766d 100644 --- a/index.php +++ b/index.php @@ -1,6 +1,11 @@
    - +
  • - <?=$value['title']; ?> + <?=$lot['title']; ?>
    - -

    + +

    - - + +
    12:23 From 7f5570082df283931e272eae467b71eb27a39e2c Mon Sep 17 00:00:00 2001 From: Glorferiel Date: Fri, 20 Dec 2024 01:21:55 +0300 Subject: [PATCH 3/3] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BD=D0=BE=D0=B2=D0=B0=D1=8F=20=D1=84=D1=83?= =?UTF-8?q?=D0=BD=D0=BA=D1=86=D0=B8=D1=8F=20=D0=B8=20phpdoc=20=D0=B2=20hel?= =?UTF-8?q?pers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helpers.php | 22 ++++++++++------------ index.php | 8 ++++---- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/helpers.php b/helpers.php index 6ef33c1..b0714f8 100644 --- a/helpers.php +++ b/helpers.php @@ -13,9 +13,9 @@ * * @return bool true при совпадении с форматом 'ГГГГ-ММ-ДД', иначе false */ -function is_date_valid(string $date) : bool { - $format_to_check = 'Y-m-d'; - $dateTimeObj = date_create_from_format($format_to_check, $date); +function isDateValid(string $date) : bool { + $formatToCheck = 'Y-m-d'; + $dateTimeObj = date_create_from_format($formatToCheck, $date); return $dateTimeObj !== false && array_sum(date_get_last_errors()) === 0; } @@ -40,7 +40,7 @@ function formatAmount(int|float $price): string * * @return mysqli_stmt Подготовленное выражение */ -function db_get_prepare_stmt($link, $sql, $data = []) { +function dbGetPrepareStmt($link, $sql, $data = []) { $stmt = mysqli_prepare($link, $sql); if ($stmt === false) { @@ -50,7 +50,7 @@ function db_get_prepare_stmt($link, $sql, $data = []) { if ($data) { $types = ''; - $stmt_data = []; + $stmtData = []; foreach ($data as $value) { $type = 's'; @@ -67,11 +67,11 @@ function db_get_prepare_stmt($link, $sql, $data = []) { if ($type) { $types .= $type; - $stmt_data[] = $value; + $stmtData[] = $value; } } - $values = array_merge([$stmt, $types], $stmt_data); + $values = array_merge([$stmt, $types], $stmtDdata); $func = 'mysqli_stmt_bind_param'; $func(...$values); @@ -107,7 +107,7 @@ function db_get_prepare_stmt($link, $sql, $data = []) { * * @return string Рассчитанная форма множественнго числа */ -function get_noun_plural_form (int $number, string $one, string $two, string $many): string +function getNounPluralForm (int $number, string $one, string $two, string $many): string { $number = (int) $number; $mod10 = $number % 10; @@ -137,7 +137,7 @@ function get_noun_plural_form (int $number, string $one, string $two, string $ma * @param array $data Ассоциативный массив с данными для шаблона * @return string Итоговый HTML */ -function include_template($name, array $data = []) { +function includeTemplate($name, array $data = []) { $name = 'templates/' . $name; $result = ''; @@ -152,6 +152,4 @@ function include_template($name, array $data = []) { $result = ob_get_clean(); return $result; -} - - +} \ No newline at end of file diff --git a/index.php b/index.php index 073766d..544bac2 100644 --- a/index.php +++ b/index.php @@ -1,6 +1,6 @@ Добавить лот