From 970130284841870ea85fb6d816e7b5c4d19977ac Mon Sep 17 00:00:00 2001 From: Dominik <163560221+Dominik-developer@users.noreply.github.com> Date: Fri, 14 Feb 2025 22:01:01 +0100 Subject: [PATCH 1/7] update for v1.1.0 --- admin/algo/edit.alg.php | 18 ++++++++++-------- admin/algo/index.php | 4 ++++ admin/algo/new.alg.php | 7 +++---- admin/all_articles.alg.php | 4 ++-- articles_photos/index.php | 4 ++++ public/single.css | 23 +++++++++++++++-------- 6 files changed, 38 insertions(+), 22 deletions(-) create mode 100644 admin/algo/index.php create mode 100644 articles_photos/index.php diff --git a/admin/algo/edit.alg.php b/admin/algo/edit.alg.php index 76fdd24..ca6834e 100644 --- a/admin/algo/edit.alg.php +++ b/admin/algo/edit.alg.php @@ -27,8 +27,8 @@ exit(); } - $NEW_title = mysqli_real_escape_string($conn, $_POST['new_title'] ?? ''); - $NEW_text = mysqli_real_escape_string($conn, $_POST['new_text'] ?? ''); + $NEW_title = $_POST['new_title'] ?? ''; //$NEW_title = mysqli_real_escape_string($conn, $_POST['new_title'] ?? ''); + $NEW_text = $_POST['new_text'] ?? ''; //$NEW_text = mysqli_real_escape_string($conn, $_POST['new_text'] ?? ''); $NEW_photo = $_FILES['new_photo'] ?? ''; // Validate required fields @@ -63,14 +63,13 @@ // If a new photo is submitted if(!empty($_FILES['new_photo']['name'])) { - // Remove the old photo if a new one is being uploaded - #=========usuwanie=strego=zdjecia===== + #========= Remove the old photo if a new one is being uploaded ===== /** * check in db what way i have path for photos saved and fix it in case it is the other way */ - if (!empty($existing_photo) && file_exists('/Applications/XAMPP/xamppfiles/htdocs/server/panel_new/' . $existing_photo)) { - unlink('/Applications/XAMPP/xamppfiles/htdocs/server/panel_new/' . $existing_photo); + if (!empty($existing_photo) && file_exists(dirname(__DIR__, 2) .'/'. $existing_photo)) { + unlink(dirname(__DIR__, 2) .'/'. $existing_photo); } // Check for upload errors @@ -123,13 +122,16 @@ $pathinfo = pathinfo($_FILES["new_photo"]["name"]); $base = preg_replace("/[^\w-]/", "_", $pathinfo["filename"]); $filename = $base . "." . $pathinfo["extension"]; - $destination = "/Applications/XAMPP/xamppfiles/htdocs/server/panel_new/articles_photos/" . $filename; + + $destination = dirname(__DIR__, 2) . "/articles_photos/" . $filename; // Add a numeric suffix if file exists $i = 1; while (file_exists($destination)) { $filename = $base . "($i)." . $pathinfo["extension"]; - $destination = "/Applications/XAMPP/xamppfiles/htdocs/server/panel_new/articles_photos/" . $filename; + + $destination = dirname(__DIR__, 2) . "/articles_photos/" . $filename; + $i++; } diff --git a/admin/algo/index.php b/admin/algo/index.php new file mode 100644 index 0000000..27ae55a --- /dev/null +++ b/admin/algo/index.php @@ -0,0 +1,4 @@ +connect_errno != 0) { $_SESSION['message'] = 'db connection fail.'; header('Location: ../panel.php?window=add-article'); - #echo "Error: " . $conn->connect_error; #throw new Exception(mysqli_connect_errno()); } else { @@ -96,7 +95,7 @@ $filename = $base . "." . $pathinfo["extension"]; - $destination = "/Applications/XAMPP/xamppfiles/htdocs/server/panel_new/articles_photos/" . $filename; + $destination = dirname(__DIR__, 2) . "/articles_photos/" . $filename; // Add a numeric suffix if the file already exists $i = 1; @@ -105,7 +104,7 @@ $filename = $base . "($i)." . $pathinfo["extension"]; - $destination = "/Applications/XAMPP/xamppfiles/htdocs/server/panel_new/articles_photos/".$filename; + $destination = dirname(__DIR__, 2) . "/articles_photos/" . $filename; $i++; } @@ -126,7 +125,7 @@ if ($stmt_insert->execute()) { $_SESSION['message'] = 'Article was succesfully addes to db.'; - header('Location: ../panel.php?window=add-article'); + header('Location: ../panel.php?window=all-articles'); } else { $_SESSION['message'] = 'Error during adding data to db.'; header('Location: ../panel.php?window=add-article'); diff --git a/admin/all_articles.alg.php b/admin/all_articles.alg.php index 3f741b2..3f8172c 100644 --- a/admin/all_articles.alg.php +++ b/admin/all_articles.alg.php @@ -35,8 +35,8 @@ function all() { echo '' . $row['date_of_publish'] . ''; echo '' . substr($row['text'], 0, 50) . '...'; echo '' . $row['photo_path'] . ''; - echo 'View'; - echo 'Edit'; + echo 'View'; + echo 'Edit'; echo ''; } echo ''; diff --git a/articles_photos/index.php b/articles_photos/index.php new file mode 100644 index 0000000..0200e65 --- /dev/null +++ b/articles_photos/index.php @@ -0,0 +1,4 @@ + Date: Fri, 14 Feb 2025 22:30:28 +0100 Subject: [PATCH 2/7] add how to run md --- HOW_TO_RUN.md | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 HOW_TO_RUN.md diff --git a/HOW_TO_RUN.md b/HOW_TO_RUN.md new file mode 100644 index 0000000..dcd9b37 --- /dev/null +++ b/HOW_TO_RUN.md @@ -0,0 +1,52 @@ + +# CorelyPHP + +## Introduction + +CorelyPHP is a PHP-based framework designed for efficient web development. This guide provides instructions on how to set up and run the project on your local machine. + +## Prerequisites + +Before you begin, ensure you have the following installed: + +- PHP (>= 8.0) +- MySQL (or another compatible database) +- XAMPP +- Git + +## Installation + +1. Clone the repository: + + ```bash + git clone https://github.com/your-username/CorelyPHP.git + cd CorelyPHP + ``` + +2. Set up the database: + + - Open phpMyAdmin in your browser (http://localhost/phpmyadmin). + - Create a new database. + - Import the SQL files located in the `sql` folder: + - `database_structure.sql` + - `database_data.sql` + +3. Start the development server using XAMPP: + + - Open XAMPP Control Panel. + - Start Apache and MySQL. + - Place the repository in the `htdocs` folder inside the XAMPP directory. + +4. Access the project in your browser: `http://localhost/CorelyPHP`. + +## Usage + +Once the server is running, visit `http://localhost/CorelyPHP` in your browser to access the application. + +## Contributing + +If you'd like to contribute, please fork the repository and submit a pull request. + +## License + +This project is licensed under the MIT License. \ No newline at end of file From b2854f78b5b1c96864f7de21a33b2192af965c2f Mon Sep 17 00:00:00 2001 From: Dominik <163560221+Dominik-developer@users.noreply.github.com> Date: Sat, 15 Feb 2025 11:47:43 +0100 Subject: [PATCH 3/7] Update README.md Signed-off-by: Dominik <163560221+Dominik-developer@users.noreply.github.com> --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index efe7460..0abae55 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,8 @@ This project is built using: All files are divided into the following sections: -- **`admin/`** – Contains all admin-side files +- **`admin/`** – Contains all admin-side files +- **`articles_photos/`** - Holds photos for articles - **`docs/`** – Holds documentation - **`public/`** – Contains user-facing files From 2c0370f31ffba4f90c3f511cafa930a59e5cb841 Mon Sep 17 00:00:00 2001 From: Dominik <163560221+Dominik-developer@users.noreply.github.com> Date: Sat, 15 Feb 2025 23:42:35 +0100 Subject: [PATCH 4/7] Update HOW_TO_RUN.md Signed-off-by: Dominik <163560221+Dominik-developer@users.noreply.github.com> --- HOW_TO_RUN.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/HOW_TO_RUN.md b/HOW_TO_RUN.md index dcd9b37..d83691f 100644 --- a/HOW_TO_RUN.md +++ b/HOW_TO_RUN.md @@ -2,8 +2,7 @@ # CorelyPHP ## Introduction - -CorelyPHP is a PHP-based framework designed for efficient web development. This guide provides instructions on how to set up and run the project on your local machine. +CorelyPHP is a ready-to-deploy blogging platform designed for efficient web development. This guide provides instructions on how to set up and run the project on your local machine. ## Prerequisites @@ -26,10 +25,9 @@ Before you begin, ensure you have the following installed: 2. Set up the database: - Open phpMyAdmin in your browser (http://localhost/phpmyadmin). - - Create a new database. - Import the SQL files located in the `sql` folder: - - `database_structure.sql` - - `database_data.sql` + - Create a new database by importing `database_structure.sql` + - Add ne`database_data.sql` 3. Start the development server using XAMPP: @@ -49,4 +47,4 @@ If you'd like to contribute, please fork the repository and submit a pull reques ## License -This project is licensed under the MIT License. \ No newline at end of file +This project is licensed under the MIT License. From 4ec9698945229472f3975a2b80e2c082379dd70d Mon Sep 17 00:00:00 2001 From: Dominik <163560221+Dominik-developer@users.noreply.github.com> Date: Fri, 21 Feb 2025 17:49:02 +0100 Subject: [PATCH 5/7] Update README.md for v1.1.0 Signed-off-by: Dominik <163560221+Dominik-developer@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0abae55..836527d 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,6 @@ For more details on the project, check out the following files: - 🔐 **[SECURITY.md](SECURITY.md)** – Security policies and vulnerability reporting - 🌍 **[CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md)** – Community guidelines -## **Current Version: v1.0.0** +## **Current Version: v1.1.0** 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. From 2c7a7fee3c17305c22e06afb71aa555210a43096 Mon Sep 17 00:00:00 2001 From: Dominik <163560221+Dominik-developer@users.noreply.github.com> Date: Sat, 22 Feb 2025 21:36:18 +0100 Subject: [PATCH 6/7] Create SUPPORT.md Signed-off-by: Dominik <163560221+Dominik-developer@users.noreply.github.com> --- .github/ISSUE_TEMPLATE/SUPPORT.md | 42 +++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/SUPPORT.md diff --git a/.github/ISSUE_TEMPLATE/SUPPORT.md b/.github/ISSUE_TEMPLATE/SUPPORT.md new file mode 100644 index 0000000..75d4f09 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/SUPPORT.md @@ -0,0 +1,42 @@ +# Support + +Thank you for using CorelyPHP! If you need help or have any questions, please check the available support options below. + +## ▶️ How to use + +If you don't know how to run this project visit [HOW_TO_RUN.md](https://github.com/Dominik-developer/CorelyPHP/blob/v1.1.0/HOW_TO_RUN.md) and there you will find simple instructions on how to run it locally. + + +## 📖 Documentation + +Before opening a support request, please check our documentation: + +- [CorelyPHP Documentation](https://github.com/Dominik-developer/CorelyPHP/blob/v1.1.0/docs/documentation.txt) **(In progress)** + +## 💬 Community Support + +If you need general help or want to discuss CorelyPHP with other users, feel free to: + +- Open a discussion in the **Discussions** tab on GitHub. + + + +## 🐞 Reporting Issues + +If you encounter a bug or have a feature request, please: + +- Open [CONTRIBUTING.md](https://github.com/Dominik-developer/CorelyPHP/blob/main/CONTRIBUTING.md) and follow the instructions given there. + + +## ✉️ Contact + + +For now create issue, tag @Dominik-developer and add **'support'** label. + +Thank you for contributing to CorelyPHP! 🚀 From af0896d3edf9dbcacedabb78643e2f7c5607455f Mon Sep 17 00:00:00 2001 From: Dominik <163560221+Dominik-developer@users.noreply.github.com> Date: Sat, 22 Feb 2025 21:42:36 +0100 Subject: [PATCH 7/7] Update HOW_TO_RUN.md Signed-off-by: Dominik <163560221+Dominik-developer@users.noreply.github.com> --- HOW_TO_RUN.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/HOW_TO_RUN.md b/HOW_TO_RUN.md index d83691f..fece01d 100644 --- a/HOW_TO_RUN.md +++ b/HOW_TO_RUN.md @@ -27,7 +27,7 @@ Before you begin, ensure you have the following installed: - Open phpMyAdmin in your browser (http://localhost/phpmyadmin). - Import the SQL files located in the `sql` folder: - Create a new database by importing `database_structure.sql` - - Add ne`database_data.sql` + - Add the `database_data.sql` 3. Start the development server using XAMPP: @@ -35,11 +35,15 @@ Before you begin, ensure you have the following installed: - Start Apache and MySQL. - Place the repository in the `htdocs` folder inside the XAMPP directory. -4. Access the project in your browser: `http://localhost/CorelyPHP`. +4. Access the project folder in your browser: `http://localhost/CorelyPHP`: + - For user: `http://localhost/CorelyPHP/public` + - For admin: `http://localhost/CorelyPHP/admin` -## Usage +6. To log into Admin panel use **`Admin`** for login and **`pass`** for password. -Once the server is running, visit `http://localhost/CorelyPHP` in your browser to access the application. + ## Contributing