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! 🚀 diff --git a/HOW_TO_RUN.md b/HOW_TO_RUN.md new file mode 100644 index 0000000..fece01d --- /dev/null +++ b/HOW_TO_RUN.md @@ -0,0 +1,54 @@ + +# CorelyPHP + +## Introduction +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 + +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). + - Import the SQL files located in the `sql` folder: + - Create a new database by importing `database_structure.sql` + - Add the `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 folder in your browser: `http://localhost/CorelyPHP`: + - For user: `http://localhost/CorelyPHP/public` + - For admin: `http://localhost/CorelyPHP/admin` + +6. To log into Admin panel use **`Admin`** for login and **`pass`** for password. + + + +## 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. diff --git a/README.md b/README.md index efe7460..836527d 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 @@ -40,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. 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 '