Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/ISSUE_TEMPLATE/SUPPORT.md
Original file line number Diff line number Diff line change
@@ -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.
<!-- - Open issue with label **'support'** in the last resort.-->
<!-- - Join our community (if applicable) on Discord, Slack, or forums *(Link to be added if available)*. -->

## 🐞 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.

<!-- 1. Check the **[issue tracker](https://github.com/Dominik-developer/CorelyPHP/issues)** to see if it has already been reported.
2. Open a new issue and include:
- A clear description of the problem.
- Steps to reproduce the issue.
- Expected behavior and actual behavior.
- Any relevant error messages or logs.
-->
## ✉️ Contact

<!--For specific inquiries or security concerns, please contact us at: **[your-email@example.com](mailto\:your-email@example.com)** *(Update with the correct email)*. -->
For now create issue, tag @Dominik-developer and add **'support'** label.

Thank you for contributing to CorelyPHP! 🚀
54 changes: 54 additions & 0 deletions HOW_TO_RUN.md
Original file line number Diff line number Diff line change
@@ -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.

<!-- ## 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.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
18 changes: 10 additions & 8 deletions admin/algo/edit.alg.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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++;
}

Expand Down
4 changes: 4 additions & 0 deletions admin/algo/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php // Secruity

header('Location: ../panel.login.php');
exit();
7 changes: 3 additions & 4 deletions admin/algo/new.alg.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
if ($conn->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 {

Expand All @@ -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;
Expand All @@ -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++;
}
Expand All @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions admin/all_articles.alg.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ function all() {
echo '<td>' . $row['date_of_publish'] . '</td>';
echo '<td>' . substr($row['text'], 0, 50) . '...</td>';
echo '<td>' . $row['photo_path'] . '</td>';
echo '<td><a class="custom-button green" href="http://localhost/server/panel_new/public/single.php?title='.$row['title'].'" target="_blank">View</a></td>';
echo '<td><a class="custom-button orange" href="http://localhost/server/panel_new/admin/panel.php?window=edit-article&id='.$row['ID'].'">Edit</a></td>';
echo '<td><a class="custom-button green" href="../public/single.php?title='.$row['title'].'" target="_blank">View</a></td>';
echo '<td><a class="custom-button orange" href="panel.php?window=edit-article&id='.$row['ID'].'">Edit</a></td>';
echo '</tr>';
}
echo '</tbody>';
Expand Down
4 changes: 4 additions & 0 deletions articles_photos/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php // Secruity

header('Location: ../public/index.php');
exit();
23 changes: 15 additions & 8 deletions public/single.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

main{
main {
text-align: center;
box-sizing: border-box;
}
section#main{
section#main {
display: inline-block;
text-align: center;
}
Expand All @@ -20,7 +20,7 @@ article {
}
}

article header{
article header {
height: 50px;
font-size: 40px;
border-radius: 8px;
Expand All @@ -29,14 +29,14 @@ article header{
margin: 0;
}

article div#photo{
article div#photo {
/*max-width: 1000px;*/
padding: 10px;
position: relative;
transition: transform 0.3s ease, z-index 0s;
}

article img{
article img {
width: 250px;
min-height: 150px;
border-radius: 8px !important;
Expand All @@ -51,7 +51,7 @@ article img:hover {
}
*/

article p{
article p {
/*max-width: 1000px;*/
text-align: justify;
padding-left: 10px;
Expand All @@ -62,15 +62,22 @@ article p{
line-height: 1.8;
}

article footer{
article footer {
/*max-width: 1000px;*/
background-color: #fff;
color: #121212;
border-radius: 8px;
text-align: left;
align-items: normal;
padding-left: 20px;
max-height: 40px;
height: 35px;
box-sizing: border-box;
margin-top: 5px;
}

@media screen and (max-width: 440px) {

article footer {
min-height: 70px;
}
}