Skip to content

Commit

Permalink
v.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ArgonauTR committed Sep 21, 2024
1 parent f4d4f45 commit c824b06
Show file tree
Hide file tree
Showing 21 changed files with 950 additions and 66 deletions.
2 changes: 1 addition & 1 deletion admin/functions/image-delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
));

// İşlem sonucuna göre yönlendirme yapılıyor.
if ($update) {
if ($delete) {
header("Location:" . $site_name . "/admin/images.php?status=image-delete-success");
exit();
} else {
Expand Down
40 changes: 36 additions & 4 deletions admin/pages/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@
} else {
$users_pending_ready = null;
}

//JSON'dan sistem verileri alınıp karşılaştırılıyor.
// Site Json Verileri
$system_jason = file_get_contents("system/info.json");
$system_data = json_decode($system_jason, true);
// Kaynak Json Verileri
$source_jason = file_get_contents("https://sosyalseyler.com/admin/system/info.json");
$source_data = json_decode($source_jason, true);
//Version bilgisi kıyaslanıyor
$update = 0;
if ($source_data["compilation"] > $system_data["compilation"]) {
$update_pending_ready = '<span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-danger">' . $source_data["version"] . '</span>';
} else {
$update_pending_ready = null;
}
?>
<div class="col-12 col-lg-9">
<div class="row">
Expand Down Expand Up @@ -96,7 +111,7 @@
</div>
<div class="col-6 col-md-4 col-lg-3 mb-4">
<div class="card text-center">
<?php echo $contacts_draft_ready; ?>
<?php echo $contacts_draft_ready; ?>
<div class="card-body">
<h1 class="card-title"><?php echo count($contact_all); ?></h1>
<p class="card-text">Mesajlar</p>
Expand All @@ -106,17 +121,34 @@
<hr>
<div class="col-6 col-md-4 col-lg-3 mb-4">
<div class="card text-center">
<?php echo $update_pending_ready; ?>
<div class="card-body">
<h1 class="card-title">1.0</h1>
<p class="card-text">Sürüm</p>
<h1 class="card-title"><?php echo $system_data["version"]; ?></h1>
<p class="card-text">Versiyon</p>
</div>
</div>
</div>
<div class="col-6 col-md-4 col-lg-3 mb-4">
<div class="card text-center">
<div class="card-body">
<h1 class="card-title"><?php echo phpversion(); ?></h1>
<p class="card-text">PHP Version</p>
<p class="card-text">PHP</p>
</div>
</div>
</div>
<div class="col-6 col-md-4 col-lg-3 mb-4">
<div class="card text-center">
<div class="card-body">
<h1 class="card-title"><?php echo date("d/m"); ?></h1>
<p class="card-text">Tarih</p>
</div>
</div>
</div>
<div class="col-6 col-md-4 col-lg-3 mb-4">
<div class="card text-center">
<div class="card-body">
<h1 class="card-title"><?php echo date("H:i"); ?></h1>
<p class="card-text">Saat</p>
</div>
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions admin/pages/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo $site_name."/admin/posts.php"; ?>">
<a class="nav-link" href="<?php echo $site_name."/admin/posts.php?select=draft"; ?>">
<i class="bi bi-pencil-square me-1"></i>
Konular
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo $site_name."/admin/comments.php"; ?>">
<a class="nav-link" href="<?php echo $site_name."/admin/comments.php?select=draft"; ?>">
<i class="bi bi-chat-left-dots me-1"></i>
Yorumlar
</a>
Expand All @@ -60,13 +60,13 @@
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo $site_name."/admin/users.php"; ?>">
<a class="nav-link" href="<?php echo $site_name."/admin/users.php?select=pending"; ?>">
<i class="bi bi-person me-1"></i>
Üyeler
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo $site_name."/admin/contacts.php"; ?>">
<a class="nav-link" href="<?php echo $site_name."/admin/contacts.php?select=draft"; ?>">
<i class="bi bi-envelope me-1"></i>
Mesajlar
</a>
Expand Down
4 changes: 2 additions & 2 deletions admin/pages/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@
$theme = optioninfo("option_default_theme");
if ($theme == "dark") {
echo '<option value="dark" selected>Karanlık Tema</option>';
echo '<option value="light">Aydnlık Tema</option>';
echo '<option value="light">Aydınlık Tema</option>';
} else {
echo '<option value="dark">Karanlık Tema</option>';
echo '<option value="light" selected>Aydnlık Tema</option>';
echo '<option value="light" selected>Aydınlık Tema</option>';
}
?>
</select>
Expand Down
7 changes: 7 additions & 0 deletions admin/system/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "Sosyal Şeyler",
"version": "v.1.1",
"compilation": "2",
"time": "21.09.2024",
"source":"https://sosyalseyler.com/"
}
88 changes: 69 additions & 19 deletions core/alert.php
Original file line number Diff line number Diff line change
@@ -1,63 +1,113 @@
<?php
function alertcore($message, $color)
{
?>
<div class="alert <?php echo "alert-" . $color; ?> alert-dismissible fade show" role="alert">
<?php echo $message; ?>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<?php
}

function alert($alert_name)
{
$alert_name = htmlspecialchars(strip_tags($_GET["alert"]));
switch ($alert_name) {
case "nick-failed": // Kullanıcı adı hatası.
echo '<div class="alert alert-warning" role="alert">Bilgileri Kontrol Ediniz.</div>';
$message = 'Bilgileri Kontrol Ediniz.';
$color = 'success';
alertcore($message, $color);
break;
case "pass-failed": // Şifre hatası.
echo '<div class="alert alert-warning" role="alert">Bilgileri Kontrol Ediniz.</div>';
$message = 'Bilgileri Kontrol Ediniz.';
$color = 'warning';
alertcore($message, $color);
break;
case "login-success": // Başarılı giriş.
echo '<div class="alert alert-success" role="alert">Başarı ile giriş yaptınız.</div>';
$message = 'Başarı ile giriş yaptınız.';
$color = 'success';
alertcore($message, $color);
break;
case "logout": // Güvenli çıkış.
echo '<div class="alert alert-primary" role="alert">Çıkış yapılmıştır.</div>';
$message = 'Çıkış yapılmıştır.';
$color = 'primary';
alertcore($message, $color);
break;
case "no-login": // Erişim izni yok.
echo '<div class="alert alert-info" role="alert">Erişiminiz reddedildi.</div>';
$message = 'Erişiminiz reddedildi.';
$color = 'info';
alertcore($message, $color);
break;
case "post-added": // Post eklendi
echo '<div class="alert alert-success" role="alert">Postunuz başarıyla eklendi.</div>';
$message = 'Postunuz başarıyla eklendi.';
$color = 'success';
alertcore($message, $color);
break;
case "post-failed": // Post eklenemedi.
echo '<div class="alert alert-danger" role="alert">Postunuz eklenemedi..</div>';
$message = 'Postunuz eklenemedi.';
$color = 'danger';
alertcore($message, $color);
break;
case "comment-added": // Yorum eklendi.
echo '<div class="alert alert-success" role="alert">Yorumunuz başarıyla eklendi.</div>';
$message = 'Yorumunuz başarıyla eklendi.';
$color = 'success';
alertcore($message, $color);
break;
case "comment-failed": // Yorum eklenemedi.
echo '<div class="alert alert-warning" role="alert">Yorum eklenirken hata oluştu.</div>';
$message = 'Yorum eklenirken hata oluştu.';
$color = 'warning';
alertcore($message, $color);
break;
case "nick-count": // Nick çok kısa ya da uzun.
echo '<div class="alert alert-warning" role="alert">Bu isim çok kısa ya da uzun.</div>';
$message = 'Bu isim çok kısa ya da uzun.';
$color = 'warning';
alertcore($message, $color);
break;
case "password-count": // Bu parola çok uzun ya da kısa.
echo '<div class="alert alert-warning" role="alert">Bu şifre çok uzun ya da kısa.</div>';
$message = 'Bu şifre çok uzun ya da kısa.';
$color = 'warning';
alertcore($message, $color);
break;
case "nick-exist": // İsim alınmış
echo '<div class="alert alert-warning" role="alert">Bu nick daha önce alınmış.</div>';
$message = 'Bu nick daha önce alınmış.';
$color = 'warning';
alertcore($message, $color);
break;
case "mail-exist": // Mail var.
echo '<div class="alert alert-warning" role="alert">Zaten kayıtlısın. Şifreni yenile.</div>';
$message = 'Zaten kayıtlısın. Şifreni yenile.';
$color = 'warning';
alertcore($message, $color);
break;
case "registry-success": // Başarılı kayıt.
echo '<div class="alert alert-success" role="alert">Aramıza hoşgeldin.</div>';
$message = 'Aramıza hoşgeldin.';
$color = 'success';
alertcore($message, $color);
break;
case "registry-danger": // Kayıt Hatası.
echo '<div class="alert alert-warning" role="alert">Bilinmeyen bir kayıt hatası yaşandı. Lütfen daha sonra tekrar deneyin.</div>';
$message = 'Bilinmeyen bir kayıt hatası yaşandı. Lütfen daha sonra tekrar deneyin.';
$color = 'warning';
alertcore($message, $color);
break;
case "access-denied": // Yekisiz Erişim Hatası
echo '<div class="alert alert-danger" role="alert">Erişiminiz Reddedildi. Yetkiniz olmayabilir.</div>';
$message = 'Erişiminiz Reddedildi. Yetkiniz olmayabilir.';
$color = 'danger';
alertcore($message, $color);
break;
case "update-success": // Güncelleme Başarılı
echo '<div class="alert alert-success" role="alert">Güncelleme İşlemi Başarılı.</div>';
$message = 'Güncelleme İşlemi Başarılı.';
$color = 'success';
alertcore($message, $color);
break;
case "update-failed": // Güncelleme Başarısız
echo '<div class="alert alert-danger" role="alert">Güncelleme İşlemi Başarısız.</div>';
$message = 'Güncelleme İşlemi Başarısız.';
$color = 'danger';
alertcore($message, $color);
break;
case "thheme-success": // Tema değiştirildi.
$message = 'Tema değiştirildi.';
$color = 'success';
alertcore($message, $color);
break;


default: // Varsayılan bildirim.
//echo '<div class="alert alert-danger" role="alert">Eyvah! Bildirim sisteminde bir sorun oluştu.</div>';
Expand Down
2 changes: 1 addition & 1 deletion core/default-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
date_default_timezone_set('Europe/Istanbul');

// Site adı bir değişkene aktarıldı.
$site_name = "https://" . $_SERVER['HTTP_HOST'];
$site_name = "https://" . $_SERVER['HTTP_HOST'];
103 changes: 103 additions & 0 deletions core/functions/comment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<?php

// Ana fonskiyon dosyası ekleniyor.
include("../codex.php");

// Yorum ekleme işlemi yapılıyor
if (isset($_POST['new_comment'])) {

// Gelen yorumun ait olduğu konu linki.
$link = $_POST["post_link"];

//Kayıt edilecek veriler işleniyor.
$comment_content = htmlspecialchars(strip_tags($_POST["post_comment"]));
if ($_SESSION['user_role'] == "admin") {
$comment_status = "publish";
} else {
$comment_status = "draft";
}
$comment_author_id = $_SESSION["user_id"];
$comment_post_id = htmlspecialchars(strip_tags($_POST["post_id"]));
$comment_parent_id = null;
$comment_create_time = date('Y-m-d H:i:s');


$comment = $db->prepare("INSERT into comments set
comment_content=:comment_content,
comment_status=:comment_status,
comment_author_id=:comment_author_id,
comment_post_id=:comment_post_id,
comment_parent_id=:comment_parent_id,
comment_create_time=:comment_create_time
");
$insert = $comment->execute(array(
'comment_content' => $comment_content,
'comment_status' => $comment_status,
'comment_author_id' => $comment_author_id,
'comment_post_id' => $comment_post_id,
'comment_parent_id' => $comment_parent_id,
'comment_create_time' => $comment_create_time

));

if ($insert) {
header("Location:".$link."?alert=comment-added");
exit;
} else {
header("Location:".$link."?alert=comment-failed");
exit;
}
}




// Cevap ekleme işlemi yapılıyor.
if (isset($_POST['new_reply'])) {

// Gelen yorumun ait olduğu konu linki.
$link = $_POST["post_link"];
$comment_id = $_POST["comment_parent_id"];

//Kayıt edilecek veriler işleniyor.
$comment_content = htmlspecialchars(strip_tags($_POST["post_comment"]));

if ($_SESSION['user_role'] == "admin") {
$comment_status = "publish";
} else {
$comment_status = "draft";
}
$comment_author_id = $_SESSION["user_id"];
$comment_post_id = htmlspecialchars(strip_tags($_POST["post_id"]));
$comment_parent_id = $comment_id;
$comment_create_time = date('Y-m-d H:i:s');


$comment = $db->prepare("INSERT into comments set
comment_content=:comment_content,
comment_status=:comment_status,
comment_author_id=:comment_author_id,
comment_post_id=:comment_post_id,
comment_parent_id=:comment_parent_id,
comment_create_time=:comment_create_time
");
$insert = $comment->execute(array(
'comment_content' => $comment_content,
'comment_status' => $comment_status,
'comment_author_id' => $comment_author_id,
'comment_post_id' => $comment_post_id,
'comment_parent_id' => $comment_parent_id,
'comment_create_time' => $comment_create_time

));

if ($insert) {
header("Location:".$link."?alert=comment-added");
exit;
} else {
header("Location:".$link."?alert=comment-failed");
exit;
}
}
Loading

0 comments on commit c824b06

Please sign in to comment.