39669-vm/patch_approved_school.py
2026-04-16 14:19:43 +00:00

39 lines
1.0 KiB
Python

import re
with open('approved_school.php', 'r') as f:
content = f.read()
# Replace the layout start
layout_start_replacement = """<section class="py-4 py-lg-5">
<div class="container-xxl">
<div class="row g-4 align-items-start">
<div class="col-lg-3">
<?php if ($application) { require __DIR__ . '/includes/center_sidebar.php'; } else { require __DIR__ . '/includes/sidebar.php'; } ?>
</div>
<div class="col-lg-9">
<?php if (!$isApproved): ?>"""
content = re.sub(r'<section class="py-4 py-lg-5">\s*<div class="container-xxl">\s*<\?php if \(!\$isApproved\): \?>', layout_start_replacement, content)
# Replace the layout end. Wait, currently it is:
# </div>
# </div>
#
# </div>
# </section>
# Let's just do string replacement for the end.
end_str = """ </div>
</div>
</div>
</section>"""
new_end_str = """ </div>
</div>
</div>
</div>
</section>"""
content = content.replace(end_str, new_end_str)
with open('approved_school.php', 'w') as f:
f.write(content)