33 lines
945 B
Python
33 lines
945 B
Python
import re
|
|
|
|
files = ['subjects.php', 'global_cycles.php']
|
|
|
|
for file in files:
|
|
with open(file, 'r', encoding='utf-8') as f:
|
|
content = f.read()
|
|
|
|
access_check = r"""
|
|
if (!is_super_admin()) {
|
|
http_response_code(403);
|
|
render_page_start('صلاحيات غير كافية', '');
|
|
?>
|
|
<section class="py-5 text-center">
|
|
<div class="container-xxl">
|
|
<h1 class="mb-3">عذراً</h1>
|
|
<p>هذه الصفحة مخصصة للمشرف العام فقط.</p>
|
|
<a href="index.php" class="btn btn-dark mt-3">العودة للرئيسية</a>
|
|
</div>
|
|
</section>
|
|
<?php
|
|
render_page_end();
|
|
exit;
|
|
}
|
|
"""
|
|
|
|
if 'if (!is_super_admin())' not in content:
|
|
content = content.replace("require_once __DIR__ . '/includes/app.php';", "require_once __DIR__ . '/includes/app.php';\n" + access_check)
|
|
|
|
with open(file, 'w', encoding='utf-8') as f:
|
|
f.write(content)
|
|
|