Skip to content

Commit e6d4e34

Browse files
Merge pull request #15 from Dominik-developer/V1.2.0->main
Update for V1.2.0
2 parents 483762f + 54b5e41 commit e6d4e34

40 files changed

+649
-182
lines changed

CHANGELOG.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,37 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
## v1.0.0 – First Release
5+
## New in v1.2.0
66

7-
### New in v1.0.0
8-
9-
The project is ready for use but is still evolving. Work is ongoing to fix bugs and address security issues.
7+
Changes since 1.1.0
108

119
### Added
1210
<!-- - Initial examples of added changelog entries. -->
11+
12+
`/root`
13+
1 - themes folder
14+
15+
`/public`
16+
1 - cookies for users,
17+
2 - tables for cookies added
18+
3 - JS folder
19+
4 - popout for cookies
20+
5 - collecting data for analytics
21+
22+
`/admin`
23+
1 - added 2 new windows: theme and analytics
24+
2 - build algo to change theme in db
1325
.....
1426

1527
### Changed
1628
<!-- - Improved existing changelog entries for consistency. -->
29+
30+
`/public`
31+
1 - structure of /public fixes
32+
33+
`/admin`
34+
1 - chagne name of setting window,function to password
35+
2 - error function
1736
.....
1837

1938
### Fixed

HOW_TO_RUN.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ CorelyPHP is a ready-to-deploy blogging platform designed for efficient web deve
88

99
Before you begin, ensure you have the following installed:
1010

11-
- PHP (>= 8.0)
12-
- MySQL (or another compatible database)
13-
- XAMPP
11+
- PHP (>= 8.2) (8.0+ also should be fine but not tested) <!--(in XAMPP/MAMP)-->
12+
- MySQL (or another compatible database) <!--(in XAMPP/MAMP)-->
13+
- XAMPP / MAMP
1414
- Git
1515

1616
## Installation
@@ -25,9 +25,9 @@ Before you begin, ensure you have the following installed:
2525
2. Set up the database:
2626

2727
- Open phpMyAdmin in your browser (`http://localhost/phpmyadmin`).
28-
- Import the SQL files located in the `sql` folder:
29-
- Create a new database by importing `database_structure.sql`
30-
- Add the `database_data.sql`
28+
- Import the SQL files located in the `SQL` folder:
29+
- Create a new database by importing `blog_DB_structure.sql`
30+
- Add the `blog_DB_data.sql`
3131

3232
3. Start the development server using XAMPP:
3333

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ All files are divided into the following sections:
1515
- **`articles_photos/`** - Holds photos for articles
1616
- **`docs/`** – Holds documentation
1717
- **`public/`** – Contains user-facing files
18+
- **`themes/`** – Contains themes for client front-end
1819

1920
This structured approach helps prevent backend modifications while rebuilding the frontend. The only challenge is the integration of PHP functions that generate HTML dynamically, but this can be adjusted when refining queries and templates.
2021

@@ -43,6 +44,6 @@ For more details on the project, check out the following files:
4344
- 🌍 **[CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md)** – Community guidelines
4445
- 🙌 **[SUPPORT.md](SUPPORT.md)** – Support for community
4546

46-
## **Current Version: v1.1.0**
47+
## **Current Version: v1.2.0**
4748

4849
The versioning system ensures clarity on stable releases. Minor patches may not require immediate updates, but always check the **CHANGELOG.md** for details on new features and fixes.

SECURITY.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
‼️ Security suggestions should be treated as invalid, not as vulnerabilities.
44

5-
## Security Policy
6-
75
* **Latest Releases:** The newest release, currently version v1.1.0, is the only version receiving active security updates. We strongly recommend using the latest version whenever possible.
86

97
* **Review Changelog for Updates:** For minor updates or changes, please refer to the changelog to understand what has been updated or fixed.
@@ -26,6 +24,7 @@
2624
| v0.1.0-beta | :negative_squared_cross_mark: |
2725
| v1.0.0 | :negative_squared_cross_mark: |
2826
| v1.1.0 | :white_check_mark: |
27+
| v1.2.0 | :white_check_mark: |
2928

3029
## Reporting a Vulnerability
3130

admin/algo/dashboard.alg.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
exit();
88
}
99

10-
function dashboard_data(): string {
10+
function dashboard_data(): void {
1111

12-
return'
12+
echo'
1313
<div id="hello">
1414
Welcome on admin panel for your blog!
1515
<br>

admin/algo/new_theme.alg.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
//new themes algo
4+
5+
// adds new themes do db
6+

admin/algo/password.alg.php

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
if ($_POST['newPass'] == $_POST['newPassAgain']) {
2222

2323
if ($conn->connect_errno!=0) {
24-
$_SESSION['message'] = 'connection to db fail';
24+
$_SESSION['message'] = 'Connection to db fail.';
2525
#echo 'Error: '.$conn->connect_error;
26-
header('Location: ../panel.php?window=settings');
26+
header('Location: ../panel.php?window=password');
2727
exit();
2828
}else{
2929

@@ -48,44 +48,46 @@
4848
$stmt = $conn->prepare($sql);
4949

5050
if (!$stmt) {
51-
die("Error during prepearing statement: " . $conn->error);
51+
$_SESSION['message'] = 'Error during prepearing statement:' . $conn->error . '.';
52+
header('Location: ../panel.php?window=password');
5253
}
5354

5455
$stmt->bind_param("si", $password_hash, $ID);
5556

5657
if ($stmt->execute()) {
5758
$_SESSION['message'] = 'Password changed successfully.';
58-
header('Location: ../panel.php?window=settings');
59-
echo $_SERVER['message'];
59+
header('Location: ../panel.php?window=password');
6060
} else {
6161
$_SESSION['message'] = 'Error: something went wrong during updating password.<br>'; //$stmt->error;
62-
echo $_SERVER['message'];
62+
header('Location: ../panel.php?window=password');
6363
}
6464

6565
$stmt->close();
6666
$conn->close();
6767

6868
} else {
69-
$_SESSION['message'] = 'Old password is wrong';
70-
header('Location: ../panel.php?window=settings');
69+
$_SESSION['message'] = 'Old password is wrong.';
70+
header('Location: ../panel.php?window=password');
7171
}
7272

7373
} else {
74-
$_SESSION['message'] = 'more rows found than needed';
75-
header('Location: ../panel.php?window=settings');
74+
$_SESSION['message'] = 'More rows found than needed.';
75+
header('Location: ../panel.php?window=password');
7676
}
7777
}
7878
$conn->close();
79+
$_SESSION['message'] = 'Error fetching data.';
80+
header('Location: ../panel.php?window=password');
7981
exit();
8082
}
8183
} else {
82-
$_SESSION['message'] = 'new password different than one written again ';
83-
header('Location: ../panel.php?window=settings');
84+
$_SESSION['message'] = 'New password different than one written again.';
85+
header('Location: ../panel.php?window=password');
8486
exit();
8587
}
8688

8789
} else {
88-
$_SESSION['message'] = 'POST table doesnt have all data';
89-
header('Location: panel.php?window=settings');
90+
$_SESSION['message'] = 'POST table doesnt have all data.';
91+
header('Location: panel.php?window=password');
9092
exit();
9193
}

admin/algo/service_status.alg.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
$conn = @new mysqli($host, $db_user, $db_password, $db_name);
1818

1919
if ($conn->connect_errno!=0) {
20-
$_SESSION['message'] = 'connection do db fail';
20+
$_SESSION['message'] = 'Connection do db fail.';
2121
header('Location: ../panel.php?window=service-break');
2222
exit();
2323
}
@@ -33,15 +33,19 @@
3333
if ($stmt->execute()) {
3434
if ($stmt->affected_rows > 0) {
3535
$_SESSION['message'] = 'Service status value changed successfully.';
36+
header('Location: ../panel.php?window=service-break');
3637
} else {
3738
$_SESSION['message'] = 'Error during updating: row ID error.<!--No rows updated, check the ID.-->';
39+
header('Location: ../panel.php?window=service-break');
3840
}
3941
} else {
4042
$_SESSION['message'] = 'Something went wrong during updating status.';
43+
header('Location: ../panel.php?window=service-break');
4144
}
4245
$stmt->close();
4346
} else {
4447
$_SESSION['message'] = 'Failed to prepare the SQL statement.';
48+
header('Location: ../panel.php?window=service-break');
4549
}
4650

4751
} else {

admin/algo/theme.alg.php

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
if (session_status() == PHP_SESSION_NONE) {
6+
session_start();
7+
}
8+
9+
if(!isset ($_SESSION['adminLoged']))
10+
{
11+
header('Location: ../panel.login.php');
12+
exit();
13+
}
14+
15+
function updateUserTheme($newTheme): void {
16+
17+
require '../panel.connect.php';
18+
19+
$conn = new mysqli($host, $db_user, $db_password, $db_name);
20+
21+
if ($conn->connect_errno) {
22+
$_SESSION['message'] = 'Connection failed: '.$conn->connect_error;
23+
header('Location: ../panel.php?window=themes');
24+
exit();
25+
}
26+
27+
$query = "UPDATE `settings` SET `value` = ? WHERE `name` = 'active_theme'";
28+
29+
$stmt = $conn->prepare($query);
30+
if (!$stmt) {
31+
$_SESSION['message'] = 'Error prep query: '.$conn->error;
32+
header('Location: ../panel.php?window=themes');
33+
exit();
34+
}
35+
36+
$stmt->bind_param("s", $newTheme);
37+
if (!$stmt->execute()) {
38+
$_SESSION['message'] = 'Error during query: '.$stmt->error;
39+
header('Location: ../panel.php?window=themes');
40+
exit();
41+
}
42+
43+
$stmt->close();
44+
$conn->close();
45+
}
46+
47+
include dirname(__DIR__, 2) . '/themes/handlers/index.php';
48+
49+
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['theme'])) {
50+
$newTheme = $_POST['theme'];
51+
52+
if (in_array($newTheme, getAvailableThemes())) {
53+
54+
updateUserTheme($newTheme);
55+
56+
$_SESSION['message'] = 'Theme changed to: '.htmlspecialchars($newTheme);
57+
header('Location: ../panel.php?window=themes');
58+
exit();
59+
} else {
60+
$_SESSION['message'] = 'Invalid theme!';
61+
header('Location: ../panel.php?window=themes');
62+
exit();
63+
}
64+
}

admin/panel.connect.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
$host = "localhost";
44
$db_user = "root";
5-
$db_password ="";
5+
$db_password ="root";
66
$db_name = "blog";
77

88

0 commit comments

Comments
 (0)