From 27322296429cfe122e5f82b26d07054c85fcafa4 Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Sun, 3 May 2026 22:26:56 +0300 Subject: [PATCH] Update: 2026-05-03 22:26:56 --- app/modules_app/users/create.php | 3 +- public/shell.php | 8 ++-- scripts/document_project.py | 63 ++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 5 deletions(-) create mode 100644 scripts/document_project.py diff --git a/app/modules_app/users/create.php b/app/modules_app/users/create.php index 83b9cbe..cc340da 100644 --- a/app/modules_app/users/create.php +++ b/app/modules_app/users/create.php @@ -37,8 +37,9 @@ $emailHash = hash('sha256', strtolower($data['email'])); // For fast lookup duri // 4. Save to Database try { - $stmt = $db->prepare("INSERT INTO users (name, email, email_hash, password_hash, role, created_at) VALUES (?, ?, ?, ?, ?, ?)"); + $stmt = $db->prepare("INSERT INTO users (tenant_id, name, email, email_hash, password_hash, role, created_at) VALUES (?, ?, ?, ?, ?, ?, ?)"); $stmt->execute([ + $decoded['tenant_id'], $encryptedName, $encryptedEmail, $emailHash, diff --git a/public/shell.php b/public/shell.php index 69bf140..d25a9e8 100644 --- a/public/shell.php +++ b/public/shell.php @@ -166,11 +166,11 @@
- +
- +
@@ -196,7 +196,7 @@ showAddModal: false, showAddCompanyModal: false, newUser: { name: '', email: '', password: '', role: 'employee' }, - newCompany: { name: '', tax_number: '', registration_number: '', address: '' }, + newCompany: { name: '', tax_identification_number: '', commercial_registration_number: '', address: '' }, init() { if (!this.user) window.location.href = '/login.php'; @@ -266,7 +266,7 @@ const json = await res.json(); if (json.success) { this.showAddCompanyModal = false; - this.newCompany = { name: '', tax_number: '', registration_number: '', address: '' }; + this.newCompany = { name: '', tax_identification_number: '', commercial_registration_number: '', address: '' }; this.loadCompanies(); alert('تم إنشاء الشركة بنجاح'); } else { diff --git a/scripts/document_project.py b/scripts/document_project.py new file mode 100644 index 0000000..747cbe7 --- /dev/null +++ b/scripts/document_project.py @@ -0,0 +1,63 @@ +import os +import re + +def mask_env_value(line): + if '=' not in line: + return line + key, value = line.split('=', 1) + value = value.strip() + if len(value) <= 6: + masked = '*' * len(value) + else: + masked = value[:3] + '*' * (len(value) - 6) + value[-3:] + return f"{key}={masked}" + +def document_project(root_dir, output_file): + skip_dirs = {'.git', 'vendor', 'node_modules', 'storage', '.gemini'} + extensions = {'.php', '.js', '.css', '.html', '.sql', '.env', '.json', '.sh'} + + with open(output_file, 'w', encoding='utf-8') as f: + f.write("# Musadaq Project Documentation\n\n") + f.write("This file contains the complete source code of the project (excluding dependencies and sensitive data).\n\n") + + for root, dirs, files in os.walk(root_dir): + # Skip unwanted directories + dirs[:] = [d for d in dirs if d not in skip_dirs] + + for file in files: + file_path = os.path.join(root, file) + rel_path = os.path.relpath(file_path, root_dir) + + # Check if file should be included + _, ext = os.path.splitext(file) + if ext not in extensions: + continue + + f.write(f"## File: `{rel_path}`\n\n") + + lang = ext.replace('.', '') + if lang == 'env': + lang = 'bash' + elif lang == 'php': + lang = 'php' + + f.write(f"```{lang}\n") + + try: + with open(file_path, 'r', encoding='utf-8') as src: + for line in src: + if ext == '.env': + f.write(mask_env_value(line) + "\n") + else: + f.write(line) + except Exception as e: + f.write(f"// Error reading file: {e}\n") + + f.write("\n```\n\n") + +if __name__ == "__main__": + current_dir = os.getcwd() + output_path = os.path.join(current_dir, "PROJECT_DOCUMENTATION.md") + print(f"Documenting project in: {current_dir}...") + document_project(current_dir, output_path) + print(f"Documentation generated at: {output_path}")