UML of the Sadra University Websiteنمودارهای UML سایت دانشگاه صدرا

Full system documentation, bilingual (Persian / English) مستندات کامل سیستم به دو زبان (فارسی / انگلیسی)

1. Overview۱. نمای کلی

سایت دانشگاه صدرا یک برنامهٔ PHP با ساختار لایه‌ای (Router ← Middleware ← Controller ← Model ← Database و View) است. بخش فارسی در مسیر اصلی / و بخش انگلیسی زیر مسیر /english قرار دارد. مدیریت محتوا در /admin و پورتال استادان در /teacher است.

داده‌ها در MySQL ذخیره می‌شوند. محتوای انگلیسی در جدول‌های جدا با پیشوند english_ نگهداری می‌شود و از مدل‌ها و کنترلرهای جدای خودش استفاده می‌کند.

The Sadra University website is a layered PHP application (Router, Middleware, Controller, Model, Database and View). The Persian site lives at the root path /, and the English site lives under /english. Content administration is at /admin and the staff portal is at /teacher.

Data is stored in MySQL. English content has its own tables with the english_ prefix and its own models and controllers.

31Controllers / کنترلر
25Models / مدل
196Route definitions / تعریف مسیر
24Tables in final SQL / جدول در SQL نهایی
4Staff roles / نقش کارکنان

2. Architecture (Component / Package view)۲. معماری (نمای مؤلفه و بسته)

هر درخواست از یک نقطهٔ ورود واحد (index.php) عبور می‌کند. مسیریاب (Router) درخواست را به میان‌افزار (Middleware) و سپس به کنترلر می‌فرستد. کنترلر از مدل‌ها برای داده و از View برای تولید HTML استفاده می‌کند. سرویس‌های هسته (Core) امنیت، نشست، فایل و محتوا را پوشش می‌دهند.

Every request enters through one front controller (index.php). The Router passes it to middleware and then to a controller. The controller uses models for data and views to build HTML. Core services handle security, sessions, files and content rendering.

flowchart TB
  B["Browser (Visitor / Staff)"] --> IDX["index.php - Front controller"]
  IDX --> CFG["config/app.php, config/database.php, .env"]
  IDX --> RT["Router - routes/web.php"]
  RT --> MW["Middleware: RequireAuth, RequireRole"]
  MW --> CT["Controllers (about 31)"]
  CT --> MD["Models (about 25)"]
  MD --> DB[("MySQL - Database wrapper")]
  CT --> VW["Views - PHP templates"]
  VW --> LY["Layouts: app, admin, english, teacher"]
  CT --> CORE["Core services"]
  CT --> SVC["Services: SiteBackup, VisitorCounter, PersonPhotoStorage"]
  subgraph CORE_GROUP["Core"]
    CSRF["Csrf"]
    SES["Session"]
    LT["LoginThrottle"]
    STO["Storage / ImageAssets"]
    MK["Markdown"]
    HS["HtmlSanitizer"]
    CR["ContentRenderer"]
    RA["RequestAudit + AuditLog"]
    EH["ErrorHandler + LogRedactor"]
  end
  CORE --> CORE_GROUP
Figure 2.1 - Component view. Source: index.php, routes/web.php, app/Core, app/Services. شکل ۲.۱ - نمای مؤلفه‌ها. منبع: index.php، routes/web.php، app/Core و app/Services.

3. Use cases and roles۳. موارد کاربرد و نقش‌ها

بازدیدکنندگان بدون ورود، محتوای عمومی را می‌بینند. کارکنان با نقش‌های مختلف به بخش‌های مدیریتی دسترسی دارند. گروه‌های میان‌افزار مشخص می‌کنند هر نقش به کدام مسیرها دسترسی دارد.

Anonymous visitors see public content. Staff accounts access admin areas depending on their role. Middleware groups define which roles can reach which routes.

flowchart LR
  VIS(["Visitor"]) --> UC1["Browse pages, programs, faculties"]
  VIS --> UC2["Read announcements and documents"]
  VIS --> UC3["Search the site"]
  VIS --> UC4["Switch Persian / English"]
  VIS --> UC5["View people and research centers"]
  TCH(["Teacher"]) --> UC6["Login and dashboard"]
  TCH --> UC7["Edit own profile and password"]
  EDT(["Editor"]) --> UC8["Manage pages, announcements, documents"]
  EDT --> UC9["Manage media, slides, services"]
  EDT --> UC10["Manage faculties, programs, research centers, people"]
  ADM(["Admin"]) --> UC8
  ADM --> UC9
  ADM --> UC10
  ADM --> UC11["Manage users and linking to people"]
  SUP(["Super Admin"]) --> UC11
  SUP --> UC12["Data export, import, domain change, safety backups"]
  SUP --> UC13["Audit logs and site settings"]
Role / Middleware groupنقش / گروه میان‌افزار Allowed rolesنقش‌های مجاز Typical accessدسترسی معمول
$teacherMiddleware - Teacher portalپورتال استاد Any authenticated account (RequireAuth) Teacher dashboard, own profile, password changeداشبورد استاد، پروفایل و تغییر رمز
$contentAdminMiddleware - Content adminمدیریت محتوا super_admin, admin, editor Most of /admin: pages, announcements, documents, media, slides, programs, peopleبیشتر بخش /admin: صفحات، اطلاعیه‌ها، اسناد، رسانه، اسلاید، برنامه‌ها و افراد
$userAdminMiddleware - User adminمدیریت کاربران super_admin, admin User accounts and their links to peopleحساب‌های کاربری و پیوند آن‌ها با افراد
$superAdminMiddleware - Super adminابرمدیر super_admin Data transfer, logs, sensitive settingsانتقال داده، گزارش‌ها، تنظیمات حساس

4. Request sequence (public page)۴. توالی درخواست (صفحهٔ عمومی)

نمودار زیر مسیر یک درخواست عادی از مرورگر تا پاسخ HTML را نشان می‌دهد.

This diagram shows the path of a normal request from the browser to the HTML response.

sequenceDiagram
  actor V as Visitor
  participant IDX as index.php
  participant R as Router
  participant C as Controller
  participant M as Model
  participant DB as MySQL
  participant VW as View
  V->>IDX: GET /programs/computer-engineering
  IDX->>R: dispatch method and path
  R->>C: show with slug
  C->>M: Program findPublishedBySlug
  M->>DB: SELECT with slug and published filter
  DB-->>M: row
  M-->>C: program data
  C->>VW: render programs show with layout
  VW-->>C: HTML page
  C-->>V: 200 OK with HTML
Figure 4.1 - Public request. The slug in the example is illustrative. شکل ۴.۱ - درخواست عمومی. نام کد دوره در مثال صرفاً نمونه است.

5. Login sequence۵. توالی ورود

ورود با بررسی توکن CSRF و محدودیت تلاش‌های ناموفق آغاز می‌شود، سپس اعتبارسنجی کاربر انجام و نشست ساخته می‌شود. هر ورود در گزارش ممیزی ثبت می‌شود.

Login starts with CSRF token validation and a failed-attempt check. Then the user is authenticated, a session is created, and the event is written to the audit log.

sequenceDiagram
  actor U as User
  participant L as POST /teacher/login handler
  participant CS as Csrf
  participant LT as LoginThrottle
  participant UM as User model
  participant S as Session
  participant AL as AuditLog
  U->>L: POST username, password, csrf token
  L->>CS: requireValid
  alt username or password empty
    L-->>U: flash error and redirect to login
  else values present
    L->>LT: isBlocked(username, client address)
    alt attempt blocked
      L-->>U: flash error and redirect to login
    else not blocked
      L->>UM: authenticate(username, password)
      alt no user or wrong password
        L->>LT: recordFailure(username, client address)
        L-->>U: flash error and redirect to login
      else authenticated
        alt role not teacher, admin, editor or super_admin
          L-->>U: flash error and redirect to login
        else role allowed
          L->>S: login(user id)
          L->>CS: regenerate
          L->>AL: record auth.login
          L-->>U: redirect to intended URL
        end
      end
    end
  end
Source: POST /teacher/login closure in routes/web.php. The role check is a whitelist of all four roles. منبع: تابع POST /teacher/login در routes/web.php. بررسی نقش فهرست مجاز هر چهار نقش است.

6. Class diagram (Models and Core)۶. نمودار کلاس (مدل‌ها و هسته)

هر مدل با متدهای ایستا (static) کار می‌کند و به جدول متناظر خود دسترسی دارد. نمودار روابط اصلی مانند عضو هیئت‌علمی با حساب کاربری، دانشکده با افراد و برنامه‌ها، و صفحات و منوها را نشان می‌دهد.

Each model uses static methods over its table. The diagram shows the main relations: a person linked to a user account, faculties with people and programs, and pages and navigation items.

classDiagram
  direction LR
  class User {
    +int id
    +string username
    +string email
    +string role
    +bool is_active
    +authenticate(username, password)
    +create()
    +updatePassword()
    +linkableForPerson(personId)
  }
  class People {
    +int id
    +int user_id
    +int faculty_id
    +string first_name
    +string last_name
    +string position
    +bool is_active
    +isLinkedToAnotherPerson(userId, personId)
    +isPubliclyVisibleForUser(userId)
    +setPublicVisibilityForUser(userId, visible)
    +search()
  }
  class Faculty {
    +int id
    +string slug
    +string name
    +int dean_person_id
    +findActiveBySlug(slug)
    +countActive()
  }
  class Program {
    +int id
    +int faculty_id
    +string slug
    +string degree
    +bool markdown_enabled
    +findPublishedBySlug(slug)
  }
  class Page {
    +int id
    +int parent_id
    +string slug
    +string status
    +bool markdown_enabled
    +bool html_enabled
    +findPublishedBySlug(slug)
    +publishedForSitemap()
  }
  class Announcement {
    +int id
    +string slug
    +string status
    +int priority
    +publish()
    +archive()
    +latestPublished()
  }
  class DocumentCategory {
    +int id
    +int parent_id
    +string slug
    +documentCount()
  }
  class Document {
    +int id
    +int category_id
    +string file_path
    +int download_count
    +replaceFile()
    +incrementDownloadCount()
  }
  class ResearchCenter {
    +int id
    +int director_person_id
    +findActiveBySlug(slug)
  }
  class Media {
    +int id
    +string file_path
    +string storage_disk
    +images()
  }
  class Navigation {
    +int id
    +int parent_id
    +int page_id
    +string item_type
    +string display_style
    +tree()
    +url()
  }
  class HomepageSlide {
    +int id
    +starts_at
    +ends_at
    +latest()
  }
  class HomepageService {
    +int id
    +latest()
  }
  class SiteSetting {
    +string setting_key
    +get(key)
    +set(key, value)
    +getJson(key)
  }
  class AuditLog {
    +int id
    +int user_id
    +string action
    +record()
    +purgeOlderThan()
  }
  class Csrf {
    <>
    +token()
    +verify()
    +requireValid()
  }
  class Session {
    <>
    +start()
    +login(userId)
    +logout()
    +authenticated()
    +setIntendedUrl()
  }
  class LoginThrottle {
    <>
    +isBlocked()
    +recordFailure()
  }
  class HtmlSanitizer {
    <>
    +clean(html)
    +isAllowedTag(tag)
  }
  class Markdown {
    <>
    +render(text)
  }
  class ContentRenderer {
    <>
    +render(content, markdownEnabled)
  }
  class Storage {
    <>
    +storeUploadedFile()
    +delete()
    +publicUrl()
  }
  class Router {
    <>
    +get(path, handler)
    +post(path, handler)
    +dispatch()
  }
  People "0..*" --> "0..1" User : user_id (FK, nullable, app allows one person per user)
  People "many" --> "0..1" Faculty : faculty_id
  Faculty "1" --> "many" Program : offers
  Faculty "0..*" --> "0..1" People : dean_person_id (FK, nullable)
  ResearchCenter "0..*" --> "0..1" People : director_person_id (FK, nullable)
  Page "0..*" --> "0..1" Page : parent_id (FK, nullable)
  Navigation "0..*" --> "0..1" Navigation : parent_id (FK, nullable)
  Navigation "many" --> "0..1" Page : page_id
  DocumentCategory "0..*" --> "0..1" DocumentCategory : parent_id (FK, nullable)
  DocumentCategory "1" --> "0..*" Document : category_id (FK, NOT NULL)
  AuditLog "many" --> "0..1" User : user_id
  Media "0..*" --> "0..1" User : uploaded_by (FK, nullable)
  Router ..> Csrf : uses
  Router ..> Session : uses
  ContentRenderer ..> Markdown : uses
  ContentRenderer ..> HtmlSanitizer : uses
Figure 6.1 - Class diagram. Methods are the main ones only; attributes are key columns. شکل ۶.۱ - نمودار کلاس. فقط متدهای اصلی و ستون‌های کلیدی نشان داده شده‌اند.

7. Persian and English mirror۷. آینهٔ فارسی و انگلیسی

برای هر بخش فارسی یک بخش انگلیسی مستقل وجود دارد. این دو جداگانه نگهداری می‌شوند و فقط ساختار مشابهی دارند.

Every Persian content area has a separate English counterpart. They are maintained independently and share a similar structure.

Persian (default)فارسی (پیش‌فرض) English counterpartمعادل انگلیسی Tableجدول
PeopleEnglishPeoplepeople / english_people
FacultyEnglishFacultyfaculties / english_faculties
ProgramEnglishProgramprograms / english_programs
AnnouncementEnglishAnnouncementannouncements / english_announcements
Document + CategoryEnglishDocument + EnglishDocumentCategorydocuments, document_categories / english_documents, english_document_categories
ResearchCenterEnglishResearchCenterresearch_centers / english_research_centers
HomepageSlideEnglishHomepageSlidehomepage_slides / english_homepage_slides
HomepageServiceEnglishHomepageServicehomepage_services / english_homepage_services
Note: Persian pages are in the pages table. English static page text (home, about and similar) has no table: it is stored as site_settings rows whose keys start with english., for example english.home.hero.title. Navigation is in navigation_items. توجه: صفحات فارسی در جدول pages هستند. متن صفحات ثابت انگلیسی (خانه، درباره و مانند آن) جدول مستقل ندارد و در site_settings با کلیدهایی که با english. شروع می‌شوند ذخیره می‌شود، مثلاً english.home.hero.title. منوها در navigation_items هستند.

8. Database ER diagram۸. نمودار موجودیت-رابطهٔ پایگاه داده

نمودار زیر جداول اصلی فارسی و کلیدهای خارجی (Foreign Key) را نشان می‌دهد. جدول‌های انگلیسی جدا هستند و در این نمودار فقط به‌صورت خلاصه آمده‌اند.

This diagram shows the main Persian tables and their foreign keys. English tables are separate and summarised in the notes below.

erDiagram
  USERS |o--o{ PEOPLE : "user_id (nullable)"
  FACULTIES |o--o{ PEOPLE : "faculty_id (nullable)"
  FACULTIES ||--o{ PROGRAMS : "faculty_id (NOT NULL)"
  PEOPLE |o--o{ FACULTIES : "dean_person_id (nullable)"
  PEOPLE |o--o{ RESEARCH_CENTERS : "director_person_id (nullable)"
  PAGES |o--o{ PAGES : "parent_id (nullable)"
  PAGES |o--o{ NAVIGATION_ITEMS : "page_id (nullable)"
  NAVIGATION_ITEMS |o--o{ NAVIGATION_ITEMS : "parent_id (nullable)"
  DOCUMENT_CATEGORIES |o--o{ DOCUMENT_CATEGORIES : "parent_id (nullable)"
  DOCUMENT_CATEGORIES ||--o{ DOCUMENTS : "category_id (NOT NULL)"
  USERS |o--o{ PAGES : "created_by / updated_by"
  USERS |o--o{ ANNOUNCEMENTS : "created_by / updated_by"
  USERS |o--o{ DOCUMENTS : "created_by / updated_by"
  USERS |o--o{ HOMEPAGE_SLIDES : "created_by / updated_by"
  USERS |o--o{ HOMEPAGE_SERVICES : "created_by / updated_by"
  USERS |o--o{ MEDIA : "uploaded_by (nullable)"
  USERS |o--o{ AUDIT_LOGS : "user_id (nullable)"
  USERS |o--o{ ENGLISH_PEOPLE : "user_id (nullable)"
  ENGLISH_FACULTIES |o--o{ ENGLISH_PEOPLE : "faculty_id (nullable)"
  ENGLISH_FACULTIES ||--o{ ENGLISH_PROGRAMS : "faculty_id (NOT NULL)"
  ENGLISH_PEOPLE |o--o{ ENGLISH_FACULTIES : "dean_person_id (nullable)"
  ENGLISH_PEOPLE |o--o{ ENGLISH_RESEARCH_CENTERS : "director_person_id (nullable)"
  ENGLISH_DOCUMENT_CATEGORIES |o--o{ ENGLISH_DOCUMENT_CATEGORIES : "parent_id (nullable)"
  ENGLISH_DOCUMENT_CATEGORIES ||--o{ ENGLISH_DOCUMENTS : "category_id (NOT NULL)"
  USERS |o--o{ ENGLISH_ANNOUNCEMENTS : "created_by / updated_by"
  USERS |o--o{ ENGLISH_DOCUMENTS : "created_by / updated_by"
  USERS |o--o{ ENGLISH_HOMEPAGE_SLIDES : "created_by / updated_by"
  USERS |o--o{ ENGLISH_HOMEPAGE_SERVICES : "created_by / updated_by"

  USERS {
    bigint id PK
    varchar username "unique"
    varchar email "unique"
    enum role "super_admin, admin, editor, teacher"
    tinyint is_active
  }
  PEOPLE {
    bigint id PK
    bigint user_id FK "nullable, non-unique index"
    bigint faculty_id FK "nullable"
    varchar first_name
    varchar last_name
    tinyint is_active
  }
  FACULTIES {
    bigint id PK
    varchar slug "unique"
    varchar name
    bigint dean_person_id FK "nullable"
    tinyint is_active
  }
  PROGRAMS {
    bigint id PK
    bigint faculty_id FK
    varchar slug "unique"
    varchar name
    tinyint markdown_enabled
    tinyint is_active
  }
  RESEARCH_CENTERS {
    bigint id PK
    bigint director_person_id FK "nullable"
    varchar slug "unique"
    varchar name
  }
  PAGES {
    bigint id PK
    bigint parent_id FK "nullable"
    bigint created_by FK "nullable"
    varchar slug "unique"
    varchar title
    longtext content
    tinyint markdown_enabled
    tinyint html_enabled
    enum status "draft, published, private"
  }
  NAVIGATION_ITEMS {
    bigint id PK
    bigint parent_id FK "nullable"
    bigint page_id FK "nullable"
    varchar title
    varchar url
    enum target
    varchar item_type
    varchar display_style
  }
  ANNOUNCEMENTS {
    bigint id PK
    varchar slug "unique"
    varchar title
    enum status "draft, published, archived"
    int priority
  }
  DOCUMENT_CATEGORIES {
    bigint id PK
    bigint parent_id FK "nullable"
    varchar slug "unique"
    varchar name
  }
  DOCUMENTS {
    bigint id PK
    bigint category_id FK "NOT NULL"
    varchar title
    varchar file_path
    varchar mime_type
  }
  MEDIA {
    bigint id PK
    bigint uploaded_by FK "nullable"
    varchar file_path
    varchar mime_type
  }
  HOMEPAGE_SLIDES {
    bigint id PK
    varchar title
    timestamp starts_at
    timestamp ends_at
  }
  HOMEPAGE_SERVICES {
    bigint id PK
    varchar title
  }
  SITE_SETTINGS {
    varchar setting_key PK
    mediumtext setting_value
  }
  AUDIT_LOGS {
    bigint id PK
    bigint user_id FK "nullable"
    varchar action
    varchar entity_type
  }
  ENGLISH_FACULTIES {
    bigint id PK
    varchar slug "unique"
    bigint dean_person_id FK "nullable"
  }
  ENGLISH_PEOPLE {
    bigint id PK
    bigint user_id FK "nullable"
    bigint faculty_id FK "nullable"
    varchar first_name
  }
  ENGLISH_PROGRAMS {
    bigint id PK
    bigint faculty_id FK "NOT NULL"
    varchar slug "unique"
  }
  ENGLISH_RESEARCH_CENTERS {
    bigint id PK
    bigint director_person_id FK "nullable"
  }
  ENGLISH_DOCUMENT_CATEGORIES {
    bigint id PK
    bigint parent_id FK "nullable"
  }
  ENGLISH_DOCUMENTS {
    bigint id PK
    bigint category_id FK "NOT NULL"
  }
  ENGLISH_ANNOUNCEMENTS {
    bigint id PK
    varchar slug "unique"
  }
  ENGLISH_HOMEPAGE_SLIDES {
    bigint id PK
  }
  ENGLISH_HOMEPAGE_SERVICES {
    bigint id PK
  }
Notes: people.user_id is optional and links a staff profile to a login account. faculties.dean_person_id and research_centers.director_person_id point to people, and the dean link is logical (shown with a dotted line in the class diagram). site_visitors is a standalone counter table. توجه: people.user_id اختیاری است و پروفایل کارمند را به حساب ورود وصل می‌کند. faculties.dean_person_id و research_centers.director_person_id به افراد اشاره می‌کنند؛ پیوند رئیس دانشکده منطقی است. site_visitors جدول مستقل شمارندهٔ بازدید است.

9. Content status states۹. وضعیت‌های محتوا

اطلاعیه‌ها سه وضعیت دارند: پیش‌نویس، منتشرشده و بایگانی‌شده، که با متدهای publish() و archive() تغییر می‌کنند. صفحات وضعیت‌های پیش‌نویس، منتشرشده و خصوصی (private) دارند که هنگام ایجاد یا ویرایش تنظیم می‌شوند؛ مدل Page متد publish یا archive ندارد.

Announcements have three statuses (draft, published, archived) changed through publish() and archive(). Pages use draft, published and private, set when a page is created or updated; the Page model has no publish or archive method.

stateDiagram-v2
  [*] --> draft : create
  draft --> published : publish()
  published --> archived : archive()
  draft --> [*] : delete
  published --> [*] : delete
  archived --> [*] : delete
Figure 9.1 - Announcement status lifecycle. Only the transitions with explicit methods are shown. شکل ۹.۱ - چرخهٔ وضعیت اطلاعیه‌ها. فقط گذارهایی که متد صریح دارند نشان داده شده‌اند.

10. Session states۱۰. وضعیت‌های نشست

نشست کاربر پس از ورود فعال می‌شود و اگر مدتی بی‌فعالیت بماند، بر اساس تنظیم app.session.lifetime منقضی می‌شود. خروج نشست را پاک می‌کند.

The session becomes active after login. If idle for too long (based on app.session.lifetime), it expires. Logout clears it.

stateDiagram-v2
  [*] --> Anonymous
  Anonymous --> Authenticated : login ok
  Authenticated --> Authenticated : request within lifetime
  Authenticated --> Expired : idle longer than lifetime
  Authenticated --> Anonymous : logout
  Expired --> Anonymous : redirect to login

11. Content editing activity۱۱. فعالیت ویرایش محتوا

هنگام ذخیرهٔ صفحه، توکن CSRF بررسی و محتوای خام ذخیره می‌شود. پاک‌سازی در زمان نمایش انجام می‌شود: ContentRenderer در صورت فعال بودن Markdown آن را تبدیل می‌کند و در حالت HTML، محتوا از HtmlSanitizer عبور می‌کند.

When a page is saved, the CSRF token is checked and the raw content is stored. Processing happens at display time: ContentRenderer converts Markdown when it is enabled, and HTML content passes through HtmlSanitizer.

flowchart TD
  A["Editor opens page edit form"] --> B["Fill title, slug, content, SEO fields"]
  B --> C{"CSRF token valid?"}
  C -- no --> X["Request refused"]
  C -- yes --> D["Page create or update"]
  D --> E["Raw content stored with markdown_enabled and html_enabled flags"]
  E --> F["Public request for the page"]
  F --> G{"markdown_enabled?"}
  G -- yes --> H{"html_enabled?"}
  H -- yes --> I["Markdown render with HTML placeholders, then HtmlSanitizer clean"]
  H -- no --> J["Markdown render only, no sanitizer call in ContentRenderer"]
  G -- no --> K{"html_enabled?"}
  K -- yes --> L["HtmlSanitizer clean"]
  K -- no --> M["Escaped text with line breaks"]
  I --> N["Output in page view"]
  J --> N
  L --> N
  M --> N
Figure 11.1 - Page save and display path, from the page create/update action to ContentRenderer. شکل ۱۱.۱ - مسیر ذخیره و نمایش صفحه، از عمل ایجاد یا ویرایش صفحه تا ContentRenderer.

12. Security۱۲. امنیت

Mechanismمکانیسم Whereمحل پیاده‌سازی Purposeهدف
CSRF protectionمحافظت CSRF Csrf Blocks forged form submissionsجلوگیری از ارسال جعلی فرم
Role-based accessکنترل دسترسی بر اساس نقش RequireAuth, RequireRole Limits routes by roleمحدود کردن مسیرها بر اساس نقش
Login throttlingمحدودیت تلاش ورود LoginThrottle Slows brute-force attemptsکندکردن حملات حدس رمز
HTML allowlistفهرست مجاز HTML HtmlSanitizer Applied at display time to HTML content (ContentRenderer), not on saveاعمال در زمان نمایش روی محتوای HTML (ContentRenderer)، نه هنگام ذخیره
Session handlingمدیریت نشست Session Regenerates ID on login and expires idle sessionsتولید شناسه تازه هنگام ورود و انقضای نشست بی‌فعالیت
Audit trailردگیری ممیزی RequestAudit, AuditLog Records login, user management, data transfer and request events. Page edits are not audited in the code.ثبت ورود، مدیریت کاربران، انتقال داده و رویدادهای درخواست. ویرایش صفحات در کد ثبت نمی‌شود.
Log redaction and error hidingپنهان‌سازی گزارش و خطا LogRedactor, ErrorHandler Keeps secrets and stack traces away from visitorsدور نگه داشتن اطلاعات محرمانه و ردپای خطا از بازدیدکننده

13. Deployment۱۳. استقرار

سایت روی هاست اشتراکی InfinityFree اجرا می‌شود. مسیر تولید در پوشهٔ htdocs است و پیکربندی از فایل .env و پوشهٔ config خوانده می‌شود. فایل‌های آپلودی در storage و منابع استاتیک در assets قرار دارند.

The site runs on InfinityFree shared hosting. Production lives in the htdocs folder and reads configuration from .env and config. Uploads go to storage and static resources live in assets.

flowchart LR
  U["Visitor / Staff browser"] -- "HTTPS" --> AP["Apache web server (.htaccess)"]
  AP --> PHP["PHP runtime - index.php"]
  PHP --> ENV[".env and config files"]
  PHP --> DBS[("MySQL database")]
  PHP --> ST["storage: uploads, backups"]
  AP --> AS["assets: CSS, JS, images"]
Backups: the site can export a full backup, import one, and change the domain (SiteBackup). Safety backups are kept before a restore. پشتیبان‌گیری: سایت می‌تواند نسخهٔ کامل تهیه، بازیابی و دامنه را تغییر دهد (SiteBackup). پیش از بازیابی، نسخهٔ ایمنی ذخیره می‌شود.

14. Glossary۱۴. واژه‌نامه

Termواژه Meaningمعنی
RouterMaps URL paths and HTTP methods to controller actionsنگاشت مسیر URL و متد HTTP به اکشن کنترلر
MiddlewareCode that runs before a controller (auth and role checks)کدی که قبل از کنترلر اجرا می‌شود (بررسی ورود و نقش)
ModelClass that reads and writes one table (static methods)کلاسی که یک جدول را می‌خواند و می‌نویسد (متدهای ایستا)
ViewPHP template that produces HTMLقالب PHP که HTML تولید می‌کند
SlugReadable URL part, for example computer-engineeringبخش خوانای نشانی، مثلاً computer-engineering
MarkdownLight text syntax converted to HTMLنحو سادهٔ متن که به HTML تبدیل می‌شود
SanitizerRemoves unsafe HTML using an allowlistپاک‌سازی HTML ناامن با فهرست مجاز
CSRF tokenSecret value that proves a form came from this siteمقدار محرمانه‌ای که ثابت می‌کند فرم از همین سایت آمده
Foreign keyColumn that points to a row in another tableستونی که به ردیفی در جدول دیگر اشاره می‌کند
Audit logRecord of administrative actionsثبت کارهای مدیریتی
Jalali datePersian (Solar Hijri) calendar used for Persian datesتقویم شمسی که برای تاریخ‌های فارسی استفاده می‌شود