Initial commit: open-source release of atakanozban.com

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-08 13:24:21 +02:00
commit 0ccbef45a1
149 changed files with 90137 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
using System.ComponentModel.DataAnnotations;
using System.Web;
namespace atakanozbancom.Models.classes
{
public class AdminAffiliateLinkVM
{
public int id { get; set; }
[Display(Name = "Title (EN)")]
[Required(ErrorMessage = "Title is required.")]
[StringLength(200)]
public string TitleEN { get; set; }
[Display(Name = "Description (EN)")]
[StringLength(500)]
public string DescEN { get; set; }
[Display(Name = "Title (TR)")]
[StringLength(200)]
public string TitleTR { get; set; }
[Display(Name = "Description (TR)")]
[StringLength(500)]
public string DescTR { get; set; }
[Display(Name = "URL")]
[Required(ErrorMessage = "URL is required.")]
[StringLength(1000)]
public string url { get; set; }
[Display(Name = "Sort Order")]
public int sort_order { get; set; }
public string existingImage { get; set; }
public HttpPostedFileBase logoFile { get; set; }
}
}
+15
View File
@@ -0,0 +1,15 @@
using System.Collections.Generic;
namespace atakanozbancom.Models.classes
{
public class AdminMyProjectsEditVM
{
public int id { get; set; }
public string TitleTR { get; set; }
public string TitleEN { get; set; }
public string DescTR { get; set; }
public string DescEN { get; set; }
public List<projectmedia> medias { get; set; } = new List<projectmedia>();
}
}
+22
View File
@@ -0,0 +1,22 @@
using System.ComponentModel.DataAnnotations;
namespace atakanozbancom.Models.classes
{
public class AdminSocialIconVM
{
public int id { get; set; }
[Display(Name = "Icon (Font Awesome class)")]
[Required(ErrorMessage = "Icon class is required.")]
[StringLength(100)]
public string icon { get; set; }
[Display(Name = "URL")]
[Required(ErrorMessage = "URL is required.")]
[StringLength(500)]
public string url { get; set; }
[Display(Name = "Sort Order")]
public int sort_order { get; set; }
}
}
+11
View File
@@ -0,0 +1,11 @@
namespace atakanozbancom.Models.classes
{
public class AffiliateLinkVM
{
public int id { get; set; }
public string title { get; set; }
public string description { get; set; }
public string url { get; set; }
public string image { get; set; }
}
}
+23
View File
@@ -0,0 +1,23 @@
using System.Data.Entity;
namespace atakanozbancom.Models.classes
{
public class Context : DbContext
{
public Context() : base("Context")
{
// Fixes MODELDB uncompaciable:
Database.SetInitializer<Context>(null);
}
public DbSet<admin> admins { get; set; }
public DbSet<myprojects> MyProjects { get; set; }
public DbSet<myprojectstranslation> myprojectstranslations { get; set; }
public DbSet<projectmedia> projectmedia { get; set; }
public DbSet<affiliatelink> AffiliateLinks { get; set; }
public DbSet<affiliatelinktranslation> affiliatelinktranslations { get; set; }
public DbSet<socialicon> SocialIcons { get; set; }
public DbSet<sitesetting> SiteSettings { get; set; }
}
}
+33
View File
@@ -0,0 +1,33 @@
using System.Text.RegularExpressions;
using System.Web;
namespace atakanozbancom.Models.classes
{
public static class DescriptionFormatter
{
private static readonly Regex LinkPattern = new Regex(
@"\[([^\]\r\n]{1,200})\]\((https?://[^\s)]{1,2000})\)",
RegexOptions.Compiled | RegexOptions.IgnoreCase);
public static string ToSafeHtml(string raw)
{
if (string.IsNullOrWhiteSpace(raw))
return string.Empty;
var encoded = HttpUtility.HtmlEncode(raw);
var withLinks = LinkPattern.Replace(encoded, m =>
{
var label = m.Groups[1].Value;
var url = m.Groups[2].Value;
return $"<a href=\"{url}\" class=\"text-secondary text-decoration-none\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">{label}</a>";
});
var withBreaks = withLinks
.Replace("\r\n", "\n")
.Replace("\n", "<br />");
return withBreaks;
}
}
}
+55
View File
@@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Web;
namespace atakanozbancom
{
public class LanguageTR
{
public static List<Languages> AvailableLanguages = new List<Languages>
{
new Languages { LanguageFullName = "English", LanguageCultureName = "en-US" },
new Languages { LanguageFullName = "Turkish", LanguageCultureName = "tr-TR" }
};
public static bool IsLanguageAvailable(string lang)
{
return AvailableLanguages.Any(a => a.LanguageCultureName.Equals(lang, StringComparison.OrdinalIgnoreCase));
}
public static string GetDefaultLanguage()
{
return AvailableLanguages[0].LanguageCultureName;
}
public void SetLanguage(string lang)
{
try
{
if (!IsLanguageAvailable(lang))
lang = GetDefaultLanguage();
var cultureInfo = new CultureInfo(lang);
Thread.CurrentThread.CurrentUICulture = cultureInfo;
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(cultureInfo.Name);
HttpCookie langCookie = new HttpCookie("culture", lang)
{
Expires = DateTime.Now.AddYears(1),
HttpOnly = true
};
HttpContext.Current.Response.Cookies.Add(langCookie);
}
catch (Exception) { }
}
}
public class Languages
{
public string LanguageFullName { get; set; }
public string LanguageCultureName { get; set; }
}
}
+26
View File
@@ -0,0 +1,26 @@
using System.Collections.Generic;
using System.Web.Mvc;
namespace atakanozbancom.Models.classes
{
public class MyProjectsVM
{
public int id { get; set; }
public string title { get; set; }
[AllowHtml]
public string description { get; set; }
// legacy (şimdilik kalsın)
public string image { get; set; }
public string iframe { get; set; }
public List<ProjectMediaVM> medias { get; set; } = new List<ProjectMediaVM>();
}
public class ProjectMediaVM
{
public string type { get; set; }
public string url { get; set; }
public int order { get; set; }
}
}
+14
View File
@@ -0,0 +1,14 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace atakanozbancom.Models.classes
{
public class admin
{
[Key]
public int id { get; set; }
public string username { get; set; }
public string password { get; set; }
public List<myprojects> MyProjects { get; set; }
}
}
+34
View File
@@ -0,0 +1,34 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace atakanozbancom.Models.classes
{
[Table("affiliatelinks")]
public class affiliatelink
{
[Key]
public int id { get; set; }
[Required, StringLength(500)]
[Column("image")]
public string image { get; set; }
[Required, StringLength(200)]
[Column("title")]
public string title { get; set; }
[StringLength(500)]
[Column("description")]
public string description { get; set; }
[Required, StringLength(1000)]
[Column("url")]
public string url { get; set; }
[Column("sortorder")]
public int sort_order { get; set; } = 0;
public virtual ICollection<affiliatelinktranslation> Translations { get; set; }
}
}
@@ -0,0 +1,25 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace atakanozbancom.Models.classes
{
[Table("affiliatelinktranslations")]
public class affiliatelinktranslation
{
public int id { get; set; }
[Required]
public int affiliatelink_id { get; set; }
[Required, StringLength(10)]
public string culture { get; set; }
[StringLength(255)]
public string title { get; set; }
public string description { get; set; }
[ForeignKey("affiliatelink_id")]
public virtual affiliatelink AffiliateLink { get; set; }
}
}
+20
View File
@@ -0,0 +1,20 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
namespace atakanozbancom.Models.classes
{
public class myprojects
{
[Key]
public int id { get; set; }
public string image { get; set; }
public string iframe { get; set; }
public string title { get; set; }
[AllowHtml]
public string description { get; set; }
public object admins { get; internal set; }
public virtual ICollection<myprojectstranslation> Translations { get; set; }
}
}
+25
View File
@@ -0,0 +1,25 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace atakanozbancom.Models.classes
{
[Table("myprojectstranslations")]
public class myprojectstranslation
{
public int id { get; set; }
[Required]
public int project_id { get; set; }
[Required, StringLength(10)]
public string culture { get; set; }
[StringLength(255)]
public string title { get; set; }
public string description { get; set; }
[ForeignKey("project_id")]
public virtual myprojects Project { get; set; }
}
}
+39
View File
@@ -0,0 +1,39 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace atakanozbancom.Models.classes
{
public enum MediaType
{
Image = 1,
Iframe = 2,
// Video = 0,
//Document = 3
}
[Table("projectmedia")]
public class projectmedia
{
[Key]
public int id { get; set; }
[Column("projectid")]
public int project_id { get; set; }
[ForeignKey(nameof(project_id))]
public virtual myprojects Project { get; set; }
[Column("mediatype")]
public MediaType media_type { get; set; }
[Required, StringLength(1000)]
[Column("mediaurl")]
public string url { get; set; }
[Column("sortorder")]
public int sort_order { get; set; } = 0;
// DB'de bu kolon yok → modelden kaldırıyoruz
// public string title { get; set; }
}
}
+16
View File
@@ -0,0 +1,16 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace atakanozbancom.Models.classes
{
[Table("sitesettings")]
public class sitesetting
{
[Key]
public int id { get; set; }
[StringLength(500)]
[Column("wallpaper")]
public string wallpaper { get; set; }
}
}
+23
View File
@@ -0,0 +1,23 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace atakanozbancom.Models.classes
{
[Table("socialicons")]
public class socialicon
{
[Key]
public int id { get; set; }
[Required, StringLength(100)]
[Column("icon")]
public string icon { get; set; }
[Required, StringLength(500)]
[Column("url")]
public string url { get; set; }
[Column("sortorder")]
public int sort_order { get; set; } = 0;
}
}