<?php
declare(strict_types=1);
http_response_code(410);exit('Setup completed.');/*
function psls(mysqli $con,string $sql):mysqli_stmt{$s=$con->prepare($sql);if(!$s)throw new RuntimeException('Setup failed.');return $s;}
try{$con->begin_transaction();$parentName='Pay Scale Master';$parentLink='salary-config/pay-scales.php';$s=psls($con,'SELECT id FROM jos_admin_menus WHERE LOWER(TRIM(menu_link))=LOWER(?) OR LOWER(TRIM(url))=LOWER(?) OR LOWER(TRIM(menu_name))=LOWER(?) ORDER BY id LIMIT 1');$s->bind_param('sss',$parentLink,$parentLink,$parentName);$s->execute();$parent=(int)($s->get_result()->fetch_assoc()['id']??0);$s->close();if(!$parent)throw new RuntimeException('Parent missing.');$name='Pay Scale List';$link='salary-config/pay-scale-list.php';$s=psls($con,'SELECT id FROM jos_admin_menus WHERE LOWER(TRIM(menu_link))=LOWER(?) OR LOWER(TRIM(url))=LOWER(?) OR (LOWER(TRIM(menu_name))=LOWER(?) AND parent_id=?) ORDER BY id LIMIT 1');$s->bind_param('sssi',$link,$link,$name,$parent);$s->execute();$menu=(int)($s->get_result()->fetch_assoc()['id']??0);$s->close();$icon='fa-solid fa-list';$remarks='Filter and review Pay Scale records.';$sort=1;if($menu){$s=psls($con,'UPDATE jos_admin_menus SET menu_name=?,parent_id=?,menu_link=?,url=?,icon=?,remarks=?,status=1,show_in_menu=1,sort_order=? WHERE id=?');$s->bind_param('sissssii',$name,$parent,$link,$link,$icon,$remarks,$sort,$menu);}else{$s=psls($con,'INSERT INTO jos_admin_menus(menu_name,parent_id,menu_link,url,icon,remarks,status,show_in_menu,sort_order) VALUES(?,?,?,?,?,?,1,1,?)');$s->bind_param('sissssi',$name,$parent,$link,$link,$icon,$remarks,$sort);}$s->execute();if(!$menu)$menu=(int)$s->insert_id;$s->close();$role=1;$s=psls($con,'SELECT id FROM jos_admin_rolemenus WHERE role_id=? AND menu_id=? LIMIT 1');$s->bind_param('ii',$role,$menu);$s->execute();$rm=(int)($s->get_result()->fetch_assoc()['id']??0);$s->close();if($rm){$s=psls($con,'UPDATE jos_admin_rolemenus SET can_view=1,can_add=0,can_edit=1,can_delete=1,status=1 WHERE id=?');$s->bind_param('i',$rm);}else{$s=psls($con,'INSERT INTO jos_admin_rolemenus(role_id,menu_id,can_view,can_add,can_edit,can_delete,status) VALUES(?,?,1,0,1,1,1)');$s->bind_param('ii',$role,$menu);}$s->execute();$s->close();$con->commit();exit('OK');}catch(Throwable $e){$con->rollback();http_response_code(500);exit('Setup failed.');}*/
